<!-- RUBY-BACKUP · part 229 -->
row);
    /* crops */
    for(var ci=0; ci<8; ci++){
      var crop = new THREE.Mesh(new THREE.ConeGeometry(0.08, 0.3, 6),
        new THREE.MeshStandardMaterial({color: 0x66aa33, roughness: 0.9}));
      crop.position.set(-1.75+ci*0.5, 0.25, -2 - r*0.8);
      g.add(crop);
    }
  }
  /* fence */
  for(var f=0; f<6; f++){
    var post = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.04, 0.8, 6),
      new THREE.MeshStandardMaterial({color: 0x6a4a2a, roughness: 0.9}));
    post.position.set(-2.5+f, 0.4, 2);
    g.add(post);
  }
  g.position.set(x*0.13, 0, z*0.13);
  return g;
}
function buildRuralCounties(){
  if(typeof scene==='undefined' || typeof mePos==='undefined') return;
  if(RURAL_GROUP){
    RURAL_GROUP.forEach(function(o){ try{ scene.remove(o); }catch(e){} });
  }
  RURAL_GROUP = [];
  var px = mePos.x, pz = mePos.z;
  /* rural — far from the city, to the west */
  for(var i=0; i<6; i++){
    var x = px - 200 - (i%3)*25;
    var z = pz - 50 + Math.floor(i/3)*40;
    var farm = buildFarm(x, z);
    scene.add(farm);
    RURAL_GROUP.push(farm);
  }
  codeStatus('rural counties — 6 farms, far from the city. Separate.');
}
function buildTribalHut(x, z, cyborgLevel){
  var g = new THREE.Group();
  var thatch = new THREE.MeshStandardMaterial({color: 0x8a6a3a, roughness: 1});
  var wood = new THREE.MeshStandardMaterial({color: 0x5a3a1a, roughness: 0.9});
  /* traditional hut — round */
  var hut = new THREE.Mesh(new THREE.CylinderGeometry(1.2, 1.4, 1.2, 10), wood);
  hut.position.y = 0.6; g.add(hut);
  var roof = new THREE.Mesh(new THREE.ConeGeometry(1.6, 1.0, 10), thatch);
  roof.position.y = 1.7; g.add(roof);
  /* CYBORG FEATURES — tribal meets future */
  if(cyborgLevel > 0){
    var techMat = new THREE.MeshStandardMaterial({
      color: 0x00ffff, emissive: 0x00ffff, emissiveIntensity: 1.2,
      metalness: 0.8, roughness: 0.3
    });
    /* glowing tribal patterns — circuit-like */
    for(var i=0; i<8; i++){
      var ang = i*(Math.PI*2/8);
      var circuit = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.8, 0.02), techMat);
      circuit.position.set(Math.cos(ang)*1.31, 0.6, Math.sin(ang)*1.31);
      circuit.rotation.y = -ang;
      g.add(circuit);
    }
    /* antenna — traditional meets tech */
    var ant = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.03, 1.5, 6),
      new THREE.MeshStandardMaterial({color: 0x888888, metalness: 0.9, roughness: 0.3}));
    ant.position.y = 2.8; g.add(ant);
    var tip = new THREE.Mesh(new THREE.SphereGeometry(0.08, 10, 10), techMat);
    tip.position.y = 3.6; g.add(tip);
    /* holographic fire — instead of wood fire */
    if(cyborgLevel > 1){
      var holo = new THREE.Mesh(new THREE.ConeGeometry(0.3, 0.6, 8),
        new THREE.MeshStandardMaterial({
          color: 0x00aaff, emissive: 0x00aaff, emissiveIntensity: 1.5,
          transparent: true, opacity: 0.7
        }));
      holo.position.set(1.8, 0.3, 0);
      g.add(holo);
    }
  }
  /* totem */
  var totem = new THREE.Mesh(new THREE.CylinderGeometry(0.15, 0.2, 2, 8), wood);
  totem.position.set(-1.8, 1.0, 0); g.add(totem);
  g.position.set(x*0.13, 0, z*0.13);
  return g;
}
function buildTribalVillages(){
  if(typeof scene==='undefined' || typeof mePos==='undefined') return;
  if(TRIBAL_GROUP){
    TRIBAL_GROUP.forEach(function(o){ try{ scene.remove(o); }catch(e){} });
  }
  TRIBAL_GROUP = [];
  var px = mePos.x, pz = mePos.z;
  /* tribal — to the east, separate from city and rural */
  var villages = [
    {x: px+200, z: pz-40, level: 2},
    {x: px+220, z: pz+20, level: 1},
    {x: px+190, z: pz+80, level: 2}
  ];
  villages.forEach(function(v){
    for(var h=0; h<5; h++){
      var ang = h*(Math.PI*2/5);
      var hx = v.x + Math.cos(ang)*8;
      var hz = v.z + Math.sin(ang)*8;
      var hut = buildTribalHut(hx, hz, v.level);
      scene.add(hut);
      TRIBAL_GROUP.push(hut);
    }
    /* central fire */
    var fire = new THREE.Mesh(new THREE.ConeGeometry(0.5, 1.0, 8),
      new THREE.MeshStandardMaterial({
        color: 0x00aaff, emissive: 0x00aaff, emissiveIntensity: 2,
        transparent: true, opacity: 0.8
      }));
    fire.position.set(v.x*0.13, 0.5, v.z*0.13);
    scene.add(fire);
    TRIBAL_GROUP.push(fire);
  });
  codeStatus('tribal villages — 3 villages, traditional huts with cyborg features. Separate.');
}
function clearZones(){
  if(RURAL_GROUP){ RURAL_GROUP.forEach(function(o){ try{ scene.remove(o); }catch(e){} }); RURAL_GROUP = null; }
  if(TRIBAL_GROUP){ TRIBAL_GROUP.forEach(function(o){ try{ scene.remove(o); }catch(e){} }); TRIBAL_GROUP = null; }
  codeStatus('rural and tribal cleared');
}

/* THE GATHERING PLAZA — where city, rural, and tribal meet. The heart. */
var PLAZA_GROUP = null;

/* FUTURE PLAYGROUNDS — where kids meet and share joy */
var PLAYGROUNDS = null;
function buildSlide(x, y, z, colorHex){
  var g = new THREE.Group();
  /* ladder */
  var ladder = new THREE.Mesh(new THREE.BoxGeometry(0.4, 2, 0.3),
    new THREE.MeshSt