<!-- SAGA · part 27 -->
louds that drift */
    var cloudMat = new THREE.MeshStandardMaterial({color: 0x222222, transparent: true, opacity: 0.6, roughness: 1});
    for(var c = 0; c < 20; c++){
      (function(){
        var cloud = new THREE.Group();
        for(var p = 0; p < 5; p++){
          var puff = new THREE.Mesh(new THREE.SphereGeometry(4 + Math.random() * 4, 8, 6), cloudMat);
          puff.position.set((Math.random() - 0.5) * 15, (Math.random() - 0.5) * 3, (Math.random() - 0.5) * 8);
          cloud.add(puff);
        }
        var cx = (Math.random() - 0.5) * 600;
        var cz = (Math.random() - 0.5) * 600;
        cloud.position.set(cx, 80 + Math.random() * 40, cz);
        scene.add(cloud);
        var drift = 1 + Math.random() * 2;
        window._dynamics.push(function(t){
          cloud.position.x += drift * 0.05;
          if(cloud.position.x > 350) cloud.position.x = -350;
        });
      })();
    }

    /* PASS: Street lights that pulse */
    for(var sl = 0; sl < 30; sl++){
      (function(){
        var sx = 100 + (Math.random() - 0.5) * 120;
        var sz = -100 + (Math.random() - 0.5) * 120;
        var pole = new THREE.Mesh(new THREE.CylinderGeometry(0.3, 0.3, 8, 6), darkMat);
        pole.position.set(sx, 4, sz);
        scene.add(pole);
        var lamp = new THREE.Mesh(new THREE.SphereGeometry(0.8, 8, 6),
          new THREE.MeshStandardMaterial({color: 0xffd700, emissive: 0xffd700, emissiveIntensity: 2}));
        lamp.position.set(sx, 8.5, sz);
        scene.add(lamp);
        var ph = Math.random() * 10;
        window._dynamics.push(function(t){
          lamp.material.emissiveIntensity = 1.5 + Math.sin(t * 2 + ph) * 0.5;
        });
      })();
    }

    /* PASS: Dense forest expansion */
    var treeMat = new THREE.MeshStandardMaterial({color: 0x0a4a0a, roughness: 0.9});
    var trunkMat = new THREE.MeshStandardMaterial({color: 0x4a2a0a, roughness: 0.9});
    for(var t2 = 0; t2 < 60; t2++){
      var fx2 = -250 + Math.random() * 200;
      var fz2 = 100 + Math.random() * 150;
      var trunk2 = new THREE.Mesh(new THREE.CylinderGeometry(0.5, 0.7, 4, 6), trunkMat);
      trunk2.position.set(fx2, 2, fz2);
      scene.add(trunk2);
      var leaves2 = new THREE.Mesh(new THREE.ConeGeometry(2 + Math.random() * 2, 5 + Math.random() * 3, 7), treeMat);
      leaves2.position.set(fx2, 6, fz2);
      scene.add(leaves2);
      window._trees.push(leaves2);
    }

    /* PASS: Rocks scattered */
    var rockMat = new THREE.MeshStandardMaterial({color: 0x444444, roughness: 0.95});
    for(var r = 0; r < 50; r++){
      var rx = (Math.random() - 0.5) * 500;
      var rz = (Math.random() - 0.5) * 500;
      if(Math.abs(rx) < 40 && Math.abs(rz) < 40) continue;
      var rock = new THREE.Mesh(new THREE.DodecahedronGeometry(1 + Math.random() * 2, 0), rockMat);
      rock.position.set(rx, 0.5, rz);
      rock.rotation.set(Math.random() * 3, Math.random() * 3, Math.random() * 3);
      scene.add(rock);
    }

    /* PASS: Floating crystals that bob and spin */
    for(var cr = 0; cr < 20; cr++){
      (function(){
        var cx = (Math.random() - 0.5) * 300;
        var cz = (Math.random() - 0.5) * 300;
        var cy = 10 + Math.random() * 20;
        var crystal = new THREE.Mesh(new THREE.OctahedronGeometry(1 + Math.random(), 0),
          new THREE.MeshStandardMaterial({color: 0x00ffff, emissive: 0x00aaaa, emissiveIntensity: 1, transparent: true, opacity: 0.8}));
        crystal.position.set(cx, cy, cz);
        scene.add(crystal);
        var ph2 = Math.random() * 10;
        window._dynamics.push(function(t){
          crystal.position.y = cy + Math.sin(t * 1.5 + ph2) * 2;
          crystal.rotation.y += 0.02;
          crystal.rotation.x += 0.01;
        });
      })();
    }

    /* PASS: Roads connecting districts */
    var roadMat = new THREE.MeshStandardMaterial({color: 0x8a6a1c, roughness: 0.7});
    var connections = [
      [0, 0, 8, 9], [8, 9, 25, 25], [25, 25, 100, -100],
      [0, 0, -35, -35], [-35, -35, -100, -100], [100, -100, -100, -100]
    ];
    for(var rd = 0; rd < connections.length; rd++){
      var x1 = connections[rd][0], z1 = connections[rd][1];
      var x2 = connections[rd][2], z2 = connections[rd][3];
      var len = Math.sqrt((x2-x1)*(x2-x1) + (z2-z1)*(z2-z1));
      var road = new THREE.Mesh(new THREE.BoxGeometry(4, 0.15, len), roadMat);
      road.position.set((x1+x2)/2, 0.2, (z1+z2)/2);
      road.rotation.y = Math.atan2(x2-x1, z2-z1);
      scene.add(road);
    }

    /* Global dynamics loop */
    if(!window._hundredAnim){
      window._hundredAnim = true;
      var _tick = function(){
        try{
          var t = Date.now() * 0.001;
          for(var i = 0; i < window._dynamics.length; i++){
            window._dynamics[i](t);
          }
        }catch(e){}
        requestAnimationFrame(_tick);
      };
      _tick();
    }

  }catch(e){}
}
if(typeof buildHundredPasses === 'function'){ window._idleQueue.push(buildHundredPasses); /* v85 — idl