<!-- LIVE · part 35 -->
len = Math.sqrt((x2-x1)*(x2-x1) + (z2-z1)*(z2-z1));
      /* Viaduct */
      var via = new THREE.Mesh(new THREE.BoxGeometry(8, 3, len), darkMat);
      via.position.set((x1+x2)/2, y, (z1+z2)/2);
      via.rotation.y = Math.atan2(x2-x1, z2-z1);
      scene.add(via);
      /* Guideway glow */
      var guide = new THREE.Mesh(new THREE.BoxGeometry(2, 0.5, len),
        new THREE.MeshBasicMaterial({color: 0x00ffff}));
      guide.position.set((x1+x2)/2, y + 2, (z1+z2)/2);
      guide.rotation.y = Math.atan2(x2-x1, z2-z1);
      scene.add(guide);
      /* Pillars */
      var pillars = Math.floor(len / 100);
      for(var p = 0; p <= pillars; p++){
        var t = p / pillars;
        var px = x1 + (x2-x1)*t;
        var pz = z1 + (z2-z1)*t;
        var pillar = new THREE.Mesh(new THREE.BoxGeometry(4, y, 4), darkMat);
        pillar.position.set(px, y/2, pz);
        scene.add(pillar);
      }
      /* Moving maglev train */
      var train = new THREE.Mesh(new THREE.BoxGeometry(6, 4, 30),
        new THREE.MeshStandardMaterial({color: 0xffffff, metalness: 0.8, roughness: 0.2}));
      scene.add(train);
      var trainT = Math.random();
      var trainDir = 1;
      window._dynamics.push(function(dt){
        trainT += dt * 0.05 * trainDir;
        if(trainT > 1){ trainT = 1; trainDir = -1; }
        if(trainT < 0){ trainT = 0; trainDir = 1; }
        var tx = x1 + (x2-x1)*trainT;
        var tz = z1 + (z2-z1)*trainT;
        train.position.set(tx, y + 4, tz);
        train.rotation.y = Math.atan2(x2-x1, z2-z1);
      });
    }
    /* Connect center to far districts */
    maglevLine(0, 0, 2000, 2000, 30);      /* To Ahupua'a 1 */
    maglevLine(0, 0, -2000, 2000, 35);     /* To Ahupua'a 2 */
    maglevLine(0, 0, 3000, 500, 40);       /* To Shoreline */
    maglevLine(0, 0, 0, 3000, 45);         /* To Sky districts */
    maglevLine(0, 0, -2500, -2000, 30);    /* To Peaks */

    /* SKYBRIDGES — between towers (Marina Bay Sands, Petronas) */
    function skybridge(x1, y1, z1, x2, y2, z2){
      var len = Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1));
      var bridge = new THREE.Mesh(new THREE.BoxGeometry(6, 4, len), goldMat);
      bridge.position.set((x1+x2)/2, (y1+y2)/2, (z1+z2)/2);
      bridge.lookAt(x2, y2, z2);
      scene.add(bridge);
    }
    /* Connect futuristic towers */
    skybridge(350, 50, -200, 380, 55, -180);
    skybridge(380, 55, -180, 360, 48, -150);

    /* VERTIPORTS — flying vehicle hubs (Dubai VDX) */
    function vertiport(x, z){
      var pad = new THREE.Mesh(new THREE.CylinderGeometry(20, 22, 3, 12), darkMat);
      pad.position.set(x, 1.5, z);
      scene.add(pad);
      var h = new THREE.Mesh(new THREE.RingGeometry(8, 10, 16),
        new THREE.MeshBasicMaterial({color: 0x00ffff, side: THREE.DoubleSide}));
      h.rotation.x = -Math.PI/2;
      h.position.set(x, 3.1, z);
      scene.add(h);
      /* Beacon */
      var beacon = new THREE.Mesh(new THREE.CylinderGeometry(1, 1, 30, 8),
        new THREE.MeshBasicMaterial({color: 0x00ffff, transparent: true, opacity: 0.5}));
      beacon.position.set(x, 18, z);
      scene.add(beacon);
    }
    vertiport(100, -100);    /* City */
    vertiport(2000, 2000);   /* Ahupua'a 1 */
    vertiport(3000, 500);    /* Shoreline */
    vertiport(0, 3000);      /* Sky */

    /* GREEN CORRIDORS — park connectors under transit (Singapore) */
    function greenCorridor(x1, z1, x2, z2){
      var len = Math.sqrt((x2-x1)*(x2-x1) + (z2-z1)*(z2-z1));
      var corr = new THREE.Mesh(new THREE.PlaneGeometry(15, len), greenMat);
      corr.rotation.x = -Math.PI/2;
      corr.rotation.z = Math.atan2(x2-x1, z2-z1);
      corr.position.set((x1+x2)/2, 0.35, (z1+z2)/2);
      scene.add(corr);
      /* Trees along corridor */
      var trees = Math.floor(len / 30);
      for(var t = 0; t < trees; t++){
        var tt = t / trees;
        var tx = x1 + (x2-x1)*tt + (Math.random()-0.5)*10;
        var tz = z1 + (z2-z1)*tt + (Math.random()-0.5)*10;
        var tree = new THREE.Mesh(new THREE.ConeGeometry(3, 8, 7), greenMat);
        tree.position.set(tx, 4, tz);
        scene.add(tree);
      }
    }
    greenCorridor(0, 0, 100, -100);
    greenCorridor(100, -100, 250, 50);

  }catch(e){ console.error(e); }
}
if(typeof buildInfrastructure === 'function'){ try{ buildInfrastructure(); }catch(e){ console.error(e); } }

/* MASSIVE MOUNTAINS — huge topography, creating depth. 2026-10-04. */

/* SCENIC — stretched, bent mountains with lakes and rivers. National Geographic. 2026-10-04. */
function buildScenic(){
  try{
    window._dynamics = window._dynamics || [];
    var rockMat = new THREE.MeshStandardMaterial({color: 0x3a3a3a, roughness: 0.95});
    var snowMat = new THREE.MeshStandardMaterial({color: 0xffffff, roughness: 0.3});
    var waterMat = new THREE.MeshStandardMaterial({color: 0x0088cc, transparent: true, opacity: 0.7});
    var greenMat = new THREE.MeshStandardMaterial({color: 0x1a5a1a, roughness: 0.9});

    /* Cu