  * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary-bg: #0a0a0a;
            --secondary-bg: #1a1a1a;
            --accent-bg: rgba(255, 255, 255, 0.05);
            --glass-bg: rgba(255, 255, 255, 0.02);
            --text-primary: #ffffff;
            --text-secondary: #e0e0e0;
            --text-muted: #a0a0a0;
            --accent-blue: #3b82f6;
            --accent-green: #22c55e;
            --accent-yellow: #eab308;
            --accent-red: #ef4444;
            --border-subtle: rgba(255, 255, 255, 0.1);
            --shadow-glow: 0 8px 32px rgba(59, 130, 246, 0.15);
            --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
            color: var(--text-secondary);
            min-height: 100vh;
            line-height: 1.6;
            overflow-x: hidden;
        }

        .background-pattern {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0.03;
            background-image: radial-gradient(circle at 25% 25%, #3b82f6 0%, transparent 50%),
                              radial-gradient(circle at 75% 75%, #22c55e 0%, transparent 50%);
            pointer-events: none;
            z-index: -1;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }

        .header {
            text-align: center;
            margin-bottom: 40px;
            padding: 60px 40px;
            background: var(--glass-bg);
            border-radius: 24px;
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-subtle);
            position: relative;
            overflow: hidden;
        }

        .header::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
            animation: shimmer 3s infinite;
        }

        @keyframes shimmer {
            0% { left: -100%; }
            100% { left: 100%; }
        }

        .header h1 {
            font-size: clamp(2rem, 4vw, 3rem);
            font-weight: 800;
            background: linear-gradient(135deg, var(--text-primary), var(--text-muted));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 16px;
            letter-spacing: -0.02em;
        }

        .header p {
            font-size: 1.2rem;
            color: var(--text-muted);
            max-width: 900px;
            margin: 0 auto;
            line-height: 1.7;
        }

        .main-grid {
            display: grid;
            grid-template-columns: 420px 1fr;
            gap: 32px;
            margin-bottom: 40px;
            align-items: start;
        }

        .control-panel {
            background: var(--accent-bg);
            border-radius: 20px;
            padding: 32px;
            border: 1px solid var(--border-subtle);
            backdrop-filter: blur(20px);
            transition: var(--transition);
            position: sticky;
            top: 20px;
        }

        .control-panel:hover {
            background: rgba(255, 255, 255, 0.08);
            box-shadow: var(--shadow-glow);
        }

        .control-panel h2 {
            font-size: 1.6rem;
            margin-bottom: 28px;
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 12px;
            font-weight: 700;
        }

        .form-group {
            margin-bottom: 28px;
            position: relative;
            animation: fadeInUp 0.6s ease-out;
            animation-fill-mode: both;
        }

        .form-group:nth-child(1) { animation-delay: 0.1s; }
        .form-group:nth-child(2) { animation-delay: 0.2s; }
        .form-group:nth-child(3) { animation-delay: 0.3s; }
        .form-group:nth-child(4) { animation-delay: 0.4s; }
        .form-group:nth-child(5) { animation-delay: 0.5s; }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .form-label {
            display: block;
            font-weight: 600;
            margin-bottom: 10px;
            color: var(--text-secondary);
            font-size: 0.95rem;
            letter-spacing: 0.01em;
        }

        .form-input, .form-select {
            width: 100%;
            padding: 14px 18px;
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid var(--border-subtle);
            border-radius: 12px;
            color: var(--text-primary);
            font-size: 1rem;
            transition: var(--transition);
            outline: none;
            font-family: inherit;
        }

        .form-input:focus, .form-select:focus {
            border-color: var(--accent-blue);
            background: rgba(0, 0, 0, 0.6);
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
        }

        .form-input::placeholder {
            color: #666;
        }

        .form-select option {
            background: var(--secondary-bg);
            color: var(--text-primary);
            padding: 10px;
        }

        .file-upload {
            position: relative;
            margin-bottom: 28px;
        }

        .file-upload input[type="file"] {
            position: absolute;
            opacity: 0;
            width: 100%;
            height: 100%;
            cursor: pointer;
        }

        .file-upload-label {
            display: block;
            padding: 24px;
            background: rgba(0, 0, 0, 0.3);
            border: 2px dashed var(--border-subtle);
            border-radius: 16px;
            text-align: center;
            cursor: pointer;
            transition: var(--transition);
            color: var(--text-muted);
            font-size: 1rem;
            font-weight: 500;
        }

        .file-upload-label:hover {
            background: rgba(59, 130, 246, 0.1);
            border-color: var(--accent-blue);
            color: var(--accent-blue);
            transform: translateY(-3px);
        }

        .file-upload-label small {
            color: #888;
            font-size: 0.85rem;
            display: block;
            margin-top: 8px;
        }

        .uploaded-files {
            margin-top: 12px;
            max-height: 140px;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: var(--accent-blue) transparent;
        }

        .uploaded-files::-webkit-scrollbar {
            width: 6px;
        }

        .uploaded-files::-webkit-scrollbar-track {
            background: transparent;
        }

        .uploaded-files::-webkit-scrollbar-thumb {
            background: var(--accent-blue);
            border-radius: 3px;
        }

        .uploaded-file {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 14px;
            background: rgba(34, 197, 94, 0.1);
            border: 1px solid rgba(34, 197, 94, 0.3);
            border-radius: 8px;
            margin-bottom: 6px;
            font-size: 0.9rem;
            color: var(--accent-green);
            animation: slideIn 0.3s ease-out;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateX(-20px);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .remove-file {
            background: none;
            border: none;
            color: var(--accent-red);
            cursor: pointer;
            font-size: 1.3rem;
            padding: 0;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: var(--transition);
        }

        .remove-file:hover {
            background: rgba(239, 68, 68, 0.2);
            transform: scale(1.1);
        }

        .slider-container {
            margin-bottom: 32px;
        }

        .slider-label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 18px;
            font-weight: 600;
        }

        .complexity-value {
            font-size: 1.3rem;
            color: var(--accent-green);
            font-weight: 700;
        }

        .complexity-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 6px 12px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 20px;
            font-size: 0.85rem;
            margin-left: 12px;
            transition: var(--transition);
        }

        .complexity-indicator {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: currentColor;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        .slider {
            width: 100%;
            height: 10px;
            border-radius: 6px;
            background: linear-gradient(to right, var(--accent-green) 0%, var(--accent-yellow) 50%, var(--accent-red) 100%);
            outline: none;
            opacity: 0.9;
            transition: opacity 0.3s;
            -webkit-appearance: none;
            appearance: none;
        }

        .slider:hover {
            opacity: 1;
        }

        .slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 26px;
            height: 26px;
            border-radius: 50%;
            background: var(--text-primary);
            cursor: pointer;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
            transition: var(--transition);
        }

        .slider::-webkit-slider-thumb:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
        }

        .slider::-moz-range-thumb {
            width: 26px;
            height: 26px;
            border-radius: 50%;
            background: var(--text-primary);
            cursor: pointer;
            border: none;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
        }
        .chart-section {
    display: flex;
    flex-direction: row;
    gap: 24px;
    align-items: flex-start;
}

