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

        :root {
            --primary-color: #4299e1;
            --primary-dark: #3182ce;
            --success-color: #10b981;
            --warning-color: #f59e0b;
            --danger-color: #ef4444;
            --text-color: #1a202c;
            --text-muted: #64748b;
            --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --card-shadow: 0 10px 30px rgba(0,0,0,0.1);
            --header-height: 60px;
            --mobile-nav-height: 50px;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg-gradient);
            min-height: 100vh;
            color: var(--text-color);
            overflow-x: hidden;
        }

        /* Mobile-first base layout */
        .app-container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            max-width: 1800px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
        }

        .header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 15px;
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
            color: white;
            position: sticky;
            top: 0;
            z-index: 100;
            min-height: var(--header-height);
        }

        .header h1 {
            font-size: 1rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        .header .subtitle {
            font-size: 0.75rem;
            opacity: 0.9;
            display: none;
        }

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

        /* Mobile navigation toggle */
        .mobile-nav-toggle {
            display: flex;
            background: rgba(255,255,255,0.2);
            border: none;
            color: white;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.85rem;
            align-items: center;
            gap: 6px;
            transition: background 0.3s;
        }

        .mobile-nav-toggle:hover {
            background: rgba(255,255,255,0.3);
        }

        .mobile-nav-toggle .hamburger {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }

        .mobile-nav-toggle .hamburger span {
            display: block;
            width: 18px;
            height: 2px;
            background: white;
            border-radius: 1px;
            transition: all 0.3s;
        }

        .mobile-nav-toggle.active .hamburger span:nth-child(1) {
            transform: rotate(45deg) translate(4px, 4px);
        }

        .mobile-nav-toggle.active .hamburger span:nth-child(2) {
            opacity: 0;
        }

        .mobile-nav-toggle.active .hamburger span:nth-child(3) {
            transform: rotate(-45deg) translate(4px, -4px);
        }

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

        /* Mobile panel overlay */
        .panel-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 90;
        }

        .panel-overlay.active {
            display: block;
        }

        .controls-panel {
            background: white;
            padding: 15px;
            display: none;
            flex-direction: column;
            gap: 15px;
            position: fixed;
            top: var(--header-height);
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 95;
            overflow-y: auto;
            transform: translateX(-100%);
            transition: transform 0.3s ease;
        }

        .controls-panel.active {
            display: flex;
            transform: translateX(0);
        }

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

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

        .controls-panel::-webkit-scrollbar-thumb {
            background: var(--primary-color);
            border-radius: 3px;
        }

        .experiment-area {
            position: relative;
            overflow: hidden;
            background: radial-gradient(circle at 50% 50%, #f8fafc 0%, #e2e8f0 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
            flex: 1;
            min-height: 300px;
        }

        .info-btn {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: none;
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
            color: white;
            font-size: 16px;
            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: 10px;
            position: relative;
        }

        .observations-panel {
            background: white;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            max-height: 40vh;
            overflow-y: auto;
        }

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

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

        .observations-panel::-webkit-scrollbar-thumb {
            background: var(--primary-color);
            border-radius: 3px;
        }

        /* Collapsible sections for mobile */
        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            padding: 5px 0;
        }

        .section-header .toggle-icon {
            transition: transform 0.3s;
            font-size: 0.8rem;
        }

        .section-header.collapsed .toggle-icon {
            transform: rotate(-90deg);
        }

        .section-content {
            overflow: hidden;
            transition: max-height 0.3s ease;
        }

        .section-content.collapsed {
            max-height: 0 !important;
            padding: 0;
            margin: 0;
        }

        .control-section {
            background: white;
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 3px 15px rgba(0,0,0,0.06);
            border: 1px solid #e2e8f0;
        }

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

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

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

        .control-group:last-child {
            margin-bottom: 0;
        }

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

        .control-group select {
            width: 100%;
            padding: 10px 12px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            background: white;
            color: #374151;
            font-size: 0.85rem;
            transition: all 0.2s ease;
            -webkit-appearance: none;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
        }

        .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;
            cursor: pointer;
        }

        .checkbox-group label {
            margin-bottom: 0;
            cursor: pointer;
        }

        .btn {
            width: 100%;
            padding: 10px 14px;
            border: none;
            border-radius: 8px;
            font-size: 0.8rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            margin-bottom: 6px;
            touch-action: manipulation;
        }

        .btn:last-child {
            margin-bottom: 0;
        }

        .btn:hover {
            transform: translateY(-1px);
            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;
            max-width: 100%;
            max-height: 100%;
            touch-action: none;
        }

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

        .legend {
            background: white;
            border-radius: 8px;
            padding: 12px;
            border: 1px solid #e2e8f0;
            font-size: 0.8rem;
        }

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

        .legend-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
            font-size: 0.75em;
            color: var(--text-muted);
        }

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

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

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

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

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

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

        .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.8em;
            font-weight: 500;
            color: #374151;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin-bottom: 12px;
        }

        .stat-card {
            background: white;
            border-radius: 10px;
            padding: 10px 8px;
            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.2rem;
            font-weight: 700;
            color: #3b82f6;
            margin-bottom: 3px;
        }

        .stat-label {
            font-size: 0.65rem;
            color: var(--text-muted);
            font-weight: 500;
        }

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

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

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

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

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

        .log-entry {
            margin: 3px 0;
            padding: 5px 8px;
            border-radius: 5px;
            background: #f8fafc;
            border-left: 3px solid #94a3b8;
            word-break: break-word;
        }

        .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;
            font-size: 0.65rem;
        }

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

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

        .graph-info p {
            font-size: 0.75em;
            color: var(--text-muted);
            margin-bottom: 4px;
        }

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

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

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

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

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

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

        .complexity-info p {
            font-size: 0.75em;
            color: var(--text-muted);
            margin-bottom: 3px;
        }

        .notification {
            position: fixed;
            top: 70px;
            right: 10px;
            left: 10px;
            padding: 12px 15px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            transform: translateY(-100%);
            opacity: 0;
            transition: all 0.3s ease;
            z-index: 1000;
            font-size: 0.85rem;
        }

        .notification.show {
            transform: translateY(0);
            opacity: 1;
        }

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

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

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

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

        /* MPI Download section mobile styles */
        .mpi-download-section {
            background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
            border: 2px solid #0ea5e9;
            border-radius: 10px;
            padding: 15px;
            text-align: center;
        }

        .mpi-download-section .mpi-description {
            font-size: 0.8rem;
            color: #475569;
            margin-bottom: 12px;
            line-height: 1.4;
        }

        .mpi-download-section .mpi-buttons {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 12px;
        }

        .mpi-download-section .mpi-btn {
            flex: 1;
            background: linear-gradient(135deg, #3b82f6, #1e40af);
            color: white;
            border: none;
            border-radius: 8px;
            padding: 10px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .mpi-download-section .mpi-btn.secondary {
            background: linear-gradient(135deg, #10b981, #059669);
        }

        .mpi-download-section .mpi-instructions {
            font-size: 0.7rem;
            color: #64748b;
            text-align: left;
            background: white;
            padding: 10px;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
        }

        .mpi-download-section .mpi-instructions code {
            background: #f1f5f9;
            padding: 1px 4px;
            border-radius: 3px;
            font-size: 0.65rem;
        }

        /* ===============================================
           RESPONSIVE BREAKPOINTS - Mobile First Design
           =============================================== */

        /* Small Mobile Devices (320px - 480px) */
        @media (min-width: 320px) {
            .header h1 {
                font-size: 0.9rem;
            }
            
            .stats-grid {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        /* Large Mobile / Small Tablets (481px - 767px) */
        @media (min-width: 481px) {
            .header {
                padding: 12px 20px;
            }
            
            .header h1 {
                font-size: 1.1rem;
            }
            
            .header .subtitle {
                display: block;
            }
            
            .notification {
                left: auto;
                right: 15px;
                max-width: 350px;
            }
            
            .experiment-area {
                min-height: 350px;
            }
            
            .mpi-download-section .mpi-buttons {
                flex-direction: row;
            }
        }

        /* Tablets Portrait (768px - 1023px) */
        @media (min-width: 768px) {
            :root {
                --header-height: 70px;
            }
            
            body {
                padding: 10px;
            }
            
            .app-container {
                display: grid;
                grid-template-columns: 1fr 1fr;
                grid-template-rows: auto auto 1fr;
                gap: 12px;
                padding: 12px;
                border-radius: 15px;
                box-shadow: 0 25px 50px rgba(0,0,0,0.15);
                height: calc(100vh - 20px);
                overflow: hidden;
            }
            
            .header {
                grid-column: 1 / -1;
                border-radius: 12px;
                padding: 15px 20px;
            }
            
            .header h1 {
                font-size: 1.4rem;
            }
            
            .mobile-nav-toggle {
                display: none;
            }
            
            .controls-panel {
                display: flex;
                position: static;
                transform: none;
                height: auto;
                max-height: none;
                overflow-y: auto;
                border-radius: 12px;
                box-shadow: var(--card-shadow);
            }
            
            .experiment-area {
                grid-column: 1 / -1;
                min-height: 400px;
                border-radius: 12px;
                box-shadow: var(--card-shadow);
            }
            
            .observations-panel {
                grid-column: 1 / -1;
                flex-direction: row;
                flex-wrap: wrap;
                max-height: 200px;
                border-radius: 12px;
                box-shadow: var(--card-shadow);
            }
            
            .observations-panel .status-section {
                flex: 1;
                min-width: 200px;
            }
            
            .observations-panel .graph-info {
                flex: 0 0 180px;
            }
            
            .logs {
                height: 120px;
            }
            
            .stat-value {
                font-size: 1.3rem;
            }
            
            .stat-label {
                font-size: 0.7rem;
            }
        }

        /* Tablets Landscape / Small Desktops (1024px - 1279px) */
        @media (min-width: 1024px) {
            :root {
                --header-height: 80px;
            }
            
            body {
                padding: 15px;
            }
            
            .app-container {
                grid-template-columns: 280px 1fr 300px;
                grid-template-rows: auto 1fr;
                gap: 15px;
                padding: 15px;
                height: calc(100vh - 30px);
            }
            
            .header {
                grid-column: 1 / -1;
                padding: 0 25px;
                min-height: 70px;
            }
            
            .header h1 {
                font-size: 1.6rem;
            }
            
            .controls-panel {
                height: calc(100vh - 130px);
                padding: 18px;
                gap: 18px;
            }
            
            .experiment-area {
                grid-column: 2;
                padding: 15px;
            }
            
            .observations-panel {
                grid-column: 3;
                flex-direction: column;
                flex-wrap: nowrap;
                max-height: calc(100vh - 130px);
                padding: 18px;
            }
            
            .control-section {
                padding: 18px;
            }
            
            .control-section h3 {
                font-size: 1em;
            }
            
            .control-group {
                padding: 14px;
                margin-bottom: 14px;
            }
            
            .btn {
                padding: 11px 15px;
                font-size: 0.85rem;
            }
            
            .logs {
                height: 180px;
            }
            
            .stat-value {
                font-size: 1.4rem;
            }
            
            .notification {
                top: 90px;
            }
        }

        /* Large Desktops (1280px+) */
        @media (min-width: 1280px) {
            .app-container {
                grid-template-columns: 320px 1fr 350px;
                gap: 18px;
                padding: 18px;
            }
            
            .header {
                min-height: 80px;
            }
            
            .header h1 {
                font-size: 1.8rem;
            }
            
            .controls-panel {
                padding: 20px;
                gap: 20px;
            }
            
            .control-section {
                padding: 20px;
            }
            
            .control-group {
                padding: 15px;
                margin-bottom: 16px;
            }
            
            .control-group label {
                font-size: 0.85rem;
            }
            
            .control-group select {
                padding: 12px 14px;
                font-size: 0.9rem;
            }
            
            .btn {
                padding: 12px 16px;
                font-size: 0.875rem;
                margin-bottom: 8px;
            }
            
            .logs {
                height: 200px;
                font-size: 0.8rem;
            }
            
            .stat-value {
                font-size: 1.5rem;
            }
            
            .stat-label {
                font-size: 0.75rem;
            }
        }

        /* Extra Large Screens (1600px+) */
        @media (min-width: 1600px) {
            .app-container {
                grid-template-columns: 350px 1fr 380px;
            }
            
            .header h1 {
                font-size: 2rem;
            }
        }

        /* Mobile Landscape Mode */
        @media screen and (max-width: 900px) and (orientation: landscape) {
            :root {
                --header-height: 50px;
            }
            
            .app-container {
                display: grid;
                grid-template-columns: 240px 1fr 220px;
                grid-template-rows: auto 1fr;
                gap: 8px;
                padding: 8px;
                height: 100vh;
                overflow: hidden;
            }
            
            .header {
                grid-column: 1 / -1;
                padding: 8px 15px;
                min-height: var(--header-height);
            }
            
            .header h1 {
                font-size: 1rem;
            }
            
            .header .subtitle {
                display: none;
            }
            
            .mobile-nav-toggle {
                display: none;
            }
            
            .controls-panel {
                display: flex;
                position: static;
                transform: none;
                height: calc(100vh - var(--header-height) - 20px);
                padding: 10px;
                gap: 10px;
                border-radius: 10px;
                overflow-y: auto;
            }
            
            .experiment-area {
                padding: 8px;
                min-height: auto;
                border-radius: 10px;
            }
            
            .observations-panel {
                height: calc(100vh - var(--header-height) - 20px);
                max-height: none;
                padding: 10px;
                gap: 8px;
                border-radius: 10px;
            }
            
            .control-section {
                padding: 10px;
            }
            
            .control-section h3 {
                font-size: 0.85em;
                margin-bottom: 8px;
            }
            
            .control-group {
                padding: 8px;
                margin-bottom: 8px;
            }
            
            .control-group label {
                font-size: 0.7rem;
                margin-bottom: 4px;
            }
            
            .control-group select {
                padding: 6px 8px;
                font-size: 0.75rem;
            }
            
            .btn {
                padding: 7px 10px;
                font-size: 0.7rem;
                margin-bottom: 4px;
            }
            
            .status-section {
                padding: 8px;
            }
            
            .status-section h4 {
                font-size: 0.8em;
                margin-bottom: 6px;
            }
            
            .stats-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 5px;
                margin-bottom: 8px;
            }
            
            .stat-card {
                padding: 6px 4px;
            }
            
            .stat-value {
                font-size: 0.95rem;
            }
            
            .stat-label {
                font-size: 0.55rem;
            }
            
            .logs {
                height: 100px;
                padding: 8px;
                font-size: 0.65rem;
            }
            
            .log-entry {
                padding: 3px 6px;
                margin: 2px 0;
            }
            
            .graph-info {
                padding: 8px;
            }
            
            .graph-info h5 {
                font-size: 0.8em;
                margin-bottom: 5px;
            }
            
            .graph-info p {
                font-size: 0.7em;
                margin-bottom: 2px;
            }
            
            .mpi-download-section {
                padding: 10px;
            }
            
            .mpi-download-section .mpi-description {
                font-size: 0.7rem;
                margin-bottom: 8px;
            }
            
            .mpi-download-section .mpi-btn {
                padding: 6px;
                font-size: 0.7rem;
            }
            
            .mpi-download-section .mpi-instructions {
                font-size: 0.6rem;
                padding: 6px;
            }
        }
        
        /* Hide rotate overlay - we now support all orientations */
        .rotate-device-overlay {
            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: 10px;
            box-sizing: border-box;
        }

        .modal-content {
            background: white;
            border-radius: 15px;
            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: 15px 20px;
            border-bottom: 2px solid #e2e8f0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
            color: white;
            border-radius: 15px 15px 0 0;
            position: sticky;
            top: 0;
            z-index: 10;
        }

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

        .modal-close {
            background: rgba(255,255,255,0.2);
            border: none;
            font-size: 1.5em;
            color: white;
            cursor: pointer;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            flex-shrink: 0;
        }

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

        .modal-body {
            padding: 20px;
            color: #2d3748;
            line-height: 1.6;
            font-size: 0.85rem;
        }

        .guide-section {
            margin-bottom: 20px;
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            border-radius: 10px;
            padding: 15px;
            border-left: 4px solid var(--primary-color);
        }

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

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

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

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

        .formula-box {
            background: #2d3748;
            color: white;
            padding: 12px;
            border-radius: 8px;
            font-family: 'JetBrains Mono', 'Fira Code', monospace;
            margin: 12px 0;
            text-align: center;
            font-size: 0.8rem;
            line-height: 1.6;
            overflow-x: auto;
        }

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

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

        .modal-content::-webkit-scrollbar-thumb {
            background: var(--primary-color);
            border-radius: 4px;
        }

        .modal-content::-webkit-scrollbar-thumb:hover {
            background: var(--primary-dark);
        }

        /* Modal tablet+ styles */
        @media (min-width: 768px) {
            .modal-overlay {
                padding: 20px;
            }
            
            .modal-header {
                padding: 20px 25px;
            }
            
            .modal-header h2 {
                font-size: 1.4em;
            }
            
            .modal-close {
                width: 40px;
                height: 40px;
                font-size: 1.8em;
            }
            
            .modal-body {
                padding: 25px;
                font-size: 0.9rem;
            }
            
            .guide-section {
                padding: 18px;
                margin-bottom: 22px;
            }
            
            .guide-section h3 {
                font-size: 1.1em;
            }
        }

        @media (min-width: 1024px) {
            .modal-header {
                padding: 25px 30px 15px;
            }
            
            .modal-header h2 {
                font-size: 1.6em;
            }
            
            .modal-body {
                padding: 30px;
                font-size: 14px;
            }
            
            .guide-section {
                padding: 20px;
                margin-bottom: 25px;
            }
            
            .guide-section h3 {
                font-size: 1.2em;
            }
        }

        /* Touch-friendly improvements */
        @media (hover: none) and (pointer: coarse) {
            .btn {
                min-height: 44px;
            }
            
            .control-group select {
                min-height: 44px;
            }
            
            .checkbox-group input[type="checkbox"] {
                width: 22px;
                height: 22px;
            }
            
            .info-btn {
                width: 44px;
                height: 44px;
            }
            
            .modal-close {
                width: 44px;
                height: 44px;
            }
        }

        /* Print styles */
        @media print {
            .mobile-nav-toggle,
            .controls-panel,
            .info-btn,
            .notification {
                display: none !important;
            }
            
            .app-container {
                display: block;
            }
            
            .experiment-area {
                page-break-inside: avoid;
            }
        }

        /* Reduced motion preference */
        @media (prefers-reduced-motion: reduce) {
            * {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }

        /* High contrast mode support */
        @media (prefers-contrast: high) {
            .btn {
                border: 2px solid currentColor;
            }
            
            .control-group {
                border: 2px solid #374151;
            }
            
            #canvas {
                border-width: 3px;
            }
        }