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

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #1a202c;
            overflow: hidden;
        }

        .app-container {
            display: grid;
            grid-template-columns: 320px 1fr 350px;
            grid-template-rows: 80px 1fr;
            height: 100vh;
            max-width: 1800px;
            margin: 0 auto;
            gap: 15px;
            padding: 15px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 25px 50px rgba(0,0,0,0.15);
            overflow: hidden;
        }

        .header {
            grid-column: 1 / -1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
            background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
            color: white;
            border-radius: 15px;
            box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
        }

        .header h1 {
            font-size: 2em;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .header .status-indicator {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #48bb78;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.7; transform: scale(1.1); }
        }

        .controls-panel {
            background: white;
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            overflow-y: auto;
            height: calc(100vh - 110px);
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .controls-panel::-webkit-scrollbar {
            width: 6px;
        }

        .controls-panel::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 3px;
        }

        .controls-panel::-webkit-scrollbar-thumb {
            background: #4299e1;
            border-radius: 3px;
        }

        .experiment-area {
            position: relative;
            overflow: hidden;
            border-radius: 15px;
            background: radial-gradient(circle at 50% 50%, #f8fafc 0%, #e2e8f0 100%);
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .info-btn {
            position: absolute;
            top: 15px;
            right: 15px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
            color: white;
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
            z-index: 10;
            box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .info-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(66, 153, 225, 0.5);
        }

        .info-btn:active {
            transform: scale(0.95);
        }

        .canvas-container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            position: relative;
        }

        .observations-panel {
            background: white;
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            overflow-y: auto;
            height: calc(100vh - 110px);
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .observations-panel::-webkit-scrollbar {
            width: 6px;
        }

        .observations-panel::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 3px;
        }

        .observations-panel::-webkit-scrollbar-thumb {
            background: #4299e1;
            border-radius: 3px;
        }

        .control-section {
            background: white;
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.08);
        }

        .control-section h3 {
            color: #2d3748;
            margin-bottom: 15px;
            font-size: 1.1em;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .control-section h3::before {
            content: '⚙️';
            font-size: 1.2em;
        }

        .control-group {
            margin-bottom: 20px;
            padding: 15px;
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border-radius: 10px;
            border: 1px solid #e2e8f0;
        }

        .control-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 0.875rem;
            font-weight: 500;
            color: #374151;
        }

        .control-group select {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            background: white;
            color: #374151;
            font-size: 0.9rem;
            transition: all 0.2s ease;
        }

        .control-group select:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .checkbox-group input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: #3b82f6;
        }

        .btn {
            width: 100%;
            padding: 12px 16px;
            border: none;
            border-radius: 8px;
            font-size: 0.875rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin-bottom: 8px;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .btn:active {
            transform: translateY(0);
        }

        .btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .btn-primary {
            background: linear-gradient(135deg, #3b82f6, #1e40af);
            color: white;
        }

        .btn-success {
            background: linear-gradient(135deg, #10b981, #059669);
            color: white;
        }

        .btn-warning {
            background: linear-gradient(135deg, #f59e0b, #d97706);
            color: white;
        }

        .btn-danger {
            background: linear-gradient(135deg, #ef4444, #dc2626);
            color: white;
        }

        #canvas {
            border: 2px solid #e2e8f0;
            border-radius: 10px;
            cursor: crosshair;
            transition: border-color 0.3s;
            background: white;
            position: relative;
        }

        #canvas:hover {
            border-color: #3b82f6;
        }

        .legend {
            position: absolute;
            top: 25px;
            right: 25px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(15px);
            padding: 20px;
            border-radius: 16px;
            border: 1px solid rgba(0, 0, 0, 0.1);
            font-size: 13px;
            color: #374151;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
            z-index: 10;
        }

        .legend h5 {
            color: #2d3748;
            margin-bottom: 10px;
            font-size: 0.9em;
            font-weight: 600;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
            font-size: 0.8em;
            color: #64748b;
        }

        .legend-color {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            border: 2px solid white;
            box-shadow: 0 0 0 1px #e2e8f0;
        }

        .status-section {
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border-radius: 12px;
            padding: 15px;
            border: 1px solid #e2e8f0;
        }

        .status-section h4 {
            color: #2d3748;
            margin-bottom: 12px;
            font-size: 1em;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .status-section h4::before {
            content: '📊';
            font-size: 1.1em;
        }

        .step-indicator {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
            padding: 10px;
            background: white;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
        }

        .step-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: #e2e8f0;
            transition: all 0.3s ease;
        }

        .step-dot.active {
            background: #3b82f6;
            transform: scale(1.3);
            box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
        }

        .step-text {
            font-size: 0.9em;
            font-weight: 500;
            color: #374151;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        .stat-card {
            background: white;
            border-radius: 12px;
            padding: 15px;
            text-align: center;
            border: 1px solid #e2e8f0;
            transition: all 0.3s ease;
        }

        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: 700;
            color: #3b82f6;
            margin-bottom: 5px;
        }

        .stat-label {
            font-size: 0.8rem;
            color: #64748b;
            font-weight: 500;
        }

        .speed-control {
            margin-bottom: 15px;
        }

        .speed-control label {
            display: block;
            margin-bottom: 8px;
            font-size: 0.875rem;
            font-weight: 500;
            color: #374151;
        }

        .speed-slider {
            width: 100%;
            height: 6px;
            border-radius: 3px;
            background: #e2e8f0;
            outline: none;
            appearance: none;
        }

        .speed-slider::-webkit-slider-thumb {
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #3b82f6;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
        }

        .logs {
            height: 200px;
            overflow-y: auto;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 0.8rem;
            line-height: 1.4;
            background: white;
            border-radius: 8px;
            padding: 15px;
            border: 1px solid #e2e8f0;
            box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
        }

        .log-entry {
            margin: 4px 0;
            padding: 6px 10px;
            border-radius: 6px;
            background: #f8fafc;
            border-left: 3px solid #94a3b8;
        }

        .log-entry.node {
            border-left-color: #3b82f6;
            background: #eff6ff;
            color: #2563eb;
        }

        .log-entry.success {
            border-left-color: #10b981;
            background: #f0fdf4;
            color: #059669;
        }

        .log-entry.algorithm {
            border-left-color: #f59e0b;
            background: #fffbeb;
            color: #d97706;
        }

        .log-entry.message {
            border-left-color: #8b5cf6;
            background: #f3f4f6;
            color: #6b7280;
        }

        .timestamp {
            font-weight: bold;
            opacity: 0.8;
        }

        .legend {
            background: white;
            border-radius: 8px;
            padding: 15px;
            border: 1px solid #e2e8f0;
        }

        .legend h5 {
            color: #2d3748;
            margin-bottom: 10px;
            font-size: 0.9em;
            font-weight: 600;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
            font-size: 0.8em;
            color: #64748b;
        }

        .legend-color {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            border: 2px solid white;
            box-shadow: 0 0 0 1px #e2e8f0;
        }

        .graph-info {
            background: white;
            border-radius: 8px;
            padding: 15px;
            border: 1px solid #e2e8f0;
            margin-bottom: 15px;
        }

        .graph-info h5 {
            color: #2d3748;
            margin-bottom: 10px;
            font-size: 0.9em;
            font-weight: 600;
        }

        .graph-info p {
            font-size: 0.8em;
            color: #64748b;
            margin-bottom: 5px;
        }

        .selected-points {
            background: white;
            border-radius: 8px;
            padding: 15px;
            border: 1px solid #e2e8f0;
            margin-top: 15px;
            display: none;
        }

        .selected-points h5 {
            color: #2d3748;
            margin-bottom: 10px;
            font-size: 0.9em;
            font-weight: 600;
        }

        .point-list {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .point-tag {
            background: #3b82f6;
            color: white;
            padding: 4px 8px;
            border-radius: 15px;
            font-size: 0.8em;
            font-weight: 500;
        }

        .complexity-info {
            background: white;
            border-radius: 8px;
            padding: 15px;
            border: 1px solid #e2e8f0;
            margin-bottom: 15px;
        }

        .complexity-info h5 {
            color: #2d3748;
            margin-bottom: 8px;
            font-size: 0.9em;
            font-weight: 600;
        }

        .complexity-info p {
            font-size: 0.8em;
            color: #64748b;
            margin-bottom: 3px;
        }

        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 15px 25px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            transform: translateX(100%);
            transition: transform 0.3s ease;
            z-index: 1000;
            max-width: 300px;
        }

        .notification.show {
            transform: translateX(0);
        }

        .notification.success {
            background: #10b981;
            color: white;
        }

        .notification.error {
            background: #ef4444;
            color: white;
        }

        .notification.warning {
            background: #f59e0b;
            color: white;
        }

        .notification.info {
            background: #3b82f6;
            color: white;
        }

        @media (max-width: 1200px) {
            .app-container {
                grid-template-columns: 1fr;
                grid-template-rows: 80px 1fr auto auto;
                height: 100vh;
                gap: 10px;
                padding: 10px;
            }
            
            .controls-panel {
                height: 300px;
                order: 2;
            }
            
            .experiment-area {
                order: 1;
                min-height: 400px;
            }
            
            .observations-panel {
                height: 250px;
                order: 3;
            }
        }
        
        @media (max-width: 768px) {
            .header h1 {
                font-size: 1.5em;
            }
            
            .control-group {
                padding: 12px;
            }
            
            .btn {
                padding: 8px 12px;
                font-size: 12px;
            }
        }
        
        /* Mobile Landscape Support - Desktop-like Experience */
        @media screen and (max-width: 968px) and (orientation: landscape) {
            .app-container {
                grid-template-columns: 280px 1fr 300px;
                grid-template-rows: 60px 1fr;
                gap: 10px;
                padding: 10px;
            }
            
            .header {
                padding: 0 15px;
            }
            
            .header h1 {
                font-size: 1.4em;
            }
            
            .controls-panel {
                padding: 15px;
                height: calc(100vh - 80px);
            }
            
            .observations-panel {
                padding: 15px;
                height: calc(100vh - 80px);
            }
            
            .control-section {
                padding: 15px;
                margin-bottom: 15px;
            }
            
            .control-section h3 {
                font-size: 1em;
                margin-bottom: 12px;
            }
            
            .control-group {
                padding: 12px;
                margin-bottom: 12px;
            }
            
            .control-group label {
                font-size: 0.8rem;
                margin-bottom: 6px;
            }
            
            .control-group select {
                padding: 10px 12px;
                font-size: 0.8rem;
            }
            
            .checkbox-group {
                gap: 8px;
            }
            
            .checkbox-group input[type="checkbox"] {
                width: 16px;
                height: 16px;
            }
            
            .btn {
                padding: 10px 14px;
                font-size: 0.8rem;
                margin-bottom: 6px;
            }
            
            .speed-slider {
                height: 6px;
            }
            
            .speed-slider::-webkit-slider-thumb {
                width: 18px;
                height: 18px;
            }
            
            /* Canvas optimization for mobile landscape */
            #canvas {
                max-width: 100%;
                max-height: calc(100vh - 80px);
                width: auto;
                height: auto;
            }
            
            .experiment-area {
                padding: 10px;
                min-height: calc(100vh - 80px);
            }
            
            .selected-points {
                padding: 12px;
                margin-bottom: 12px;
            }
            
            .selected-points h5 {
                font-size: 0.9em;
                margin-bottom: 8px;
            }
            
            .point-tag {
                padding: 4px 8px;
                font-size: 0.75rem;
                margin: 2px;
            }
            
            .status-section {
                padding: 12px;
                margin-bottom: 12px;
            }
            
            .status-section h4 {
                font-size: 0.9em;
                margin-bottom: 10px;
            }
            
            .step-indicator {
                padding: 8px;
                margin-bottom: 12px;
            }
            
            .step-text {
                font-size: 0.8em;
            }
            
            .stats-grid {
                grid-template-columns: 1fr 1fr;
                gap: 10px;
                margin-bottom: 12px;
            }
            
            .stat-card {
                padding: 12px;
            }
            
            .stat-value {
                font-size: 1.2rem;
                margin-bottom: 4px;
            }
            
            .stat-label {
                font-size: 0.75rem;
            }
            
            .logs {
                height: 180px;
                font-size: 0.75rem;
                padding: 12px;
            }
            
            .log-entry {
                padding: 4px 8px;
                margin: 2px 0;
                font-size: 0.75rem;
            }
            
            .timestamp {
                font-size: 0.7rem;
            }
            
            .graph-info {
                padding: 12px;
            }
            
            .graph-info h5 {
                font-size: 0.9em;
                margin-bottom: 8px;
            }
            
            .graph-info p {
                font-size: 0.8rem;
                margin-bottom: 4px;
            }
            
            /* MPI Code Download section optimization */
            .status-section div[style*="background: linear-gradient(135deg, #f0f9ff, #e0f2fe)"] {
                padding: 15px !important;
            }
            
            .status-section div[style*="background: linear-gradient(135deg, #f0f9ff, #e0f2fe)"] div[style*="font-size: 0.9rem"] {
                font-size: 0.8rem !important;
                margin-bottom: 12px !important;
            }
            
            .status-section div[style*="display: flex"] button {
                padding: 10px !important;
                font-size: 0.8rem !important;
            }
            
            .status-section div[style*="font-size: 0.8rem"] {
                font-size: 0.75rem !important;
                padding: 10px !important;
            }
            
            .notification {
                font-size: 0.8rem;
                padding: 12px 16px;
            }
        }
        
        /* Tablet Landscape - Slightly different layout */
        @media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
            .app-container {
                grid-template-columns: 300px 1fr 320px;
                grid-template-rows: 70px 1fr;
                gap: 12px;
                padding: 12px;
            }
            
            .header h1 {
                font-size: 1.6em;
            }
            
            .controls-panel,
            .observations-panel {
                height: calc(100vh - 90px);
            }
            
            #canvas {
                max-width: 100%;
                max-height: calc(100vh - 90px);
            }
            
            .logs {
                height: 200px;
            }
        }
        
        /* Mobile Portrait Orientation Overlay */
        .rotate-device-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            z-index: 10000;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: white;
            text-align: center;
            padding: 20px;
        }

        .rotate-device-overlay .rotate-icon {
            font-size: 4rem;
            margin-bottom: 20px;
            animation: rotateAnimation 2s ease-in-out infinite;
        }

        .rotate-device-overlay h2 {
            font-size: 1.5rem;
            font-weight: 700;
            margin-bottom: 15px;
        }

        .rotate-device-overlay p {
            font-size: 1rem;
            opacity: 0.9;
            line-height: 1.5;
            max-width: 300px;
        }

        @keyframes rotateAnimation {
            0%, 100% { transform: rotate(0deg); }
            25% { transform: rotate(-15deg); }
            75% { transform: rotate(15deg); }
        }

        @media screen and (max-width: 768px) and (orientation: portrait) {
            .rotate-device-overlay {
                display: flex !important;
            }
            
            .app-container {
                display: none !important;
            }
        }

        /* Info Modal Styles */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 1000;
            justify-content: center;
            align-items: center;
            padding: 20px;
            box-sizing: border-box;
        }

        .modal-content {
            background: white;
            border-radius: 20px;
            width: 100%;
            max-width: 900px;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
            animation: modalSlideIn 0.3s ease-out;
        }

        @keyframes modalSlideIn {
            from {
                opacity: 0;
                transform: translateY(-50px) scale(0.9);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .modal-header {
            padding: 25px 30px 15px;
            border-bottom: 2px solid #e2e8f0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
            color: white;
            border-radius: 20px 20px 0 0;
        }

        .modal-header h2 {
            margin: 0;
            font-size: 1.8em;
            font-weight: 700;
        }

        .modal-close {
            background: none;
            border: none;
            font-size: 2em;
            color: white;
            cursor: pointer;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .modal-close:hover {
            background: rgba(255, 255, 255, 0.1);
            transform: scale(1.1);
        }

        .modal-body {
            padding: 30px;
            color: #2d3748;
            line-height: 1.6;
            font-size: 14px;
        }

        .guide-section {
            margin-bottom: 25px;
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border-radius: 12px;
            padding: 20px;
            border-left: 4px solid #4299e1;
        }

        .guide-section h3 {
            color: #2d3748;
            margin: 0 0 15px 0;
            font-size: 1.2em;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .guide-section p {
            margin: 0 0 12px 0;
            color: #4a5568;
        }

        .guide-section ul, .guide-section ol {
            margin: 12px 0;
            padding-left: 20px;
        }

        .guide-section li {
            margin: 8px 0;
            color: #4a5568;
        }

        .formula-box {
            background: #2d3748;
            color: white;
            padding: 15px;
            border-radius: 8px;
            font-family: 'JetBrains Mono', 'Fira Code', monospace;
            margin: 15px 0;
            text-align: center;
            font-size: 13px;
            line-height: 1.8;
        }

        .modal-content::-webkit-scrollbar {
            width: 8px;
        }

        .modal-content::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 4px;
        }

        .modal-content::-webkit-scrollbar-thumb {
            background: #4299e1;
            border-radius: 4px;
        }

        .modal-content::-webkit-scrollbar-thumb:hover {
            background: #3182ce;
        }

        @media (max-width: 768px) {
            .modal-content {
                margin: 10px;
                max-height: 95vh;
            }
            
            .modal-header {
                padding: 20px 20px 10px;
            }
            
            .modal-header h2 {
                font-size: 1.4em;
            }
            
            .modal-body {
                padding: 20px;
                font-size: 13px;
            }
            
            .guide-section {
                padding: 15px;
                margin-bottom: 20px;
            }
            
            .guide-section h3 {
                font-size: 1.1em;
            }
        }