<!-- SAGA-STAGING · part 32 -->
   var bottom = new THREE.Mesh(new THREE.ConeGeometry(8, 12, 8),
          new THREE.MeshStandardMaterial({color: 0x555555, roughness: 0.9}));
        bottom.position.y = -8;
        bottom.rotation.x = Math.PI;
        island.add(bottom);
        /* Mini trees */
        for(var mt = 0; mt < 5; mt++){
          var mtree = new THREE.Mesh(new THREE.ConeGeometry(1.5, 4, 6),
            new THREE.MeshStandardMaterial({color: 0x0a4a0a}));
          mtree.position.set((Math.random()-0.5)*15, 4, (Math.random()-0.5)*15);
          island.add(mtree);
        }
        island.position.set(fx, fy, fz);
        scene.add(island);
        var ph3 = Math.random() * 10;
        window._dynamics.push(function(t){
          island.position.y = fy + Math.sin(t * 0.6 + ph3) * 4;
          island.rotation.y += 0.001;
        });
      })();
    }

    /* COSMIC DUST — maximum particles */
    var cosmicGeo = new THREE.BufferGeometry();
    var cosmicCount = 2000;
    var cosmicPos = new Float32Array(cosmicCount * 3);
    for(var cd = 0; cd < cosmicCount; cd++){
      cosmicPos[cd*3] = (Math.random() - 0.5) * 1200;
      cosmicPos[cd*3+1] = Math.random() * 500;
      cosmicPos[cd*3+2] = (Math.random() - 0.5) * 1200;
    }
    cosmicGeo.setAttribute('position', new THREE.BufferAttribute(cosmicPos, 3));
    var cosmicMat = new THREE.PointsMaterial({color: 0xaaaaff, size: 1, transparent: true, opacity: 0.5, fog: false});
    var cosmic = new THREE.Points(cosmicGeo, cosmicMat);
    scene.add(cosmic);
    window._dynamics.push(function(t){
      cosmic.rotation.y = t * 0.005;
    });

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

/* 10 MORE DISTRICTS — filling the 20000 world. 2026-10-04. */
function buildTenDistricts(){
  if(window.STAGING_CLEAN_MAP) return; // Clean map: old builder disabled
  try{
    window._dynamics = window._dynamics || [];
    var goldMat = new THREE.MeshStandardMaterial({color: 0xd4a017, roughness: 0.4, metalness: 0.6});
    var darkMat = new THREE.MeshStandardMaterial({color: 0x1a1a1a, roughness: 0.8});

    /* 1. CRYSTAL CAVERNS (1000, 1000) */
    for(var c = 0; c < 20; c++){
      (function(){
        var cx = 1000 + (Math.random()-0.5)*80;
        var cz = 1000 + (Math.random()-0.5)*80;
        var crys = new THREE.Mesh(new THREE.OctahedronGeometry(2 + Math.random()*3, 0),
          new THREE.MeshStandardMaterial({color: 0x8844ff, emissive: 0x442288, emissiveIntensity: 0.8, transparent: true, opacity: 0.9}));
        crys.position.set(cx, 2, cz);
        scene.add(crys);
        var ph = Math.random()*10;
        window._dynamics.push(function(t){ crys.rotation.y += 0.01; crys.material.emissiveIntensity = 0.6 + Math.sin(t*2+ph)*0.3; });
      })();
    }

    /* 2. SKY PORT (-1000, 500) — docks in the sky */
    var spx = -1000, spz = 500;
    var platform = new THREE.Mesh(new THREE.BoxGeometry(60, 4, 40), darkMat);
    platform.position.set(spx, 80, spz);
    scene.add(platform);
    for(var d = 0; d < 4; d++){
      var dockArm = new THREE.Mesh(new THREE.BoxGeometry(20, 2, 4), goldMat);
      dockArm.position.set(spx - 30 + d*20, 82, spz + 25);
      scene.add(dockArm);
    }

    /* 3. EMBER FIELDS (1500, -800) — volcanic */
    for(var e = 0; e < 15; e++){
      var ex = 1500 + (Math.random()-0.5)*100;
      var ez = -800 + (Math.random()-0.5)*100;
      var lava = new THREE.Mesh(new THREE.CircleGeometry(5 + Math.random()*5, 12),
        new THREE.MeshBasicMaterial({color: 0xff4400}));
      lava.rotation.x = -Math.PI/2;
      lava.position.set(ex, 0.25, ez);
      scene.add(lava);
    }

    /* 5. GOLDEN DESERT (800, 1500) — dunes */
    var sandMat = new THREE.MeshStandardMaterial({color: 0xd4a017, roughness: 1});
    for(var sd = 0; sd < 12; sd++){
      var sx = 800 + (Math.random()-0.5)*150;
      var sz = 1500 + (Math.random()-0.5)*150;
      var dune = new THREE.Mesh(new THREE.SphereGeometry(15 + Math.random()*10, 12, 8), sandMat);
      dune.scale.y = 0.3;
      dune.position.set(sx, 0.5, sz);
      scene.add(dune);
    }

    /* 6. SHADOW GROVE (-800, 1200) — dark trees */
    var shadowMat = new THREE.MeshStandardMaterial({color: 0x0a0a1a, roughness: 0.95});
    for(var sg = 0; sg < 25; sg++){
      var gx = -800 + (Math.random()-0.5)*80;
      var gz = 1200 + (Math.random()-0.5)*80;
      var gtree = new THREE.Mesh(new THREE.ConeGeometry(4, 12, 7), shadowMat);
      gtree.position.set(gx, 6, gz);
      scene.add(gtree);
    }

    /* 7. TIDE POOLS (1200, 300) — water gardens */
    var tideMat = new THREE.MeshStandardMaterial({color: 0x00aaff, transparent: true, opacity: 0.6});
    for(var tp = 0; tp < 8; tp++){
      var px = 1200 + (Math.random()-0.5)*60;
      var pz = 300 + (Math.random()-0.5)*60;
      var pool = new THREE.Mesh(new THREE.CircleGeometry(8, 16), tideMat);
      pool.rotation.x = -Math.PI/2;
      pool.position.set(px, 0.3, pz);
      scene.add(pool);
 