        :root {
            --bg-primary: #0a0a0a;
            --text-primary: #00ffff;
            --text-secondary: #ff00ff;
            --accent: #ffff00;
            --error: #ff073a;
            --success: #39ff14;
            --warning: #ffa500;
            --panel-bg: rgba(26, 26, 46, 0.9);
            --border: #00ffff;
        }

        [data-theme="light"] {
            --bg-primary: #f0f0f0;
            --text-primary: #2c3e50;
            --text-secondary: #8e44ad;
            --accent: #e74c3c;
            --error: #c0392b;
            --success: #27ae60;
            --warning: #f39c12;
            --panel-bg: rgba(255, 255, 255, 0.95);
            --border: #3498db;
        }

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

        body {
            font-family: 'Courier New', monospace;
            background: var(--bg-primary);
            color: var(--text-primary);
            overflow-y: auto;
            overflow-x: hidden;
            font-size: 12px;
            touch-action: manipulation;
        }

        #container {
            width: 100vw;
            min-height: 100vh;
            position: relative;
            background: var(--bg-primary);
            overflow: visible;
        }

        .shooting-star {
            position: absolute;
            width: 2px;
            height: 2px;
            background: white;
            border-radius: 50%;
            opacity: 0;
            animation: shoot linear infinite;
        }

        .shooting-star::before {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            width: 0;
            height: 1px;
            background: linear-gradient(90deg, white, transparent);
            transform: translateX(100%);
            animation: tail linear infinite;
        }

        .shooting-star:nth-child(1) {
            top: 20%;
            animation-duration: 3s;
            animation-delay: 0s;
        }

        .shooting-star:nth-child(2) {
            top: 40%;
            animation-duration: 2.5s;
            animation-delay: 0.5s;
        }

        .shooting-star:nth-child(3) {
            top: 60%;
            animation-duration: 4s;
            animation-delay: 1s;
        }

        .shooting-star:nth-child(4) {
            top: 80%;
            animation-duration: 3.5s;
            animation-delay: 1.5s;
        }

        .shooting-star:nth-child(5) {
            top: 10%;
            animation-duration: 2.8s;
            animation-delay: 2s;
        }

        .shooting-star:nth-child(6) {
            top: 70%;
            animation-duration: 3.2s;
            animation-delay: 2.5s;
        }

        @keyframes shoot {
            0% {
                transform: translateX(-100px);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateX(calc(100vw + 100px));
                opacity: 0;
            }
        }

        @keyframes tail {
            0% {
                width: 0;
            }
            30% {
                width: 100px;
            }
            100% {
                width: 0;
            }
        }

        #plc-container {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            perspective: 1000px;
            z-index: 1;
        }

        .plc-cabinet {
            width: 350px;
            height: 487px;
            transform-style: preserve-3d;
            animation: rotate 15s linear infinite;
        }

        .plc-face {
            position: absolute;
            border: 3px solid var(--border);
            border-radius: 8px;
            box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
        }

        .plc-front {
            width: 350px;
            height: 487px;
            background: linear-gradient(135deg, #2c3e50, #34495e);
            transform: translateZ(100px);
        }

        .plc-back {
            width: 350px;
            height: 487px;
            background: linear-gradient(135deg, #1a252f, #2c3e50);
            transform: translateZ(-100px) rotateY(180deg);
        }

        .plc-right {
            width: 200px;
            height: 487px;
            background: linear-gradient(135deg, #34495e, #1a252f);
            transform: rotateY(90deg) translateZ(250px);
        }

        .plc-left {
            width: 200px;
            height: 487px;
            background: linear-gradient(135deg, #34495e, #1a252f);
            transform: rotateY(-90deg) translateZ(100px);
        }

        @keyframes rotate {
            from { transform: rotateY(0deg); }
            to { transform: rotateY(360deg); }
        }

        .power-module {
            position: absolute;
            top: 30px;
            left: 20px;
            width: 100px;
            height: 150px;
            background: linear-gradient(135deg, #27ae60, #2ecc71);
            border: 3px solid #1e8449;
            border-radius: 8px;
            box-shadow: 0 0 25px rgba(39, 174, 96, 0.6);
        }

        .power-module::before {
            content: "PWR";
            position: absolute;
            top: 5px;
            left: 50%;
            transform: translateX(-50%);
            color: white;
            font-size: 10px;
            font-weight: bold;
        }

        .cpu-module {
            position: absolute;
            top: 30px;
            left: 130px;
            width: 120px;
            height: 150px;
            background: linear-gradient(135deg, #3498db, #5dade2);
            border: 3px solid #2874a6;
            border-radius: 8px;
            box-shadow: 0 0 25px rgba(52, 152, 219, 0.6);
        }

        .cpu-module::before {
            content: "CPU";
            position: absolute;
            top: 5px;
            left: 50%;
            transform: translateX(-50%);
            color: white;
            font-size: 10px;
            font-weight: bold;
        }

        .io-module {
            position: absolute;
            width: 70px;
            height: 120px;
            border-radius: 6px;
            border: 2px solid;
        }

        .io-module::before {
            position: absolute;
            top: 5px;
            left: 50%;
            transform: translateX(-50%);
            color: white;
            font-size: 8px;
            font-weight: bold;
        }

        .io-module:nth-child(4) {
            top: 200px;
            left: 20px;
            background: linear-gradient(135deg, #e74c3c, #ec7063);
            border-color: #c0392b;
            box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
        }

        .io-module:nth-child(4)::before {
            content: "DI";
        }

        .io-module:nth-child(5) {
            top: 200px;
            left: 100px;
            background: linear-gradient(135deg, #e74c3c, #ec7063);
            border-color: #c0392b;
            box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
        }

        .io-module:nth-child(5)::before {
            content: "DO";
        }

        .io-module:nth-child(6) {
            top: 200px;
            left: 180px;
            background: linear-gradient(135deg, #f39c12, #f8c471);
            border-color: #d68910;
            box-shadow: 0 0 20px rgba(243, 156, 18, 0.5);
        }

        .io-module:nth-child(6)::before {
            content: "AI";
        }

        .io-module:nth-child(7) {
            top: 200px;
            left: 260px;
            background: linear-gradient(135deg, #f39c12, #f8c471);
            border-color: #d68910;
            box-shadow: 0 0 20px rgba(243, 156, 18, 0.5);
        }

        .io-module:nth-child(7)::before {
            content: "AO";
        }

        .status-led {
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background: var(--success);
            position: absolute;
            box-shadow: 0 0 15px currentColor;
            animation: pulse-green 2s ease-in-out infinite;
        }

        .status-led.fault {
            background: var(--error);
            animation: pulse-red 1s ease-in-out infinite;
        }

        .led-1 { top: 340px; left: 30px; }
        .led-2 { top: 340px; left: 55px; }
        .led-3 { top: 340px; left: 80px; }
        .led-4 { top: 340px; left: 105px; }
        .led-5 { top: 340px; left: 130px; }
        .led-6 { top: 365px; left: 30px; }
        .led-7 { top: 365px; left: 55px; }
        .led-8 { top: 365px; left: 80px; }
        .led-9 { top: 365px; left: 105px; }
        .led-10 { top: 365px; left: 130px; }

        .hmi-screen {
            position: absolute;
            top: 340px;
            right: 30px;
            width: 120px;
            height: 80px;
            background: linear-gradient(135deg, #001122, #003366);
            border: 3px solid var(--text-primary);
            border-radius: 8px;
            box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
            overflow: hidden;
        }

        .hmi-screen::before {
            content: "HMI";
            position: absolute;
            top: 5px;
            left: 50%;
            transform: translateX(-50%);
            color: var(--text-primary);
            font-size: 10px;
            font-weight: bold;
        }

        .hmi-display {
            position: absolute;
            top: 20px;
            left: 10px;
            right: 10px;
            bottom: 10px;
            background: #000;
            border: 1px solid var(--text-primary);
            border-radius: 3px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            font-size: 8px;
            color: var(--success);
        }

        .ethernet-port {
            position: absolute;
            top: 430px;
            left: 30px;
            width: 25px;
            height: 15px;
            background: #34495e;
            border: 2px solid #7f8c8d;
            border-radius: 3px;
        }

        .usb-port {
            position: absolute;
            top: 430px;
            left: 65px;
            width: 20px;
            height: 10px;
            background: #34495e;
            border: 2px solid #7f8c8d;
            border-radius: 2px;
        }

        .power-connector {
            position: absolute;
            top: 430px;
            right: 30px;
            width: 30px;
            height: 20px;
            background: #e74c3c;
            border: 2px solid #c0392b;
            border-radius: 4px;
        }

        .power-connector::before {
            content: "24V";
            position: absolute;
            top: 2px;
            left: 50%;
            transform: translateX(-50%);
            color: white;
            font-size: 6px;
            font-weight: bold;
        }

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

        @keyframes pulse-red {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.5; transform: scale(1.2); }
        }

        .panel {
            position: absolute;
            background: var(--panel-bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 12px;
            backdrop-filter: blur(5px);
            z-index: 10;
            font-size: 11px;
            line-height: 1.3;
            overflow-y: auto;
        }

        #left-panel {
            top: 10px;
            left: 10px;
            width: 420px;
            height: calc(100vh - 20px);
        }

        #right-panel {
            top: 10px;
            right: 10px;
            width: 420px;
            height: calc(50vh - 15px);
        }

        #bottom-right {
            bottom: 10px;
            right: 10px;
            width: 420px;
            height: calc(50vh - 15px);
        }

        #top-center {
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            width: 400px;
            height: auto;
            text-align: center;
            overflow: visible;
        }

        h1 {
            color: var(--text-secondary);
            font-size: 18px;
            margin-bottom: 10px;
            text-shadow: 0 0 10px currentColor;
        }

        h2 {
            color: var(--text-secondary);
            font-size: 16px;
            margin-bottom: 12px;
            text-shadow: 0 0 5px currentColor;
        }

        h3 {
            color: var(--accent);
            font-size: 12px;
            margin: 10px 0 6px 0;
        }

        .section {
            margin-bottom: 15px;
            padding: 12px;
            border: 1px solid rgba(0, 255, 255, 0.3);
            border-radius: 6px;
            background: rgba(0, 0, 0, 0.2);
        }

        button {
            background: linear-gradient(45deg, var(--text-primary), var(--text-secondary));
            color: var(--bg-primary);
            border: none;
            padding: 8px 12px;
            margin: 3px;
            border-radius: 5px;
            cursor: pointer;
            font-family: inherit;
            font-size: 11px;
            font-weight: bold;
            width: 100%;
            transition: all 0.2s ease;
        }

        button:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 10px rgba(0, 255, 255, 0.3);
        }

        .fault-btn { background: linear-gradient(45deg, var(--error), #ff4757); }
        .fix-btn { background: linear-gradient(45deg, var(--success), #2ed573); }
        .tool-btn { background: linear-gradient(45deg, var(--warning), #ffa726); }

        .status {
            padding: 6px 10px;
            border-radius: 15px;
            margin: 5px 0;
            text-align: center;
            font-weight: bold;
            font-size: 10px;
        }

        .status-ok {
            background: rgba(57, 255, 20, 0.2);
            border: 1px solid var(--success);
            color: var(--success);
        }

        .status-warning {
            background: rgba(255, 165, 0, 0.2);
            border: 1px solid var(--warning);
            color: var(--warning);
        }

        .status-critical {
            background: rgba(255, 7, 58, 0.2);
            border: 1px solid var(--error);
            color: var(--error);
            animation: pulse-status 1s infinite;
        }

        @keyframes pulse-status {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        .metric {
            display: flex;
            justify-content: space-between;
            padding: 4px 8px;
            margin: 3px 0;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 4px;
            font-size: 11px;
        }

        .io-grid {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 3px;
            margin: 5px 0;
        }

        .io-point {
            padding: 4px;
            border-radius: 3px;
            text-align: center;
            font-size: 9px;
            border: 1px solid;
        }

        .io-on {
            background: rgba(57, 255, 20, 0.2);
            border-color: var(--success);
            color: var(--success);
        }

        .io-fault {
            background: rgba(255, 7, 58, 0.2);
            border-color: var(--error);
            color: var(--error);
            animation: pulse-status 2s infinite;
        }

        .fault-item {
            padding: 8px;
            margin: 4px 0;
            border-radius: 5px;
            border-left: 3px solid var(--error);
            background: rgba(255, 7, 58, 0.1);
            font-size: 11px;
        }

        .diagnostic-step {
            padding: 8px;
            margin: 4px 0;
            border-radius: 5px;
            border: 1px solid var(--border);
            background: rgba(0, 0, 0, 0.3);
            cursor: pointer;
            font-size: 11px;
            transition: all 0.2s ease;
        }

        .diagnostic-step:hover {
            background: rgba(0, 255, 255, 0.1);
            transform: translateX(2px);
        }

        .diagnostic-step.completed {
            border-color: var(--success);
            background: rgba(57, 255, 20, 0.1);
        }

        .meter {
            background: rgba(0, 0, 0, 0.6);
            border: 2px solid var(--accent);
            border-radius: 6px;
            padding: 8px;
            text-align: center;
            margin: 5px 0;
        }

        .meter-value {
            font-size: 16px;
            font-weight: bold;
            color: var(--accent);
            text-shadow: 0 0 8px currentColor;
        }

        .meter-bar {
            width: 100%;
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            overflow: hidden;
            margin: 5px 0;
        }

        .meter-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--success), var(--warning), var(--error));
            transition: width 0.3s ease;
        }

        .log-container {
            background: rgba(0, 0, 0, 0.5);
            border: 1px solid var(--border);
            border-radius: 4px;
            padding: 6px;
            height: 100px;
            overflow-y: auto;
            font-size: 9px;
            line-height: 1.2;
        }

        .log-entry {
            margin: 1px 0;
        }

        .log-error { color: var(--error); }
        .log-success { color: var(--success); }
        .log-warning { color: var(--warning); }
        .log-info { color: var(--text-primary); }

        .theme-btn {
            background: var(--accent);
            color: var(--bg-primary);
            padding: 8px 15px;
            border-radius: 20px;
            border: none;
            font-weight: bold;
            cursor: pointer;
            margin-top: 10px;
        }

        ::-webkit-scrollbar { width: 8px; }
        ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
        ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--text-primary); }

        .scene-status {
            position: absolute;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.8);
            color: var(--text-primary);
            padding: 8px 15px;
            border-radius: 6px;
            font-size: 11px;
            z-index: 15;
            border: 1px solid var(--border);
            box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
            cursor: pointer;
        }

        .pause-rotation {
            animation-play-state: paused !important;
        }

        /* Mobile Responsive Design */
        @media (max-width: 768px) {

            #container {
                height: auto;
                min-height: 100vh;
                overflow: visible;
            }

            /* Ensure panels are tall enough to show all content */
            #right-panel {
                border: 2px solid var(--success) !important;
                min-height: 400px;
            }
            
            #bottom-right {
                min-height: 300px;
            }

            #left-panel {
                position: relative;
                width: calc(100% - 20px);
                height: auto;
                top: 0;
                left: 10px;
                margin: 10px 0;
                overflow: visible;
            }

            #right-panel {
                position: relative;
                width: calc(100% - 20px);
                height: auto;
                max-height: none;
                top: 0;
                right: 0;
                left: 10px;
                margin: 10px 0;
                overflow-y: visible;
                -webkit-overflow-scrolling: touch;
            }

            #bottom-right {
                position: relative;
                width: calc(100% - 20px);
                height: auto;
                max-height: none;
                bottom: 0;
                right: 0;
                left: 10px;
                margin: 10px 0;
                overflow-y: visible;
                -webkit-overflow-scrolling: touch;
            }

            #top-center {
                position: relative;
                width: calc(100% - 20px);
                top: 0;
                left: 10px;
                transform: none;
                margin: 10px 0;
                text-align: center;
            }

            #plc-container {
                position: relative;
                top: 0;
                left: 50%;
                transform: translateX(-50%);
                margin: 20px 0;
                perspective: 800px;
                display: flex;
                justify-content: center;
                align-items: center;
            }

            .plc-cabinet {
                width: 300px;
                height: 400px;
                animation: rotate 20s linear infinite;
            }

            .plc-front {
                width: 250px;
                height: 350px;
            }

            .plc-back {
                width: 250px;
                height: 350px;
            }

            .plc-right {
                width: 200px;
                height: 350px;
                transform: rotateY(90deg) translateZ(150px);
            }

            .plc-left {
                width: 200px;
                height: 350px;
                transform: rotateY(-90deg) translateZ(100px);
            }

            .power-module {
                top: 20px;
                left: 15px;
                width: 70px;
                height: 100px;
            }

            .cpu-module {
                top: 20px;
                left: 95px;
                width: 80px;
                height: 100px;
            }

            .io-module {
                width: 45px;
                height: 80px;
            }

            .io-module:nth-child(4) {
                top: 130px;
                left: 15px;
            }

            .io-module:nth-child(5) {
                top: 130px;
                left: 70px;
            }

            .io-module:nth-child(6) {
                top: 130px;
                left: 125px;
            }

            .io-module:nth-child(7) {
                top: 130px;
                left: 180px;
            }

            .status-led {
                width: 10px;
                height: 10px;
            }

            .led-1 { top: 220px; left: 20px; }
            .led-2 { top: 220px; left: 35px; }
            .led-3 { top: 220px; left: 50px; }
            .led-4 { top: 220px; left: 65px; }
            .led-5 { top: 220px; left: 80px; }
            .led-6 { top: 235px; left: 20px; }
            .led-7 { top: 235px; left: 35px; }
            .led-8 { top: 235px; left: 50px; }
            .led-9 { top: 235px; left: 65px; }
            .led-10 { top: 235px; left: 80px; }

            .hmi-screen {
                top: 220px;
                right: 20px;
                width: 80px;
                height: 50px;
            }

            .hmi-display {
                font-size: 6px;
            }

            .ethernet-port {
                top: 280px;
                left: 20px;
                width: 20px;
                height: 12px;
            }

            .usb-port {
                top: 280px;
                left: 50px;
                width: 15px;
                height: 8px;
            }

            .power-connector {
                top: 280px;
                right: 20px;
                width: 25px;
                height: 15px;
            }

            .panel {
                padding: 15px;
                margin: 10px;
                border-radius: 10px;
                backdrop-filter: blur(3px);
            }

            .section {
                margin-bottom: 20px;
                padding: 15px;
            }

            h1 {
                font-size: 16px;
                margin-bottom: 15px;
            }

            h2 {
                font-size: 14px;
                margin-bottom: 15px;
            }

            h3 {
                font-size: 12px;
                margin: 12px 0 8px 0;
            }

            button {
                padding: 12px 15px;
                margin: 5px 0;
                font-size: 12px;
                border-radius: 8px;
                min-height: 44px;
            }

            .io-grid {
                grid-template-columns: 1fr 1fr;
                gap: 8px;
                margin: 10px 0;
            }

            .io-point {
                padding: 8px;
                font-size: 10px;
                min-height: 40px;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .metric {
                padding: 8px 12px;
                margin: 6px 0;
                font-size: 12px;
                border-radius: 6px;
            }

            .fault-item {
                padding: 12px;
                margin: 8px 0;
                font-size: 12px;
                line-height: 1.4;
            }

            .diagnostic-step {
                padding: 12px;
                margin: 8px 0;
                font-size: 12px;
                min-height: 44px;
                display: flex;
                align-items: center;
            }

            .meter {
                padding: 15px;
                margin: 10px 0;
            }

            .meter-value {
                font-size: 18px;
                margin: 10px 0;
            }

            .meter-bar {
                height: 10px;
                margin: 10px 0;
            }

            .log-container {
                height: 120px;
                font-size: 11px;
                line-height: 1.4;
                padding: 10px;
            }

            .scene-status {
                position: relative;
                bottom: auto;
                left: auto;
                transform: none;
                margin: 15px auto;
                padding: 12px 20px;
                font-size: 12px;
                text-align: center;
                cursor: pointer;
            }

            .theme-btn {
                padding: 12px 20px;
                font-size: 12px;
                margin: 15px auto;
                display: block;
                min-height: 44px;
            }

            .shooting-star {
                display: none;
            }

            /* Mobile scrollbar styling */
            ::-webkit-scrollbar { 
                width: 12px; 
            }
            
            ::-webkit-scrollbar-track { 
                background: rgba(0, 255, 255, 0.2);
                border-radius: 6px;
            }
            
            ::-webkit-scrollbar-thumb { 
                background: var(--success);
                border-radius: 6px;
                border: 2px solid rgba(0, 0, 0, 0.3);
            }
            
            ::-webkit-scrollbar-thumb:hover {
                background: var(--text-primary);
            }
        }
