* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary: #2563eb;
            --primary-light: #3b82f6;
            --primary-dark: #1d4ed8;
            --secondary: #10b981;
            --secondary-light: #34d399;
            --dark: #0f172a;
            --dark-light: #1e293b;
            --light: #f8fafc;
            --gray: #64748b;
            --gray-light: #e2e8f2;
            --danger: #ef4444;
            --warning: #f59e0b;
            --success: #10b981;
            --radius: 16px;
            --shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.15);
            --transition: all 0.2s ease;
        }

        body {
            font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(145deg, #f0f4ff 0%, #f5f0ff 100%);
            color: var(--dark);
            line-height: 1.5;
            min-height: 100vh;
            padding: 1.5rem;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
        }

        /* ----- header ----- */
        header {
            background: rgba(255,255,255,0.8);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255,255,255,0.5);
            border-radius: var(--radius);
            padding: 2.5rem 2rem;
            margin-bottom: 2.5rem;
            text-align: center;
            box-shadow: var(--shadow);
        }

        h1 {
            font-size: 3.2rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            background: linear-gradient(135deg, var(--primary), #7c3aed);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            margin-bottom: 1rem;
        }

        .subtitle {
            font-size: 1.2rem;
            color: var(--gray);
            max-width: 750px;
            margin: 0 auto 1.8rem;
        }

        .features {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.8rem 1.5rem;
            margin: 2rem 0 1rem;
        }

        .feature {
            background: rgba(37,99,235,0.08);
            padding: 0.6rem 1.4rem;
            border-radius: 40px;
            display: inline-flex;
            align-items: center;
            gap: 0.6rem;
            font-weight: 500;
            color: var(--primary-dark);
            border: 1px solid rgba(37,99,235,0.2);
        }

        .security-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.8rem;
            background: rgba(16,185,129,0.1);
            color: var(--secondary);
            padding: 0.7rem 2rem;
            border-radius: 40px;
            border: 1px solid rgba(16,185,129,0.3);
            font-weight: 500;
        }

        /* ----- main grid ----- */
        .app-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2rem;
            margin-bottom: 2.5rem;
        }

        @media (max-width: 900px) {
            .app-container { grid-template-columns: 1fr; }
        }

        .panel {
            background: white;
            border-radius: var(--radius);
            padding: 2rem;
            box-shadow: var(--shadow);
            transition: transform 0.2s;
        }
        .panel:hover { transform: translateY(-4px); }

        .panel-title {
            font-size: 1.6rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 0.7rem;
            padding-bottom: 1rem;
            border-bottom: 3px solid var(--gray-light);
            margin-bottom: 2rem;
            color: var(--dark);
        }

        /* ----- upload area ----- */
        .file-upload-area {
            border: 3px dashed var(--gray-light);
            border-radius: calc(var(--radius) * 1.5);
            padding: 3rem 1.5rem;
            text-align: center;
            cursor: pointer;
            transition: var(--transition);
            background: linear-gradient(145deg, #fafcff, #f3f7fe);
            margin-bottom: 1.5rem;
        }
        .file-upload-area:hover {
            border-color: var(--primary);
            background: #eef2ff;
        }
        .file-upload-area.drag-over {
            border-color: var(--primary);
            background: #dbeafe;
            transform: scale(1.01);
        }
        .file-upload-area i { font-size: 3.8rem; color: var(--primary); opacity: 0.7; margin-bottom: 1rem; }
        .file-size-info { font-size: 0.9rem; color: var(--gray); margin-top: 0.8rem; }
        .file-size-info i { font-size: 1rem; margin-right: 0.3rem; color: var(--warning); }

        .file-input { display: none; }

        .file-info {
            background: #ecfdf5;
            border-left: 5px solid var(--secondary);
            padding: 1.2rem 1.5rem;
            border-radius: var(--radius);
            margin: 1.5rem 0 2rem;
            display: none;
        }
        .file-info-row {
            display: flex;
            justify-content: space-between;
            padding: 0.4rem 0;
            border-bottom: 1px solid #cbd5e1;
        }
        .file-info-row:last-child { border-bottom: none; }
        .file-info-label { font-weight: 600; color: var(--dark-light); }
        .file-info-value { font-weight: 500; color: var(--primary-dark); }

        /* ----- controls ----- */
        .control-group { margin: 2rem 0 1.8rem; }
        .control-label {
            display: flex;
            align-items: center;
            gap: 0.7rem;
            font-weight: 600;
            margin-bottom: 1rem;
            color: var(--dark);
        }
        .slider-container {
            background: #f1f5f9;
            padding: 1.2rem 1.5rem;
            border-radius: var(--radius);
        }
        .slider-group {
            display: flex;
            align-items: center;
            gap: 1.2rem;
        }
        .slider-group input[type=range] {
            flex: 1;
            height: 8px;
            border-radius: 10px;
            background: linear-gradient(90deg, var(--primary-light), var(--secondary));
        }
        .slider-group input[type=range]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 24px; height: 24px;
            background: white;
            border: 3px solid var(--primary);
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        }
        .slider-value {
            min-width: 4rem;
            background: white;
            text-align: center;
            font-weight: 700;
            color: var(--primary);
            padding: 0.4rem 0.8rem;
            border-radius: 40px;
            border: 2px solid var(--gray-light);
        }
        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            background: white;
            padding: 1rem 1.2rem;
            border-radius: var(--radius);
            margin: 0.8rem 0;
            border: 1px solid var(--gray-light);
            transition: 0.1s;
        }
        .checkbox-group:hover { background: #f8fafc; }
        .checkbox-group input[type=checkbox] { width: 1.3rem; height: 1.3rem; accent-color: var(--primary); }

        .format-options {
            display: grid;
            grid-template-columns: repeat(3,1fr);
            gap: 1rem;
        }
        .format-option input { display: none; }
        .format-option label {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 1.5rem 0.5rem;
            background: white;
            border-radius: var(--radius);
            border: 2px solid var(--gray-light);
            cursor: pointer;
            transition: all 0.15s;
            text-align: center;
        }
        .format-option label:hover { border-color: var(--primary-light); transform: translateY(-2px); }
        .format-option input:checked + label {
            border-color: var(--primary);
            background: #eff6ff;
            box-shadow: 0 5px 12px rgba(37,99,235,0.2);
        }
        .format-option label i { font-size: 2.3rem; color: var(--primary); margin-bottom: 0.7rem; }
        .format-option label span { font-weight: 600; }
        .format-option label small { font-size: 0.75rem; color: var(--gray); }

        select {
            width: 100%;
            padding: 1rem 1.2rem;
            border: 2px solid var(--gray-light);
            border-radius: var(--radius);
            font-size: 1rem;
            background: white;
        }

        /* ----- summary panel ----- */
        .summary-container {
            background: #f8fafc;
            border-radius: var(--radius);
            border: 2px solid var(--gray-light);
            overflow: hidden;
            margin-bottom: 1.5rem;
        }
        .summary-header {
            background: linear-gradient(115deg, var(--primary), #4f46e5);
            color: white;
            padding: 1.5rem 2rem;
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 1rem;
        }
        .stats { display: flex; gap: 2rem; }
        .stat { text-align: center; }
        .stat-value { font-size: 2rem; font-weight: 800; line-height: 1.2; }
        .stat-label { font-size: 0.9rem; opacity: 0.9; }

        .summary-content {
            height: 380px;
            padding: 2rem;
            overflow-y: auto;
            background: white;
        }
        .summary-placeholder {
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: var(--gray);
        }
        .summary-placeholder i { font-size: 5rem; opacity: 0.3; margin-bottom: 1.5rem; }
        .summary-placeholder h3 { color: var(--dark); margin-bottom: 0.5rem; }

        .keyword-container {
            background: #f1f5f9;
            padding: 1.5rem;
            border-radius: var(--radius);
            margin: 1.5rem 0 1rem;
            display: none;
        }
        .keywords {
            display: flex;
            flex-wrap: wrap;
            gap: 0.7rem;
            margin-top: 1rem;
        }
        .keyword {
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            color: white;
            padding: 0.5rem 1.4rem;
            border-radius: 40px;
            font-size: 0.9rem;
            font-weight: 500;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            box-shadow: 0 3px 8px rgba(37,99,235,0.3);
        }

        .loading-container {
            text-align: center;
            padding: 2.5rem;
            display: none;
        }
        .spinner {
            width: 60px; height: 60px;
            border: 5px solid #e2e8f0;
            border-top: 5px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 1.5rem;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        .progress-container {
            width: 100%;
            background: #e2e8f0;
            height: 12px;
            border-radius: 20px;
            margin: 1.8rem 0;
            overflow: hidden;
            display: none;
        }
        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), var(--secondary));
            width: 0%;
            transition: width 0.2s;
        }

        .status-message {
            padding: 1rem 1.8rem;
            border-radius: 60px;
            margin: 1.5rem 0;
            font-weight: 500;
            display: none;
            text-align: center;
        }
        .status-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
        .status-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
        .status-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

        .action-buttons {
            display: flex;
            justify-content: center;
            gap: 1.5rem;
            margin: 2rem 0 1rem;
            flex-wrap: wrap;
        }
        .btn {
            border: none;
            background: transparent;
            padding: 1rem 2.5rem;
            font-weight: 600;
            font-size: 1.1rem;
            border-radius: 60px;
            display: inline-flex;
            align-items: center;
            gap: 0.8rem;
            cursor: pointer;
            transition: 0.15s;
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }
        .btn-primary {
            background: linear-gradient(145deg, var(--primary), var(--primary-dark));
            color: white;
        }
        .btn-primary:hover:not(:disabled) { transform: scale(1.02); box-shadow: 0 10px 20px rgba(37,99,235,0.35); }
        .btn-success {
            background: linear-gradient(145deg, var(--secondary), #059669);
            color: white;
        }
        .btn-success:hover:not(:disabled) { transform: scale(1.02); box-shadow: 0 10px 20px rgba(16,185,129,0.35); }
        .btn:disabled { opacity: 0.4; cursor: not-allowed; }

        .performance-info {
            background: #f1f5f9;
            border-radius: 60px;
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            margin-top: 2rem;
            font-weight: 500;
        }
        .timer { color: var(--primary); font-weight: 700; }

        footer {
            background: white;
            border-radius: var(--radius);
            padding: 2rem;
            text-align: center;
            color: var(--gray);
            box-shadow: 0 5px 20px rgba(0,0,0,0.02);
        }

        .fade-in { animation: fadeIn 0.3s ease; }
        @keyframes fadeIn { 0%{ opacity:0; transform:translateY(10px); } 100%{ opacity:1; transform:translateY(0); } }

        .summary-point {
            margin: 1rem 0 1rem 1.2rem;
            position: relative;
            padding-left: 1rem;
            border-left: 4px solid var(--primary-light);
        }
        .quote {
            background: #eef2ff;
            padding: 1.5rem 2rem;
            border-radius: 20px;
            margin: 1.5rem 0;
            font-style: italic;
            border-left: 6px solid var(--primary);
            position: relative;
        }
        .quote::before {
            content: "“";
            font-size: 4rem;
            color: var(--primary);
            opacity: 0.2;
            position: absolute;
            left: 10px; top: -10px;
        }

        /* Page navigation for PDF */
        .pdf-pages {
            background: #f1f5f9;
            border-radius: var(--radius);
            padding: 1rem;
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .page-info {
            font-weight: 600;
            color: var(--primary-dark);
        }