/* Js for , Version=1778041390 */
 if(typeof(v) != "object") v = {};v.pageID = 60;;
;
        const container = document.getElementById('canvas-container');

        // Scene Setup
        const scene = new THREE.Scene();
        scene.background = new THREE.Color(0xffffff);

        // Camera Setup
        const camera = new THREE.PerspectiveCamera(40, container.clientWidth / container.clientHeight, 0.1, 1000);
        camera.position.set(0, 1, 7); 

        // Renderer Setup
        const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
        renderer.setSize(container.clientWidth, container.clientHeight);
        renderer.setPixelRatio(window.devicePixelRatio);
        container.appendChild(renderer.domElement);

        // Label Renderer Setup
        const labelRenderer = new THREE.CSS2DRenderer();
        labelRenderer.setSize(container.clientWidth, container.clientHeight);
        labelRenderer.domElement.className = 'css-label-renderer';
        container.appendChild(labelRenderer.domElement);

        // Lights
        const ambientLight = new THREE.AmbientLight(0xffffff, 0.7);
        scene.add(ambientLight);

        const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
        directionalLight.position.set(5, 10, 7);
        scene.add(directionalLight);

        // Materials
        const siMaterial = new THREE.MeshStandardMaterial({ color: 0x2196F3, roughness: 0.8 });
        const hMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc, roughness: 0.8 });
        const clMaterial = new THREE.MeshStandardMaterial({ color: 0x2ecc71, roughness: 0.8 });
        const bondMaterial = new THREE.MeshStandardMaterial({ color: 0xeeeeee, roughness: 0.5 });
        
        const moleculeGroup = new THREE.Group();
        scene.add(moleculeGroup);

        // Scaling and Dimensions
        const scale = 0.9;
        const bondLength = 2.2 * scale;
        const hRadius = 0.45 * scale;
        const clRadius = 0.75 * scale; 
        const siRadius = 0.9 * scale;
        const bondRadius = 0.12 * scale;

        // Create Silicon (Si) Atom
        const siGeometry = new THREE.SphereGeometry(siRadius, 32, 32);
        const siAtom = new THREE.Mesh(siGeometry, siMaterial);
        moleculeGroup.add(siAtom);

        const siDiv = document.createElement('div');
        siDiv.className = 'atom-label si-label';
        siDiv.textContent = 'Si';
        const siLabel = new THREE.CSS2DObject(siDiv);
        siAtom.add(siLabel); 

        // Tetrahedral Positions
        const d = bondLength / Math.sqrt(3); 
        const tetrahedralPositions = [
            new THREE.Vector3(d, d, d),
            new THREE.Vector3(d, -d, -d),
            new THREE.Vector3(-d, d, -d),
            new THREE.Vector3(-d, -d, d)
        ];

        tetrahedralPositions.forEach((pos, index) => {
            let atomGeometry, atomMaterial, atomLabelText, atomLabelClass, atomRadius;

            // First 3 are Hydrogen, 4th is Chlorine
            if (index < 3) {
                atomGeometry = new THREE.SphereGeometry(hRadius, 32, 32);
                atomMaterial = hMaterial;
                atomLabelText = 'H';
                atomLabelClass = 'h-label';
                atomRadius = hRadius;
            } else {
                atomGeometry = new THREE.SphereGeometry(clRadius, 32, 32);
                atomMaterial = clMaterial;
                atomLabelText = 'Cl';
                atomLabelClass = 'cl-label';
                atomRadius = clRadius;
            }
            
            const atom = new THREE.Mesh(atomGeometry, atomMaterial);
            atom.position.copy(pos);
            moleculeGroup.add(atom);

            // Add Text Labels
            const atomDiv = document.createElement('div');
            atomDiv.className = `atom-label ${atomLabelClass}`;
            atomDiv.textContent = atomLabelText;
            const atomLabel = new THREE.CSS2DObject(atomDiv);
            atomLabel.position.y += atomRadius + 0.3; 
            atom.add(atomLabel);
            
            // Create Bonds (Cylinders)
            const direction = new THREE.Vector3().copy(pos).normalize();
            const distance = pos.length();
            const cylinderGeometry = new THREE.CylinderGeometry(bondRadius, bondRadius, distance, 16);
            const bond = new THREE.Mesh(cylinderGeometry, bondMaterial);
            const axis = new THREE.Vector3(0, 1, 0); 
            const quaternion = new THREE.Quaternion();
            quaternion.setFromUnitVectors(axis, direction);
            bond.setRotationFromQuaternion(quaternion);
            bond.position.copy(pos).multiplyScalar(0.5);
            moleculeGroup.add(bond);
        });

        // Controls
        const controls = new THREE.OrbitControls(camera, renderer.domElement);
        controls.enableDamping = true;
        controls.autoRotate = true;
        controls.autoRotateSpeed = 1.2;

        // Animation Loop
        function animate() {
            requestAnimationFrame(animate);
            controls.update();
            renderer.render(scene, camera);
            labelRenderer.render(scene, camera); 
        }
        animate();

        // Handle Window Resize
        window.addEventListener('resize', () => {
            const width = container.clientWidth;
            const height = container.clientHeight;
            renderer.setSize(width, height);
            labelRenderer.setSize(width, height);
            camera.aspect = width / height;
            camera.updateProjectionMatrix();
        });
    