.chart-container {
    flex: 2;
}

.metadata-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
        .generate-btn {
            width: 100%;
            padding: 16px;
            background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
            color: white;
            border: none;
            border-radius: 14px;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            margin-bottom: 24px;
            position: relative;
            overflow: hidden;
        }

        .generate-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: var(--transition);
        }

        .generate-btn:hover::before {
            left: 100%;
        }

        .generate-btn:hover {
            background: linear-gradient(135deg, #2563eb, #1e40af);
            transform: translateY(-3px);
            box-shadow: 0 12px 30px rgba(59, 130, 246, 0.4);
        }

        .generate-btn:disabled {
            background: #4a5568;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .generate-btn:disabled::before {
            display: none;
        }

        .generate-btn.loading {
            position: relative;
            color: transparent;
        }

        .generate-btn.loading::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 20px;
            height: 20px;
            margin: -10px 0 0 -10px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-left: 3px solid white;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        .percolation-indicator {
            padding: 18px;
            border-radius: 14px;
            margin-bottom: 24px;
            border-left: 4px solid;
            transition: var(--transition);
            font-weight: 500;
        }

        .percolation-indicator.safe {
            background: rgba(34, 197, 94, 0.1);
            border-color: var(--accent-green);
            color: var(--accent-green);
        }

        .percolation-indicator.warning {
            background: rgba(234, 179, 8, 0.1);
            border-color: var(--accent-yellow);
            color: var(--accent-yellow);
        }

        .percolation-indicator.danger {
            background: rgba(239, 68, 68, 0.1);
            border-color: var(--accent-red);
            color: var(--accent-red);
        }

        .chart-container {
            background: var(--accent-bg);
            border-radius: 20px;
            padding: 32px;
            border: 1px solid var(--border-subtle);
            backdrop-filter: blur(20px);
            transition: var(--transition);
        }

        .chart-container:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .chart-container h2 {
            font-size: 1.6rem;
            margin-bottom: 28px;
            color: var(--text-primary);
            text-align: center;
            font-weight: 700;
        }

        .chart-wrapper {
            position: relative;
            height: 420px;
        }

        .hypothesis-display {
            grid-column: 1 / -1;
            background: var(--accent-bg);
            border-radius: 20px;
            padding: 32px;
            border: 1px solid var(--border-subtle);
            backdrop-filter: blur(20px);
        }

        .hypothesis-display h2 {
            font-size: 1.6rem;
            margin-bottom: 28px;
            color: var(--text-primary);
            font-weight: 700;
        }

        .hypothesis-content {
            min-height: 240px;
            background: rgba(0, 0, 0, 0.4);
            border-radius: 16px;
            padding: 24px;
            border: 1px solid var(--border-subtle);
            margin-bottom: 24px;
            position: relative;
        }

        .hypothesis-text {
            font-size: 1.1rem;
            line-height: 1.8;
            margin-bottom: 16px;
        }

        .hypothesis-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

        .hypothesis-metadata {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 18px;
            margin-bottom: 24px;
        }

        .metadata-item {
            background: rgba(255, 255, 255, 0.05);
            padding: 18px;
            border-radius: 12px;
            border: 1px solid var(--border-subtle);
            transition: var(--transition);
        }

        .metadata-item:hover {
            background: rgba(255, 255, 255, 0.08);
            transform: translateY(-2px);
        }

        .metadata-label {
            font-size: 0.9rem;
            color: var(--text-muted);
            margin-bottom: 6px;
            font-weight: 500;
        }

        .metadata-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-left: auto;
    max-width: 300px;
    padding-left: 2rem;
}

        .metadata-value {
            font-size: 1.2rem;
            font-weight: 600;
        }

        .citations {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 16px;
            padding: 24px;
            border: 1px solid var(--border-subtle);
        }

        .citations h3 {
            margin-bottom: 18px;
            color: var(--text-primary);
            font-weight: 600;
        }

        .citations-list {
            max-height: 220px;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: var(--accent-blue) transparent;
        }

        .citations-list::-webkit-scrollbar {
            width: 6px;
        }

        .citations-list::-webkit-scrollbar-track {
            background: transparent;
        }

        .citations-list::-webkit-scrollbar-thumb {
            background: var(--accent-blue);
            border-radius: 3px;
        }

        .citation-item {
            padding: 12px;
            margin-bottom: 10px;
            background: rgba(255, 255, 255, 0.03);
            border-radius: 10px;
            border-left: 3px solid var(--accent-blue);
            font-size: 0.9rem;
            transition: var(--transition);
        }

        .citation-item:hover {
            background: rgba(255, 255, 255, 0.06);
            transform: translateX(5px);
        }

        .loading {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 240px;
        }

        .spinner {
            width: 48px;
            height: 48px;
            border: 4px solid rgba(255, 255, 255, 0.1);
            border-left: 4px solid var(--accent-blue);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .status-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
            margin-top: 20px;
            font-size: 0.9rem;
            font-weight: 500;
        }

        .upload-progress {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 3px;
            background: linear-gradient(90deg, var(--accent-blue), #1d4ed8);
            border-radius: 0 0 16px 16px;
            transform: scaleX(0);
            transform-origin: left;
            transition: var(--transition);
        }

        .file-upload.uploading .upload-progress {
            transform: scaleX(1);
        }

       
        @media (max-width: 1200px) {
            .main-grid {
                grid-template-columns: 380px 1fr;
                gap: 24px;
            }
        }
@media (max-width: 1024px) {
    .chart-section {
        flex-direction: column;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .control-panel {
        position: static;
    }
}

        @media (max-width: 768px) {
            .container {
                padding: 16px;
            }
            
            .header {
                padding: 40px 24px;
                border-radius: 16px;
            }
            
            .header h1 {
                font-size: 2rem;
            }
            
            .header p {
                font-size: 1rem;
            }

            .control-panel, .chart-container, .hypothesis-display {
                padding: 24px;
                border-radius: 16px;
            }
            
            .hypothesis-metadata {
                grid-template-columns: 1fr;
            }
            
            .main-grid {
                gap: 20px;
            }
        }
#densityChart {
    width: 100%;
    height: 400px;
   
}
        @media (max-width: 480px) {
            .container {
                padding: 12px;
            }
            
            .header {
                padding: 32px 20px;
            }
            
            .control-panel, .chart-container, .hypothesis-display {
                padding: 20px;
            }
            
            .chart-wrapper {
                height: 300px;
            }
        }