    @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');
    :root {
            --sidebar-width: 300px;
            --primary-color: #4cc9f0;
            --secondary-color: #007bff;
            --text-color: #333;
            --bg-color: #f0f0f0;
            --panel-bg: #fff;
            --border-color: #ddd;
        }

        * {
            box-sizing: border-box;
        }

        html, body, input {
            height: 100%; /* Essential for predictable viewport height */
            margin: 0;
            padding: 0;
            font-family: 'Inter', sans-serif !important;
            background-color: var(--bg-color);
            color: var(--text-color);
            overflow: hidden; /* Prevent body scroll */
        }

        .container {
            display: flex;
            width: 100vw;
            height: 100%; /* Use 100% since html/body is 100% */
            /* Best cross-browser attempt to fix mobile V-height */
            height: 100dvh; /* Dynamic Viewport Height (modern) */
            min-height: -webkit-fill-available; /* iOS Safari fix */
        }

        .main-content {
            display: flex;
            flex-grow: 1;
            height: 100%;
        }

        .viewer-container {
            flex-grow: 1;
            position: relative;
        }

        #viewer {
            display: block;
            width: 100%;
            height: 100%;
        }

        /* Sidebar Styles (Default for Desktop) */
        .sidebar {
            width: var(--sidebar-width);
            min-width: var(--sidebar-width);
            background-color: var(--bg-color);
            border-left: 1px solid var(--border-color);
            padding: 20px;
            overflow-y: auto; /* Allows scrolling on desktop if content is tall */
            display: flex;
            flex-direction: column;
            gap: 20px;
            height: 100%; /* Fill the container height on desktop */
        }

        .panel {
            background-color: var(--panel-bg);
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }

        .panel-title {
            font-size: 1.1em;
            font-weight: 700;
            margin-top: 0;
            margin-bottom: 15px;
            color: var(--primary-color);
            border-bottom: 2px solid var(--primary-color);
            padding-bottom: 5px;
        }

        /* Material Options, Controls Grid, Loading Indicator (styles kept consistent) */
        .material-options {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .material-option {
            padding: 6px 12px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 0.9em;
            cursor: pointer;
            transition: background-color 0.2s, border-color 0.2s;
        }

        .material-option:hover {
            background-color: #f5f5f5;
        }

        .material-option.active {
            background-color: var(--primary-color);
            color: white;
            border-color: var(--primary-color);
            font-weight: 500;
        }

        .controls-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }

        .btn {
            padding: 8px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-weight: 500;
            transition: background-color 0.2s;
        }

        .btn-secondary {
            background-color: var(--primary-color);
            color: white;
        }

        .btn-secondary:hover {
            background-color: #3aa6d6;
        }

        .loading-indicator {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            padding: 20px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 8px;
            text-align: center;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            z-index: 10;
        }

        .spinner {
            border: 4px solid var(--border-color);
            border-top: 4px solid var(--primary-color);
            border-radius: 50%;
            width: 30px;
            height: 30px;
            animation: spin 1s linear infinite;
            margin: 0 auto 10px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .mesh-list {
            max-height: 40vh; 
            overflow-y: auto;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            margin-top: 10px;
        }

        .mesh-item {
            display: flex;
            align-items: center;
            padding: 8px 10px;
            border-bottom: 1px solid var(--border-color);
            font-size: 0.9em;
            cursor: pointer;
            transition: background-color 0.1s;
        }

        .mesh-item:last-child {
            border-bottom: none;
        }

        .mesh-item:hover {
            background-color: #f9f9f9;
        }

        .mesh-checkbox {
            appearance: none;
            width: 16px;
            height: 16px;
            border: 2px solid var(--primary-color);
            border-radius: 3px;
            margin-right: 10px;
            position: relative;
            cursor: pointer;
            transition: all 0.1s;
            flex-shrink: 0;
        }

        .mesh-checkbox:checked {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
        }

        .mesh-checkbox:checked::after {
            content: '✓';
            color: white;
            font-size: 10px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        .mesh-name {
            flex-grow: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* --- Mobile / Responsiveness Fix (Final Version) --- */
        @media (max-width: 900px) {
            .container {
                flex-direction: column;
            }

            .viewer-container {
                height: 60vh; /* Viewer takes 60% of vertical space */
                order: 1;
            }
            .main-content{
                display: block;
            }
            .sidebar {
                width: 100%;
                height: 40vh; /* Sidebar takes 40% of vertical space */
                max-height: 40vh;
                border-left: none;
                border-top: 1px solid var(--border-color);
                padding: 10px;
                order: 2;
                /* Crucial: Enable vertical scrolling for all panels combined */
                overflow-y: scroll;
            }

            /* Reduced space for mesh list so all panels fit better */
            .mesh-list {
                max-height: 100px; 
            }
        }
        
             /* Center form module over viewer */
            .form-container {
                  position: absolute;
                  top: 50%;
                  left: 50%;
                  transform: translate(-50%, -50%);
                  z-index: 10;
                  background: white;
                  padding: 20px;
                  border-radius: 10px;
                  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
                  width: 400px;
                  transition: all 0.3s ease;
                }
        
            .form {
              padding: 15px 20px;
              transition: opacity 0.3s ease, transform 0.3s ease;
            }
        
            .form.hidden {
              opacity: 0;
              transform: translateX(100%);
              position: absolute;
              top: 0;
              left: 0;
              width: 100%;
            }
        
            .form.active {
              opacity: 1;
              transform: translateX(0);
              position: relative;
            }
        
            /* ===== Titles ===== */
            .form h2 {
              text-align: center;
              color: #333;
              margin-bottom: 25px;
            }
        
            /* ===== Input Fields ===== */
            .form-group {
              margin-bottom: 18px;
            }
        
            .form-group label {
              display: block;
              color: #555;
              margin-bottom: 6px;
              font-size: 14px;
            }
        
            .form-group input, .form-group select {
              width: 100%;
              padding: 10px;
              border: 1px solid #ccc;
              border-radius: 6px;
              font-size: 15px;
              transition: border-color 0.2s ease;
              font-family: 'Inter', sans-serif !important;
            }
        
            .form-group input:focus {
              border-color: #667eea;
              outline: none;
            }
        
            /* ===== Buttons ===== */
            .btn {
              width: 100%;
              padding: 12px;
              background: #667eea;
              color: white;
              border: none;
              border-radius: 6px;
              font-size: 16px;
              cursor: pointer;
              transition: background 0.3s ease;
              font-family: 'Inter', sans-serif !important;
            }
        
            .btn:hover {
              background: #5a67d8;
            }
        
            /* ===== Toggle Link ===== */
            .toggle-text {
              text-align: center;
              margin-top: 20px;
              color: #666;
              font-size: 14px;
            }
        
            .toggle-text button {
              background: none;
              border: none;
              color: #667eea;
              font-weight: 600;
              cursor: pointer;
              transition: color 0.2s ease;
              font-family: 'Inter', sans-serif !important;
            }
        
            .toggle-text button:hover {
              color: #5a67d8;
              text-decoration: underline;
            }
        
            /* ===== Responsive ===== */
            @media (max-width: 420px) {
              .form-container {
                width: 95%;
                padding: 0px;
                position: relative;
              }
            }