<!-- RUBY-BACKUP · part 519 -->
       if(typeof isOnHighway==='function' && isOnHighway(bx, bz)) continue;
            var by = fortifiedGroundY(bx, bz);
            var h = 20 + Math.random()*60*d.size;
            var w = 6 + Math.random()*8;
            // main tower
            var tower = new THREE.Mesh(new THREE.BoxGeometry(w, h, w), bldMat);
            tower.position.set(bx, by + h/2, bz);
            tower.name = 'space-tower-'+di+'-'+i;
            g.add(tower);
            // glowing top
            var top = new THREE.Mesh(new THREE.BoxGeometry(w*0.6, 2, w*0.6), glassMat);
            top.position.set(bx, by + h + 1, bz);
            top.name = 'space-top';
            g.add(top);
            // antenna
            if(Math.random() > 0.5){
              var ant = new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0.2, 15, 6), bldMat);
              ant.position.set(bx, by + h + 8, bz);
              ant.name = 'space-antenna';
              g.add(ant);
              var beacon = new THREE.Mesh(new THREE.SphereGeometry(0.8, 8, 8), glowMat);
              beacon.position.set(bx, by + h + 16, bz);
              beacon.name = 'space-beacon';
              g.add(beacon);
            }
          }
          // central dome
          var dome = new THREE.Mesh(new THREE.SphereGeometry(25*d.size, 16, 12, 0, Math.PI*2, 0, Math.PI/2), glassMat);
          dome.position.set(d.x, gy, d.z);
          dome.name = 'space-dome-'+di;
          g.add(dome);
          // dome base ring
          var ring = new THREE.Mesh(new THREE.TorusGeometry(25*d.size, 2, 8, 32), bldMat);
          ring.rotation.x = Math.PI/2;
          ring.position.set(d.x, gy+1, d.z);
          ring.name = 'space-ring';
          g.add(ring);
        });
        // orbital ring station (high above)
        var station = new THREE.Mesh(new THREE.TorusGeometry(80, 8, 12, 48), bldMat);
        station.position.set(0, 400, 0);
        station.rotation.x = Math.PI/2.5;
        station.name = 'orbital-station';
        g.add(station);
        // station lights
        for(var s=0; s<12; s++){
          var ang = s/12 * Math.PI*2;
          var sl = new THREE.Mesh(new THREE.SphereGeometry(1.5, 8, 8), glassMat);
          sl.position.set(Math.cos(ang)*80, 400 + Math.sin(ang)*80*Math.sin(Math.PI/2.5), Math.sin(ang)*80*Math.cos(Math.PI/2.5));
          sl.name = 'station-light';
          g.add(sl);
        }
      }catch(e){}
    })();
    /* DOWNTOWN — dense towers around the golden plaza */
    (function(){
      try{
        var dtMat = new THREE.MeshStandardMaterial({color:0x2a2a3a, metalness:0.7, roughness:0.4});
        var dtWin = new THREE.MeshStandardMaterial({color:0x00ccff, emissive:0x00ccff, emissiveIntensity:0.1});
        // ring of towers around plaza (radius 60-150)
        for(var i=0; i<40; i++){
          var ang = (i/40)*Math.PI*2;
          var rad = 60 + Math.random()*90;
          var dx = Math.cos(ang)*rad, dz = Math.sin(ang)*rad;
          if(typeof isOnHighway==='function' && isOnHighway(dx, dz)) continue;
          var dy = fortifiedGroundY(dx, dz);
          var h = 30 + Math.random()*80;
          var w = 10 + Math.random()*8;
          var tower = new THREE.Mesh(new THREE.BoxGeometry(w, h, w), dtMat);
          tower.position.set(dx, dy+h/2, dz);
          tower.name = 'downtown-'+i;
          g.add(tower);
          try{ if(typeof window._cityDots==='undefined') window._cityDots=[]; window._cityDots.push([dx,dz]); }catch(e){}
          // glowing windows
          var win = new THREE.Mesh(new THREE.BoxGeometry(w*1.15, h*0.8, w*1.15), dtWin);
          win.position.set(dx, dy+h/2, dz);
          win.name = 'downtown-win';
          g.add(win);
        }
      }catch(e){}
    })();
    /* WATER — river winding through the city */
    (function(){
      try{
        var riverPts = [
          [-800, -600], [-500, -400], [-300, -100], [-100, 200],
          [100, 400], [300, 300], [500, 100], [700, -200], [900, -400]
        ];
        var rcurve = new THREE.CatmullRomCurve3(riverPts.map(function(p){
          var _h = 0;
          try{ if(typeof fortifiedGroundY==='function') _h = fortifiedGroundY(p[0], p[1]); }catch(e){}
          return new THREE.Vector3(p[0], _h + 0.5, p[1]);
        }));
        var rgeo = new THREE.TubeGeometry(rcurve, 64, 15, 8, false);
        rgeo.scale(1, 0.15, 1);
        var waterMat = new THREE.MeshStandardMaterial({
          color: 0x2288cc, transparent: true, opacity: 0.75,
          metalness: 0.8, roughness: 0.2
        });
        var river = new THREE.Mesh(rgeo, waterMat);
        river.name = 'city-river';
        g.add(river);
        /* gentle wave animation */
        var wtime = 0;
        setInterval(function(){
          try{
            wtime += 0.05;
            waterMat.opacity = 0.7 + Math.sin(wtime)*0.08;
          }catch(e){}
        }, 100);
      }catch(e){}
    })();
    /* INTAGLIO AUTO — ultra-dense linework applied on load */
    setTimeout(function(){
      try{
       