  /* Fuentes OpenDyslexic */
        @font-face {
            font-family: 'OpenDyslexic';
            src: url('../fonts/OpenDyslexic-Regular.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }

        @font-face {
            font-family: 'OpenDyslexic';
            src: url('../fonts/OpenDyslexic-Italic.otf') format('opentype');
            font-weight: normal;
            font-style: italic;
        }

        @font-face {
            font-family: 'OpenDyslexic';
            src: url('../fonts/OpenDyslexic-BoldItalic.otf') format('opentype');
            font-weight: bold;
            font-style: italic;
        }

        /* CSS Variables */
        :root {
            /* Paleta moderna y equilibrada */
            --primary: #2196f3;
            --primary-light: #64b5f6;
            --secondary: #0ea5e9;
            --accent: #107bb9;
            --accent-warm: #f59e0b;
            --surface: #ffffff;
            --surface-elevated: #f8fafc; 
            --surface-secondary: #f1f5f9;
            --text-primary: #0f172a;
            --text-secondary: #475569;
            --text-muted: #64748b;
            --border: #e2e8f0;
            --gradient-primary: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #3b82f6 100%);
            --gradient-accent: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
            --gradient-bg: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f1f5f9 100%);
            --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
            --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
            --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
            --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
        }

        /* Modo oscuro */
        body.dark-mode {
            --primary: #60a5fa;
            --primary-light: #93c5fd;
            --secondary: #3b82f6;
            --accent: #06b6d4;
            --accent-warm: #f59e0b;
            --surface: #1e293b;
            --surface-elevated: #334155;
            --surface-secondary: #475569;
            --text-primary: #f1f5f9;
            --text-secondary: #cbd5e1;
            --text-muted: #94a3b8;
            --border: #4a5568;
            --gradient-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
            --gradient-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
        }


        body.dark-mode {
            background: var(--surface);
        }

        body.dark-mode .btn,
        body.dark-mode .page-nav button {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #3b82f6 100%);
        }

        body.dark-mode .btn:hover,
        body.dark-mode .page-nav button:hover {
            background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        }

        body.dark-mode .header {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #3b82f6 100%);
        }

        body.dark-mode .control-group:hover {
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }

        /* Modos de daltonismo */
        body.colorblind-protanopia {
            --accent: #fbbf24;
            --accent-warm: #f59e0b;
        }

        body.colorblind-tritanopia {
            --accent: #ef4444;
            --accent-warm: #dc2626;
        }

        /* Base typography */
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            letter-spacing: 0.5px;
            word-spacing: 2px;
        }

        /* Back button styles */
        .back-btn {
            position: fixed;
            top: 2rem;
            left: 2rem;
            background: var(--surface);
            border: 2px solid var(--border);
            border-radius: 12px;
            padding: 0.75rem 1.5rem;
            font-family: inherit;
            font-weight: 600;
            color: var(--text-primary);
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            box-shadow: var(--shadow-sm);
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 1000;
        }

        .back-btn:hover {
            background: var(--surface-secondary);
            border-color: var(--text-muted);
            box-shadow: var(--shadow-md);
            transform: translateY(-1px);
        }

        body {
            background: var(--gradient-bg);
            min-height: 100vh;
            padding: 20px;
            transition: all 0.3s ease;
        }

        #darkModeToggle {
            min-width: 60px !important; /* Reduce width of dark mode button */
            padding: 12px 0 !important; /* Adjust padding */
        }

        /* Controles de accesibilidad */
        .header-controls .control-btn,
        .control-btn,
        button.control-btn,
        select.control-btn {
            background: rgba(255, 255, 255, 0.95) !important;
            border: 1px solid rgba(255, 255, 255, 0.4) !important;
            border-radius: 8px !important;
            padding: 12px 20px !important;
            cursor: pointer !important;
            font-size: 14px !important;
            font-weight: 600 !important;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
            transition: all 0.2s ease !important;
            font-family: inherit !important;
            color: #1e3c72 !important;
            min-width: 140px !important;
            text-align: center !important;
        }

        .header-controls .control-btn:hover,
        .control-btn:hover,
        button.control-btn:hover,
        select.control-btn:hover,
        #colorblindMode:hover,
        #darkModeToggle:hover {
            background: rgba(248, 250, 252, 1) !important;
            color: #1e3c72 !important;
            border-color: rgba(30, 60, 114, 0.2) !important;
            transform: translateY(-1px) !important;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
        }

        .header-controls .control-btn:focus,
        .control-btn:focus,
        button.control-btn:focus,
        select.control-btn:focus {
            outline: none !important;
            box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3) !important;
        }

        /* Dark mode styles for controls */
        body.dark-mode .header-controls .control-btn,
        body.dark-mode .control-btn,
        body.dark-mode button.control-btn,
        body.dark-mode select.control-btn {
            background: rgba(30, 41, 59, 0.95) !important;
            color: #e2e8f0 !important;
            border-color: rgba(100, 116, 139, 0.4) !important;
        }

        body.dark-mode .header-controls .control-btn:hover,
        body.dark-mode .control-btn:hover,
        body.dark-mode button.control-btn:hover,
        body.dark-mode select.control-btn:hover,
        body.dark-mode #colorblindMode:hover,
        body.dark-mode #darkModeToggle:hover {
            background: rgba(20, 30, 40, 1) !important;
            color: #cbd5e1 !important;
            border-color: rgba(71, 85, 105, 0.5) !important;
            transform: translateY(-1px) !important;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
        }

        /* Estilos más específicos para asegurar que se apliquen */
        body.dark-mode select#colorblindMode:hover,
        body.dark-mode button#darkModeToggle:hover {
            background: rgba(20, 30, 40, 1) !important;
            color: #cbd5e1 !important;
            border-color: rgba(71, 85, 105, 0.5) !important;
            transform: translateY(-1px) !important;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
        }

        body.dark-mode .header-controls .control-btn:focus,
        body.dark-mode .control-btn:focus,
        body.dark-mode button.control-btn:focus,
        body.dark-mode select.control-btn:focus {
            box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.3) !important;
        }

        button, input, select, textarea, .btn {
            font-family: inherit;
            font-size: inherit;
            letter-spacing: inherit;
            word-spacing: inherit;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            background: var(--surface);
            border-radius: 24px;
            box-shadow: var(--shadow-xl);
            overflow: hidden;
            width: 100%;
            padding: 0;
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
        }

        .container > * {
            padding: 0 15px;
        }

      

        .header-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
            position: relative;
            z-index: 2;
            display: flex;
            justify-content: center; /* Center the title */
            align-items: center;
            width: 100%;
        }

        .header-title {
            text-align: center;
        }

        .header-controls {
            position: absolute;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            gap: 10px;
            align-items: center;
        }

        @media (max-width: 576px) {
            .header {
                padding: 20px 0;
            }
            .header-content {
                padding: 0 15px;
                flex-direction: column;
                gap: 20px;
            }
            .header-controls {
                margin-left: 0 !important;
            }
        }

        .header {
            background: var(--gradient-primary);
            color: white;
            padding: 40px 0;
            text-align: left;
            position: relative;
            border-top-left-radius: 20px;
            border-top-right-radius: 20px;
            border-bottom-left-radius: 25px;
            border-bottom-right-radius: 25px;
            margin-bottom: 25px;
            box-shadow: var(--shadow-lg);
            width: 100%;
            max-width: 100%;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 20px;
            transition: all 0.3s ease;
        }

        .header h1 {
            font-size: 1.6rem;
            margin: 0;
            text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
            font-weight: 700;
            color: white;
        }

        .header p {
            margin: 5px 0 0 0;
            color: rgba(255, 255, 255, 0.9);
            font-size: 0.9rem;
        }

        .header .controls {
            display: flex;
            gap: 15px;
            align-items: center;
        }

        .header .controls button {
            padding: 8px 16px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            font-size: 0.9rem;
            transition: all 0.3s ease;
        }

        .header .controls button:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: translateY(-2px);
        }

        .header > div {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }






        .upload-section {
            padding: 20px 15px;
            text-align: center;
            border-bottom: 2px solid var(--border);
            background: var(--surface-elevated);
            transition: all 0.3s ease;
        }

        .upload-section h2 {
            color: var(--text-primary);
            font-size: 30px;
            text-align: center;
            margin: 0 0 20px;
        }

        @media (min-width: 768px) {
            .upload-section {
                padding: 40px;
            }
        }

        .upload-area {
            border: 3px dashed var(--primary);
            border-radius: 20px;
            padding: 20px 15px;
            background: var(--surface);
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .upload-area::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg, transparent, rgba(33, 150, 243, 0.05), transparent);
            transition: transform 0.6s ease;
            transform: translateX(-100%);
        }

        .upload-area:hover::before {
            transform: translateX(100%);
        }

        @media (min-width: 576px) {
            .upload-area {
                padding: 30px 20px;
            }
        }

        @media (min-width: 768px) {
            .upload-area {
                padding: 50px;
            }
        }

        .upload-area:hover {
            border-color: #1976d2;
            background: linear-gradient(45deg, #e3f2fd, #bbdefb);
            transform: translateY(-3px);
            box-shadow: 0 15px 35px rgba(33, 150, 243, 0.2);
        }

        /* Hover más suave para modo oscuro */
        body.dark-mode .upload-area:hover {
            border-color: #4a5568;
            background: linear-gradient(45deg, #2d3748, #4a5568);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        }

        .upload-area.dragover {
            border-color: #0d47a1;
            background: linear-gradient(45deg, #e8f4fd, #c3e9ff);
            box-shadow: 0 20px 40px rgba(13, 71, 161, 0.3);
        }

        body.dark-mode .upload-area h3,
        body.dark-mode .upload-area p {
            color: var(--text-primary);
        }

        /* Dragover más suave para modo oscuro */
        body.dark-mode .upload-area.dragover {
            border-color: #718096;
            background: linear-gradient(45deg, #1a202c, #2d3748);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
        }

        #fileInput {
            display: none;
        }

        .upload-icon {
            font-size: 3rem;
            color: var(--primary);
            margin-bottom: 15px;
            filter: drop-shadow(2px 2px 4px rgba(33, 150, 243, 0.3));
        }

        #loadedFileDisplay {
            margin-top: 20px;
            padding: 15px;
            background: #e3f2fd;
            border-radius: 10px;
            text-align: center;
        }

        #currentFileName {
            font-size: 1.1rem;
            color: #1976d2;
            font-weight: 600;
            margin-bottom: 10px;
        }

        .btn-secondary {
            background: linear-gradient(135deg, #64b5f6, #2196f3);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 25px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
        }

        .btn-secondary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
            background: linear-gradient(135deg, #1976d2, #0d47a1);
        }

        .btn-secondary:disabled {
            background: linear-gradient(135deg, #b0bec5, #90a4ae);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .upload-area.dragover {
            border-color: #0d47a1;
            background: linear-gradient(45deg, #e8f4fd, #c3e9ff);
            box-shadow: 0 20px 40px rgba(13, 71, 161, 0.3);
        }

        @media (min-width: 576px) {
            .upload-icon {
                font-size: 4rem;
            }
        }

        .btn {
            background: var(--gradient-primary);
            color: white;
            border: none;
            padding: 12px 20px;
            border-radius: 30px;
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: var(--shadow-lg);
            width: 100%;
            margin-bottom: 10px;
            position: relative;
            overflow: hidden;
            font-weight: 600;
        }

        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transition: left 0.5s ease;
        }

        .btn:hover::before {
            left: 100%;
        }

        @media (min-width: 576px) {
            .btn {
                width: auto;
                padding: 15px 35px;
                font-size: 1.1rem;
                margin-bottom: 0;
            }
        }

        .btn:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow-xl);
            background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%);
        }

        .btn:disabled {
            background: var(--surface-secondary);
            color: var(--text-muted);
            cursor: not-allowed;
            box-shadow: none;
            transform: none;
        }

        body.dark-mode .btn:disabled,
        body.dark-mode .page-nav button:disabled {
            background: var(--surface-secondary) !important;
            opacity: 0.5;
            color: var(--text-muted) !important;
            cursor: not-allowed;
        }

        .main-content {
            display: none;
            padding: 20px 15px;
            background: var(--surface-elevated);
            transition: all 0.3s ease;
        }

        .main-content h1 {
            color: var(--text-primary);
            font-size: 30px;
            text-align: center;
            margin: 0;
        }

        @media (min-width: 768px) {
            .main-content {
                padding: 30px;
            }
        }

        @media (min-width: 992px) {
            .main-content {
                padding: 40px;
            }
        }

        .editor-layout {
            display: flex;
            flex-direction: column;
            gap: 20px;
            height: auto;
        }

        @media (min-width: 992px) {
            .editor-layout {
                display: grid;
                grid-template-columns: 350px 1fr;
                height: 700px;
                flex-direction: row;
            }
        }

        .controls-panel {
            background: var(--surface);
            border-radius: 20px;
            padding: 15px;
            border: 2px solid var(--border);
            box-shadow: var(--shadow-lg);
            overflow-y: auto;
            max-height: 500px;
            transition: all 0.3s ease;
        }

        @media (min-width: 992px) {
            .controls-panel {
                padding: 25px;
                max-height: 700px;
            }
        }

        .control-group {
            margin-bottom: 25px;
            padding: 20px;
            background: var(--surface);
            border-radius: 15px;
            box-shadow: var(--shadow-md);
            border: 1px solid var(--border);
            transition: all 0.3s ease;
        }

        .control-group:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(33, 150, 243, 0.15);
        }

        .control-group h3 {
            color: var(--primary);
            margin-bottom: 15px;
            font-size: 1.2rem;
            border-bottom: 3px solid var(--primary);
            padding-bottom: 8px;
            font-weight: 700;
        }

        .control-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .control-group input, .control-group select {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid var(--border);
            border-radius: 12px;
            font-size: 1rem;
            transition: all 0.3s ease;
            background: var(--surface-elevated);
            color: var(--text-primary);
        }

        .control-group input:focus, .control-group select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.1);
            background: var(--surface);
        }

        .color-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
            margin-top: 10px;
        }

        @media (min-width: 400px) {
            .color-grid {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (min-width: 576px) {
            .color-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: 12px;
            }
        }

        .color-option {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            cursor: pointer;
            border: 3px solid transparent;
            transition: all 0.3s ease;
            box-shadow: var(--shadow-md);
            position: relative;
        }

        .color-option::before {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: linear-gradient(45deg, #2196f3, #03a9f4);
            border-radius: 12px;
            opacity: 0;
            transition: opacity 0.3s ease;
            z-index: -1;
        }

        .color-option:hover {
            transform: scale(1.15);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
        }

        .color-option:hover::before {
            opacity: 1;
        }

        .color-option.selected {
            border-color: var(--primary);
            transform: scale(1.1);
            box-shadow: 0 8px 25px rgba(25, 118, 210, 0.4);
        }

        .preview-area {
            background: var(--surface);
            border-radius: 20px;
            padding: 15px;
            border: 2px solid var(--border);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            margin-top: 20px;
            transition: all 0.3s ease;
        }

        @media (min-width: 992px) {
            .preview-area {
                padding: 20px;
                margin-top: 0;
            }
        }

        .preview-header {
            background: var(--gradient-primary);
            color: white;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-radius: 15px;
            margin-bottom: 15px;
            box-shadow: var(--shadow-lg);
        }

        .preview-content {
            flex: 1;
            overflow: auto;
            padding: 20px;
            background: var(--surface-elevated);
            border-radius: 15px;
            transition: all 0.3s ease;
        }

        #pdfPreview {
            width: 100%;
            min-height: 500px;
            background: var(--surface);
            border-radius: 15px;
            padding: 30px;
            box-shadow: var(--shadow-md);
            font-family: Arial, sans-serif;
            line-height: 1.6;
            white-space: pre-wrap;
            word-wrap: break-word;
            overflow-wrap: break-word;
            border: 1px solid var(--border);
            color: var(--text-primary);
            transition: all 0.3s ease;
        }

        @media (min-width: 768px) {
            #pdfPreview {
                padding: 40px;
            }
        }

        .download-section {
            text-align: center;
            padding: 30px 20px;
            background: var(--surface-elevated);
            border-top: 3px solid var(--primary);
            transition: all 0.3s ease;
        }

        .btn-download {
            background: linear-gradient(135deg, #00acc1 0%, #0097a7 100%);
            box-shadow: 0 8px 25px rgba(0, 172, 193, 0.4);
            font-size: 1.2rem;
            padding: 18px 40px;
        }

        .btn-download:hover {
            box-shadow: 0 12px 30px rgba(0, 172, 193, 0.6);
            background: linear-gradient(135deg, #0097a7 0%, #00838f 100%);
        }

        .loading {
            display: none;
            text-align: center;
            padding: 40px 20px;
            background: var(--surface-elevated);
            transition: all 0.3s ease;
        }

        .loading p {
            color: var(--text-primary);
            margin-top: 20px;
            font-size: 1.1rem;
        }

        .spinner {
            border: 4px solid var(--border);
            border-top: 4px solid var(--primary);
            border-radius: 50%;
            width: 60px;
            height: 60px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .page-nav {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .page-nav button {
            background: linear-gradient(135deg, #2196f3, #1976d2);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 25px;
            cursor: pointer;
            font-weight: 600;
            font-size: clamp(0.8rem, 2vw, 0.9rem);
            transition: all 0.3s ease;
            box-shadow: var(--shadow-sm);
            white-space: nowrap;
        }

        .page-nav button:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

        .page-nav button:disabled {
            background: linear-gradient(135deg, #b0bec5, #90a4ae);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .page-nav span {
            font-weight: 600;
            color: white;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
            font-size: clamp(0.8rem, 2vw, 0.9rem);
            white-space: nowrap;
        }

        @media (max-width: 1024px) {
            .editor-layout {
                grid-template-columns: 1fr;
                height: auto;
            }

            .controls-panel {
                order: 2;
            }

            .preview-header {
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                gap: 8px !important;
                flex-wrap: wrap !important;
            }
            .preview-header .page-nav {
                justify-content: center !important;
                width: 100% !important;
                flex-wrap: wrap !important;
            }
            .preview-header #pageInfo {
                order: -1 !important;
                width: 100% !important;
                text-align: center !important;
                margin-bottom: 6px !important;
            }
        }


        /* Font Size Slider Styles - mantener apariencia de modo claro también en modo oscuro */
        /* Se eliminan los estilos específicos de modo oscuro para el range,
           de modo que el control use el estilo por defecto del modo claro */

        /* Filtros para modos de daltonismo */
        body.protanopia {
            filter: url('#protanopia');
        }

        body.tritanopia {
            filter: url('#tritanopia');
        }

        .svg-filters {
            position: absolute;
            height: 0;
            width: 0;
            overflow: hidden;
        }

        .colorblind-selector {
            display: flex;
            align-items: center;
            margin-left: 20px;
        }

        .colorblind-selector select {
            padding: 10px 40px 10px 15px;
            border-radius: 25px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            background-color: rgba(255, 255, 255, 0.15);
            color: white;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            transition: all 0.3s ease;
            backdrop-filter: blur(10px);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            min-width: 200px;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        }

        .colorblind-selector select:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.6);
            box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
        }

        .colorblind-selector select option {
            background-color: #1976d2;
            color: white;
        }

        /* Custom Select Styles */
        .custom-select-wrapper {
            position: relative;
            display: inline-block;
            user-select: none;
        }
        .custom-select {
            position: relative;
        }
        .custom-select__trigger {
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor: pointer;
        }
        .custom-options {
            position: absolute;
            display: none;
            top: 100%;
            left: 0;
            right: 0;
            background: var(--surface-elevated);
            border: 1px solid var(--border);
            border-radius: 8px;
            z-index: 2;
            margin-top: 4px;
            box-shadow: var(--shadow-lg);
            overflow: hidden;
        }
        .custom-select.open .custom-options {
            display: block;
        }
        .custom-option {
            padding: 12px 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center; /* Center content */
            gap: 10px; /* Space between icon and text */
            transition: background-color 0.2s ease;
        }
        .custom-option:hover {
            background-color: var(--surface-secondary);
        }
        .arrow {
            position: relative;
            height: 10px;
            width: 10px;
            margin-left: 10px;
        }
        .arrow::before, .arrow::after {
            content: '';
            position: absolute;
            bottom: 0px;
            width: 0.15rem;
            height: 100%;
            background-color: var(--text-primary);
            transition: all 0.2s ease;
        }
        .arrow::before {
            left: -3px;
            transform: rotate(-45deg);
        }
        .arrow::after {
            left: 3px;
            transform: rotate(45deg);
        }
        .custom-select.open .arrow::before {
            transform: rotate(45deg);
        }
        .custom-select.open .arrow::after {
            transform: rotate(-45deg);
        }

        /* Estilos responsive mejorados */
        @media (max-width: 768px) {
            /* Header grid: Row 1 title, Row 2 back + controls side-by-side */
            .header {
                display: grid !important;
                grid-template-columns: auto 1fr auto !important;
                grid-template-areas:
                    "title title title"
                    "back controls controls" !important;
                align-items: center !important;
                gap: 12px 12px !important;
            }
            /* Flatten children to allow grid placement without changing HTML */
            .header-content { display: contents !important; }
            .header-title { grid-area: title !important; }
            /* Force reset of absolute positioning and place controls in grid */
            .header .header-controls {
                grid-area: controls !important;
                position: static !important;
                right: auto !important;
                top: auto !important;
                transform: none !important;
                width: 100% !important;
                display: flex !important;
                flex-wrap: nowrap !important; /* keep select and dark mode on the same line */
                justify-content: center !important; /* Center the select and keep dark mode beside */
                align-items: center !important; /* vertically align both controls */
                gap: 10px !important;
                margin: 0 auto !important;
                z-index: 1;
            }
            /* Normalize heights so both controls align perfectly */
            .header .header-controls .custom-select.control-btn,
            .header .header-controls #darkModeToggle {
                height: 44px !important;
                padding: 10px 16px !important;
                display: flex !important;
                align-items: center !important;
                line-height: 1 !important;
            }
            .header .header-controls .custom-select.control-btn .custom-select__trigger {
                height: 100% !important;
                display: flex !important;
                align-items: center !important;
                line-height: 1 !important;
            }
            /* Remove wrapper influence so both sit flush */
            .header .header-controls .custom-select-wrapper {
                display: contents !important;
            }
            /* Unify any generic control-btn styles on mobile */
            .header .header-controls .control-btn {
                height: 44px !important;
                padding: 10px 16px !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                line-height: 1 !important;
                min-width: auto !important; /* avoid oversized buttons forcing misalignment */
                margin: 0 !important; /* normalize spacing */
            }
            /* Back button placed in the same row as controls (left) */
            .back-btn {
                grid-area: back !important;
                position: static !important; /* stop being fixed */
                top: auto !important;
                left: auto !important;
                margin: 0 !important;
                justify-self: start !important;
                align-self: center !important;
                z-index: 0 !important;
                height: 44px !important;
                padding: 10px 16px !important;
                font-size: 14px !important;
                line-height: 1 !important;
                display: inline-flex !important;
                align-items: center !important;
                gap: 8px !important;
            }
            .header h1 {
                text-align: center;
                font-size: 1.25rem;
            }
            .header {
                padding: 24px 0;
            }

            /* Vista Previa: título arriba, botones abajo centrados */
            .preview-header {
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                gap: 8px !important;
                padding: 14px 16px !important;
                flex-wrap: wrap !important;
            }
            .preview-header h3 {
                align-self: stretch !important;
                margin: 0 !important;
                text-align: left !important;
                font-size: 1.05rem !important;
            }
            .preview-header .page-nav {
                justify-content: center !important;
                gap: 10px !important;
                width: 100% !important;
                flex-wrap: wrap !important;
            }
            .preview-header .page-nav button {
                padding: 7px 14px !important;
                font-size: 0.95rem !important;
                border-radius: 9999px !important;
            }
            .preview-header #pageInfo {
                font-size: 0.95rem !important;
                order: -1 !important;
                width: 100% !important;
                text-align: center !important;
                margin-bottom: 6px !important;
            }
        }

        @media (max-width: 576px) {
            body {
                padding: 10px;
            }
            
            .container {
                border-radius: 16px;
                padding: 0 10px;
            }
            
            .header {
                padding: 20px 15px;
            }
            
            .header h1 {
                font-size: 1.5rem;
            }
            
            .upload-area {
                padding: 20px 15px;
            }
            
            .upload-icon {
                font-size: 2.5rem;
            }
            
            .btn {
                padding: 12px 20px;
                font-size: 0.95rem;
            }

            .page-nav button {
                padding: 6px 12px !important;
                font-size: 0.8rem !important;
            }

            .page-nav span {
                font-size: 0.8rem !important;
            }

            .preview-header {
                padding: 12px 14px !important;
            }
        }