        * {
            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-x: hidden;
            overflow-y: auto;
        }

        .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;
            flex-direction: column;
        }

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

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

        .info-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            backdrop-filter: blur(5px);
        }

        .info-modal.show {
            display: flex;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .info-modal-content {
            background: white;
            border-radius: 20px;
            max-width: 800px;
            max-height: 90vh;
            width: 90%;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
            overflow: hidden;
            animation: slideIn 0.3s ease;
        }

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

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

        .info-modal-header h2 {
            margin: 0;
            font-size: 1.5rem;
            font-weight: 600;
        }

        .close-button {
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            padding: 0;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s ease;
        }

        .close-button:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .info-modal-body {
            padding: 0;
            max-height: calc(90vh - 80px);
            overflow-y: auto;
        }

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

        .info-modal-body::-webkit-scrollbar-track {
            background: #f1f5f9;
        }

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

        .feature-section {
            padding: 20px 25px;
            border-bottom: 1px solid #e2e8f0;
        }

        .feature-section:last-child {
            border-bottom: none;
        }

        .feature-section h3 {
            color: #2d3748;
            margin: 0 0 15px 0;
            font-size: 1.2rem;
            font-weight: 600;
        }

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

        .feature-section li {
            margin: 8px 0;
            line-height: 1.5;
            color: #4a5568;
        }

        .feature-section ul ul {
            margin-top: 5px;
            padding-left: 15px;
        }

        .feature-section ul ul li {
            margin: 4px 0;
            font-size: 0.9rem;
        }

        .feature-section strong {
            color: #2d3748;
            font-weight: 600;
        }

        .feature-section em {
            color: #3182ce;
            font-style: normal;
            font-weight: 500;
        }

        .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;
        }

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

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

        .control-row {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .slider {
            flex: 1;
            height: 8px;
            background: #e2e8f0;
            border-radius: 4px;
            outline: none;
            -webkit-appearance: none;
            appearance: none;
            cursor: pointer;
        }

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

        .slider::-moz-range-thumb {
            width: 20px;
            height: 20px;
            background: linear-gradient(135deg, #3b82f6, #1e40af);
            border-radius: 50%;
            cursor: pointer;
            border: none;
            box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
        }

        .control-value {
            min-width: 40px;
            text-align: center;
            color: #1e40af;
            font-weight: 600;
            font-size: 0.9rem;
            background: white;
            border-radius: 6px;
            padding: 4px 8px;
            border: 1px solid #e2e8f0;
        }

        .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-secondary {
            background: linear-gradient(135deg, #10b981, #059669);
            color: white;
        }

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

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

        select {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            font-size: 0.9rem;
            background: white;
            color: #2d3748;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        select:focus {
            outline: none;
            border-color: #3182ce;
            box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
        }

        .simulation-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            padding: 20px;
            overflow: hidden;
            position: relative;
        }

        .byzantine-canvas {
            width: 100%;
            height: 100%;
            min-height: 400px;
            border-radius: 10px;
            background: white;
            box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
            touch-action: manipulation;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.8rem;
            color: #4a5568;
        }

        .legend-color {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            border: 1px solid #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;
        }

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

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

        .stat-value {
            font-size: 1.4rem;
            font-weight: 700;
            margin-bottom: 5px;
        }

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

        .stat-description {
            font-size: 0.7rem;
            color: #94a3b8;
            margin-top: 3px;
        }

        #networkStatus { color: #3b82f6; }
        #consensusRound { color: #10b981; }
        #messageCount { color: #f59e0b; }
        #currentPhase { color: #8b5cf6; }
        #byzantineTolerance { color: #ef4444; }

        .logs {
            height: 300px;
            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.consensus {
            border-left-color: #10b981;
            background: #f0fdf4;
            color: #059669;
        }

        .log-entry.failure {
            border-left-color: #ef4444;
            background: #fef2f2;
            color: #dc2626;
        }

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

        .phase-indicator {
            position: absolute;
            top: 20px;
            left: 20px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 12px 20px;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            font-weight: 600;
            color: #1e40af;
            z-index: 10;
        }

        .phase-indicator.step-mode {
            background: rgba(239, 68, 68, 0.1);
            border-color: #ef4444;
            color: #dc2626;
        }

        .legend-panel {
            position: absolute;
            top: 20px;
            right: 20px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            border: 1px solid #e2e8f0;
            z-index: 10;
            min-width: 180px;
        }

        .legend-panel h4 {
            color: #2d3748;
            margin-bottom: 12px;
            font-size: 0.9rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .legend-panel h4::before {
            content: '🏷️';
            font-size: 1em;
        }

        .legend-items {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .honest { background: #10b981; }
        .byzantine { background: #ef4444; }
        .leader { background: #f59e0b; }
        .offline { background: #64748b; }

        .floating-controls {
            position: absolute;
            top: 20px;
            right: 20px;
            display: flex;
            gap: 10px;
            z-index: 10;
        }

        .floating-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: none;
            background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
            color: white;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            transition: all 0.3s ease;
        }

        .floating-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
        }

        .floating-btn.active {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
        }

        /* Mobile Landscape Support - Phones */
        @media screen and (max-width: 768px) and (orientation: landscape) {
            body {
                overflow-y: auto;
            }

            .app-container {
                grid-template-columns: 250px 1fr 280px;
                grid-template-rows: 50px 1fr;
                height: 100vh;
                gap: 8px;
                padding: 8px;
                overflow: hidden;
                border-radius: 0;
            }

            .header {
                grid-column: 1 / -1;
                padding: 0 12px;
                border-radius: 10px;
            }

            .header h1 {
                font-size: 1.1em;
            }

            .header > div:last-child {
                display: none;
            }

            .controls-panel {
                height: calc(100vh - 66px);
                padding: 10px;
                gap: 10px;
                border-radius: 10px;
            }

            .control-section {
                padding: 10px;
                border-radius: 10px;
            }

            .control-section h3 {
                font-size: 0.85em;
                margin-bottom: 8px;
            }

            .control-section h3::before {
                font-size: 1em;
            }

            .input-group {
                padding: 8px;
                margin-bottom: 10px;
            }

            .input-group label {
                font-size: 0.75rem;
                margin-bottom: 5px;
            }

            .btn {
                padding: 8px 10px;
                font-size: 0.75rem;
                margin-bottom: 5px;
            }

            .experiment-area {
                height: calc(100vh - 66px);
                border-radius: 10px;
            }

            .simulation-area {
                padding: 10px;
            }

            .byzantine-canvas {
                min-height: 280px;
            }

            .legend-panel {
                padding: 8px;
                min-width: 130px;
                font-size: 0.7rem;
                top: 10px;
                right: 10px;
                border-radius: 8px;
            }

            .legend-panel h4 {
                font-size: 0.75rem;
                margin-bottom: 6px;
            }

            .legend-item {
                font-size: 0.65rem;
                gap: 5px;
            }

            .legend-color {
                width: 10px;
                height: 10px;
            }

            .phase-indicator {
                font-size: 0.75rem;
                padding: 6px 10px;
                top: 10px;
                left: 10px;
            }

            .info-button {
                width: 32px;
                height: 32px;
                font-size: 14px;
                top: 10px;
                right: 150px;
            }

            .observations-panel {
                height: calc(100vh - 66px);
                padding: 10px;
                gap: 8px;
                border-radius: 10px;
            }

            .status-section {
                padding: 8px;
                border-radius: 8px;
            }

            .status-section h4 {
                font-size: 0.8rem;
                margin-bottom: 6px;
            }

            .stat-card {
                padding: 8px;
                margin-bottom: 6px;
                border-radius: 8px;
            }

            .stat-value {
                font-size: 1rem;
            }

            .stat-label {
                font-size: 0.65rem;
            }

            .stat-description {
                font-size: 0.55rem;
            }

            .logs {
                height: 180px;
                font-size: 0.65rem;
                padding: 8px;
            }

            .log-entry {
                padding: 4px 6px;
                font-size: 0.6rem;
            }

            select {
                padding: 6px 8px;
                font-size: 0.75rem;
            }

            .slider::-webkit-slider-thumb {
                width: 16px;
                height: 16px;
            }

            .control-value {
                font-size: 0.75rem;
                padding: 2px 6px;
                min-width: 32px;
            }
        }

        /* Mobile Landscape Support - Tablets */
        @media screen and (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
            .app-container {
                grid-template-columns: 280px 1fr 300px;
                grid-template-rows: 65px 1fr;
                gap: 10px;
                padding: 10px;
                border-radius: 15px;
            }

            .header {
                border-radius: 12px;
            }

            .header h1 {
                font-size: 1.5em;
            }

            .controls-panel {
                height: calc(100vh - 85px);
                padding: 15px;
                border-radius: 12px;
            }

            .experiment-area {
                height: calc(100vh - 85px);
                border-radius: 12px;
            }

            .simulation-area {
                padding: 15px;
            }

            .byzantine-canvas {
                min-height: 350px;
            }

            .observations-panel {
                height: calc(100vh - 85px);
                padding: 15px;
                border-radius: 12px;
            }

            .logs {
                height: 200px;
            }
        }

        /* Tablet Portrait Mode */
        @media screen and (min-width: 601px) and (max-width: 1024px) and (orientation: portrait) {
            body {
                overflow-y: auto;
            }

            .app-container {
                grid-template-columns: 1fr 1fr;
                grid-template-rows: 70px auto auto auto;
                height: auto;
                min-height: 100vh;
                gap: 12px;
                padding: 12px;
                border-radius: 0;
                overflow: visible;
            }

            .header {
                grid-column: 1 / -1;
                border-radius: 12px;
                padding: 0 15px;
            }

            .header h1 {
                font-size: 1.4em;
            }

            .controls-panel {
                grid-column: 1 / 2;
                grid-row: 2 / 3;
                height: auto;
                max-height: none;
                border-radius: 12px;
            }

            .experiment-area {
                grid-column: 2 / 3;
                grid-row: 2 / 4;
                min-height: 450px;
                border-radius: 12px;
            }

            .observations-panel {
                grid-column: 1 / 2;
                grid-row: 3 / 4;
                height: auto;
                max-height: none;
                border-radius: 12px;
            }

            .byzantine-canvas {
                min-height: 400px;
            }

            .logs {
                height: 200px;
            }
        }

        /* Large Desktop */
        @media (min-width: 1400px) {
            .app-container {
                grid-template-columns: 350px 1fr 400px;
            }

            .header h1 {
                font-size: 2.2em;
            }

            .controls-panel {
                padding: 25px;
            }

            .observations-panel {
                padding: 25px;
            }
        }

        /* Standard Desktop/Laptop adjustments */
        @media (max-width: 1200px) and (min-width: 1025px) {
            .app-container {
                grid-template-columns: 280px 1fr 320px;
                gap: 12px;
                padding: 12px;
            }

            .header h1 {
                font-size: 1.7em;
            }
        }

        /* Mobile Portrait Mode - Full Responsive Layout */
        @media screen and (max-width: 600px) and (orientation: portrait) {
            body {
                overflow-y: auto;
                min-height: 100vh;
            }

            .app-container {
                display: flex;
                flex-direction: column;
                height: auto;
                min-height: 100vh;
                gap: 10px;
                padding: 10px;
                border-radius: 0;
                overflow: visible;
            }

            .header {
                flex-shrink: 0;
                min-height: 60px;
                padding: 10px 15px;
                border-radius: 12px;
                flex-direction: column;
                align-items: flex-start;
                gap: 5px;
            }

            .header h1 {
                font-size: 1.2em;
                flex-wrap: wrap;
            }

            .header > div:last-child {
                font-size: 0.75em !important;
            }

            .experiment-area {
                order: 1;
                flex-shrink: 0;
                min-height: 350px;
                height: 350px;
                border-radius: 12px;
            }

            .simulation-area {
                padding: 10px;
                position: relative;
            }

            .byzantine-canvas {
                min-height: 280px;
                height: 100%;
            }

            .legend-panel {
                position: absolute;
                top: 8px;
                right: 8px;
                padding: 8px 10px;
                min-width: 120px;
                border-radius: 8px;
                font-size: 0.7rem;
            }

            .legend-panel h4 {
                font-size: 0.75rem;
                margin-bottom: 6px;
            }

            .legend-panel h4::before {
                font-size: 0.85em;
            }

            .legend-item {
                font-size: 0.65rem;
                gap: 6px;
            }

            .legend-color {
                width: 10px;
                height: 10px;
            }

            .phase-indicator {
                position: absolute;
                top: 8px;
                left: 8px;
                font-size: 0.75rem;
                padding: 6px 10px;
                border-radius: 6px;
            }

            .info-button {
                width: 32px;
                height: 32px;
                font-size: 14px;
                top: auto;
                bottom: 8px;
                right: 8px;
            }

            .controls-panel {
                order: 2;
                flex-shrink: 0;
                height: auto;
                max-height: none;
                padding: 12px;
                border-radius: 12px;
                gap: 12px;
            }

            .control-section {
                padding: 12px;
                border-radius: 10px;
            }

            .control-section h3 {
                font-size: 0.95em;
                margin-bottom: 10px;
            }

            .input-group {
                padding: 10px;
                margin-bottom: 12px;
            }

            .input-group label {
                font-size: 0.8rem;
            }

            .btn {
                padding: 12px 14px;
                font-size: 0.85rem;
                margin-bottom: 8px;
                min-height: 44px;
            }

            select {
                padding: 10px 12px;
                font-size: 0.85rem;
                min-height: 44px;
            }

            .slider {
                height: 10px;
            }

            .slider::-webkit-slider-thumb {
                width: 24px;
                height: 24px;
            }

            .slider::-moz-range-thumb {
                width: 24px;
                height: 24px;
            }

            .control-value {
                font-size: 0.85rem;
                padding: 4px 8px;
            }

            .observations-panel {
                order: 3;
                flex-shrink: 0;
                height: auto;
                max-height: none;
                padding: 12px;
                border-radius: 12px;
                gap: 12px;
            }

            .status-section {
                padding: 12px;
                border-radius: 10px;
            }

            .status-section h4 {
                font-size: 0.95em;
                margin-bottom: 10px;
            }

            .stat-card {
                padding: 12px;
                margin-bottom: 10px;
                border-radius: 10px;
            }

            .stat-value {
                font-size: 1.2rem;
            }

            .stat-label {
                font-size: 0.75rem;
            }

            .stat-description {
                font-size: 0.65rem;
            }

            .logs {
                height: 200px;
                font-size: 0.75rem;
                padding: 10px;
            }

            .log-entry {
                padding: 6px 8px;
                font-size: 0.7rem;
                margin: 3px 0;
            }

            /* Mobile-friendly stat cards grid */
            .status-section:last-child {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 8px;
            }

            .status-section:last-child h4 {
                grid-column: 1 / -1;
            }

            .status-section:last-child .stat-card {
                margin-bottom: 0;
            }

            .status-section:last-child .stat-card:last-child {
                grid-column: 1 / -1;
            }
        }

        /* Extra small phones */
        @media screen and (max-width: 380px) and (orientation: portrait) {
            .header h1 {
                font-size: 1em;
            }

            .experiment-area {
                min-height: 300px;
                height: 300px;
            }

            .byzantine-canvas {
                min-height: 240px;
            }

            .legend-panel {
                min-width: 100px;
                padding: 6px 8px;
            }

            .legend-panel h4 {
                font-size: 0.7rem;
            }

            .legend-item {
                font-size: 0.6rem;
            }

            .btn {
                padding: 10px 12px;
                font-size: 0.8rem;
            }

            .stat-value {
                font-size: 1rem;
            }
        }

        /* Info Modal Responsive */
        @media screen and (max-width: 768px) {
            .info-modal-content {
                width: 95%;
                max-height: 85vh;
                border-radius: 15px;
            }

            .info-modal-header {
                padding: 15px 18px;
            }

            .info-modal-header h2 {
                font-size: 1.1rem;
            }

            .feature-section {
                padding: 15px 18px;
            }

            .feature-section h3 {
                font-size: 1rem;
            }

            .feature-section li {
                font-size: 0.85rem;
            }

            .feature-section ul ul li {
                font-size: 0.8rem;
            }
        }

        @media screen and (max-width: 480px) {
            .info-modal-content {
                width: 100%;
                max-height: 100vh;
                border-radius: 0;
            }

            .info-modal-header {
                padding: 12px 15px;
            }

            .info-modal-header h2 {
                font-size: 1rem;
            }

            .feature-section {
                padding: 12px 15px;
            }

            .feature-section h3 {
                font-size: 0.95rem;
            }

            .feature-section li {
                font-size: 0.8rem;
                line-height: 1.4;
            }
        }

        /* Rotate device overlay - Only for very small landscape screens */
        .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); }
        }

        /* Show rotate overlay only for very small landscape screens where layout breaks */
        @media screen and (max-height: 400px) and (orientation: landscape) {
            .rotate-device-overlay {
                display: flex !important;
            }
            
            .app-container {
                display: none !important;
            }
        }

        /* Touch-friendly improvements */
        @media (hover: none) and (pointer: coarse) {
            .btn {
                min-height: 44px;
            }

            select {
                min-height: 44px;
            }

            .slider::-webkit-slider-thumb {
                width: 28px;
                height: 28px;
            }

            .slider::-moz-range-thumb {
                width: 28px;
                height: 28px;
            }

            .info-button {
                width: 44px;
                height: 44px;
                font-size: 18px;
            }

            .close-button {
                width: 44px;
                height: 44px;
                font-size: 28px;
            }

            .btn:hover {
                transform: none;
            }

            .stat-card:hover {
                transform: none;
            }
        }

        /* High contrast mode support */
        @media (prefers-contrast: high) {
            .app-container {
                border: 2px solid #000;
            }

            .btn {
                border: 2px solid #000;
            }

            .control-section {
                border: 1px solid #000;
            }

            .stat-card {
                border: 1px solid #000;
            }
        }

        /* Reduced motion support */
        @media (prefers-reduced-motion: reduce) {
            * {
                animation: none !important;
                transition: none !important;
            }

            .header .status-indicator {
                animation: none;
            }
        }

        /* Print styles */
        @media print {
            body {
                background: white;
            }

            .app-container {
                display: block;
                height: auto;
                box-shadow: none;
            }

            .controls-panel,
            .info-button,
            .rotate-device-overlay {
                display: none !important;
            }

            .experiment-area {
                page-break-inside: avoid;
            }
        }