<!-- SAGA-SOLID · part 28 -->
dMat);
      roof2.position.set(bx2, h2 + 0.6, bz2);
      scene.add(roof2);
    }

    /* VILLAGE — small houses */
    var houseMat = new THREE.MeshStandardMaterial({color: 0x6a4a2a, roughness: 0.9});
    for(var v = 0; v < 25; v++){
      var vx = -80 + (Math.random() - 0.5) * 60;
      var vz = 180 + (Math.random() - 0.5) * 60;
      var house = new THREE.Group();
      var walls = new THREE.Mesh(new THREE.BoxGeometry(6, 4, 5), houseMat);
      walls.position.y = 2;
      house.add(walls);
      var roof = new THREE.Mesh(new THREE.ConeGeometry(5, 3, 4), darkMat);
      roof.position.y = 5.5;
      roof.rotation.y = Math.PI/4;
      house.add(roof);
      house.position.set(vx, 0.13, vz);
      scene.add(house);
    }

    /* BRIDGES over harbor */
    for(var br = 0; br < 2; br++){
      var bridge = new THREE.Mesh(new THREE.BoxGeometry(60, 1, 6), goldMat);
      bridge.position.set(-100 + br * 30, 2, -100);
      scene.add(bridge);
      for(var bp = 0; bp < 5; bp++){
        var pillar = new THREE.Mesh(new THREE.CylinderGeometry(1, 1, 4, 6), darkMat);
        pillar.position.set(-125 + br * 30 + bp * 12, 0, -100);
        scene.add(pillar);
      }
    }

    /* FLOWERS — gardens */
    var flowerColors = [0xff0000, 0xffff00, 0xff00ff, 0xffffff];
    for(var f = 0; f < 100; f++){
      var fx = (Math.random() - 0.5) * 300;
      var fz = (Math.random() - 0.5) * 300;
      if(Math.abs(fx) < 30 && Math.abs(fz) < 30) continue;
      var stem = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.1, 2, 4),
        new THREE.MeshStandardMaterial({color: 0x00aa00}));
      stem.position.set(fx, 1, fz);
      scene.add(stem);
      var bloom = new THREE.Mesh(new THREE.SphereGeometry(0.5, 6, 5),
        new THREE.MeshStandardMaterial({color: flowerColors[f % 4], emissive: flowerColors[f % 4], emissiveIntensity: 0.3}));
      bloom.position.set(fx, 2.2, fz);
      scene.add(bloom);
    }

    /* FIREFLIES */
    for(var ff = 0; ff < 80; ff++){
      (function(){
        var fx = (Math.random() - 0.5) * 400;
        var fz = (Math.random() - 0.5) * 400;
        var fy = 2 + Math.random() * 8;
        var fly = new THREE.Mesh(new THREE.SphereGeometry(0.3, 6, 5),
          new THREE.MeshBasicMaterial({color: 0xffff00}));
        fly.position.set(fx, fy, fz);
        scene.add(fly);
        var ph3 = Math.random() * 10;
        window._dynamics.push(function(t){
          fly.position.x = fx + Math.sin(t * 0.7 + ph3) * 5;
          fly.position.z = fz + Math.cos(t * 0.6 + ph3) * 5;
          fly.position.y = fy + Math.sin(t * 1.2 + ph3) * 2;
          fly.material.opacity = 0.5 + Math.sin(t * 3 + ph3) * 0.5;
        });
      })();
    }

    /* STATUES — the Royal Family, monumental */
    var statueMat = new THREE.MeshStandardMaterial({color: 0x888888, roughness: 0.7, metalness: 0.3});
    var statuePos = [[50, 50], [-50, 50], [50, -50], [-50, -50]];
    for(var st = 0; st < 4; st++){
      var sx = statuePos[st][0], sz = statuePos[st][1];
      var ped = new THREE.Mesh(new THREE.BoxGeometry(6, 3, 6), darkMat);
      ped.position.set(sx, 1.5, sz);
      scene.add(ped);
      var fig = new THREE.Mesh(new THREE.CylinderGeometry(1.5, 2, 10, 8), statueMat);
      fig.position.set(sx, 8, sz);
      scene.add(fig);
      var head = new THREE.Mesh(new THREE.SphereGeometry(1.8, 12, 10), statueMat);
      head.position.set(sx, 14.5, sz);
      scene.add(head);
    }

    /* AIRSHIPS */
    for(var as = 0; as < 5; as++){
      (function(){
        var ship = new THREE.Group();
        var balloon = new THREE.Mesh(new THREE.SphereGeometry(6, 12, 10), goldMat);
        balloon.scale.set(1.5, 1, 1);
        ship.add(balloon);
        var gondola = new THREE.Mesh(new THREE.BoxGeometry(6, 2, 3), darkMat);
        gondola.position.y = -7;
        ship.add(gondola);
        var ax = (Math.random() - 0.5) * 400;
        var az = (Math.random() - 0.5) * 400;
        ship.position.set(ax, 60 + Math.random() * 20, az);
        scene.add(ship);
        var spd = 2 + Math.random() * 2;
        window._dynamics.push(function(t){
          ship.position.x += spd * 0.05;
          if(ship.position.x > 300) ship.position.x = -300;
          ship.position.y += Math.sin(t * 0.5) * 0.05;
        });
      })();
    }

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

/* REFINEMENT — 1000 passes of polish. 2026-10-04.
   Working on everything, making it real. */
function refineWorld(){
  try{
    window._dynamics = window._dynamics || [];

    /* REFINE: City towers get windows */
    scene.traverse(function(obj){
      if(obj.isMesh && obj.geometry && obj.geometry.type === 'BoxGeometry'){
        var size = obj.geometry.parameters;
        /* Tall dark boxes are city towers — add window glow */
        if(size && size.height > 8 && size.width < 10){
          var winMat = new THREE.MeshBasicMaterial({color: 0xffd700, tra