<!-- RUBY-BACKUP · part 182 -->
1].forEach(function(s){
    var stalk = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.02, 0.1, 6), red);
    stalk.position.set(0.2, 0.32, s*0.08); g.add(stalk);
    var eye = new THREE.Mesh(new THREE.SphereGeometry(0.035, 8, 8), dark);
    eye.position.set(0.2, 0.38, s*0.08); g.add(eye);
  });
  /* claws */
  [-1,1].forEach(function(s){
    var arm = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.05, 0.25, 8), red);
    arm.position.set(0.25, 0.2, s*0.2); arm.rotation.z = -0.5; arm.rotation.x = s*0.4; g.add(arm);
    var claw = new THREE.Mesh(new THREE.SphereGeometry(0.09, 10, 10), red);
    claw.position.set(0.35, 0.25, s*0.28); claw.scale.set(1.2, 0.8, 1); g.add(claw);
  });
  /* walking legs */
  [-1,1].forEach(function(s){
    for(var i=0; i<3; i++){
      var leg = new THREE.Mesh(new THREE.CylinderGeometry(0.025, 0.02, 0.2, 6), red);
      leg.position.set(-0.05+i*0.12, 0.12, s*0.25);
      leg.rotation.x = s*0.6; g.add(leg);
    }
  });
  return g;
}
function buildDolphin(){
  var g = new THREE.Group();
  var blue = new THREE.MeshStandardMaterial({color: 0x4488cc, roughness: 0.4});
  var light = new THREE.MeshStandardMaterial({color: 0xaaccff, roughness: 0.5});
  var dark = new THREE.MeshStandardMaterial({color: 0x222222});
  /* streamlined body */
  var body = new THREE.Mesh(new THREE.SphereGeometry(0.25, 14, 14), blue);
  body.scale.set(2.2, 0.9, 0.9); body.position.y = 0.4; g.add(body);
  /* belly */
  var belly = new THREE.Mesh(new THREE.SphereGeometry(0.22, 12, 12), light);
  belly.scale.set(2.0, 0.7, 0.8); belly.position.y = 0.32; g.add(belly);
  /* beak */
  var beak = new THREE.Mesh(new THREE.CylinderGeometry(0.06, 0.09, 0.3, 10), blue);
  beak.position.set(0.6, 0.4, 0); beak.rotation.z = -Math.PI/2; g.add(beak);
  /* eyes */
  [-1,1].forEach(function(s){
    var eye = new THREE.Mesh(new THREE.SphereGeometry(0.035, 8, 8), dark);
    eye.position.set(0.45, 0.48, s*0.12); g.add(eye);
  });
  /* dorsal fin */
  var dorsal = new THREE.Mesh(new THREE.ConeGeometry(0.08, 0.25, 8), blue);
  dorsal.position.set(-0.05, 0.65, 0); dorsal.rotation.z = -0.3; g.add(dorsal);
  /* flippers */
  [-1,1].forEach(function(s){
    var flip = new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.04, 0.12), blue);
    flip.position.set(0.1, 0.3, s*0.25); flip.rotation.x = s*0.4; g.add(flip);
  });
  /* tail fluke */
  var tail1 = new THREE.Mesh(new THREE.BoxGeometry(0.15, 0.04, 0.2), blue);
  tail1.position.set(-0.6, 0.45, 0.1); tail1.rotation.y = 0.4; g.add(tail1);
  var tail2 = new THREE.Mesh(new THREE.BoxGeometry(0.15, 0.04, 0.2), blue);
  tail2.position.set(-0.6, 0.45, -0.1); tail2.rotation.y = -0.4; g.add(tail2);
  return g;
}

/* COSMIC ENHANCED — houses, sky, whole world */
var COSMIC_BUILT = false;
var COSMIC_HOUSES = [];
function buildCosmicHouse(x, z, hue){
  var g = new THREE.Group();
  /* base — crystalline */
  var baseMat = new THREE.MeshStandardMaterial({
    color: new THREE.Color().setHSL(hue, 0.7, 0.3),
    metalness: 0.8, roughness: 0.2,
    emissive: new THREE.Color().setHSL(hue, 0.8, 0.15),
    emissiveIntensity: 0.5
  });
  var base = new THREE.Mesh(new THREE.BoxGeometry(2, 1.5, 2), baseMat);
  base.position.y = 0.75; g.add(base);
  /* roof — pyramid, glowing edges */
  var roofMat = new THREE.MeshStandardMaterial({
    color: new THREE.Color().setHSL(hue+0.1, 0.8, 0.4),
    metalness: 0.9, roughness: 0.1,
    emissive: new THREE.Color().setHSL(hue+0.1, 0.9, 0.25),
    emissiveIntensity: 0.7
  });
  var roof = new THREE.Mesh(new THREE.ConeGeometry(1.6, 1.2, 4), roofMat);
  roof.position.y = 2.1; roof.rotation.y = Math.PI/4; g.add(roof);
  /* door — glowing portal */
  var door = new THREE.Mesh(new THREE.PlaneGeometry(0.5, 0.9),
    new THREE.MeshStandardMaterial({
      color: 0xffffff,
      emissive: new THREE.Color().setHSL(hue, 1, 0.6),
      emissiveIntensity: 1.5
    }));
  door.position.set(0, 0.45, 1.01); g.add(door);
  /* windows — starlight */
  [-1,1].forEach(function(s){
    var win = new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4),
      new THREE.MeshStandardMaterial({
        color: 0xffffcc, emissive: 0xffffcc, emissiveIntensity: 1.2
      }));
    win.position.set(s*0.6, 1.0, 1.01); g.add(win);
  });
  /* spire — antenna to the stars */
  var spire = new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0.05, 1.5, 8), roofMat);
  spire.position.y = 3.2; g.add(spire);
  var star = new THREE.Mesh(new THREE.SphereGeometry(0.08, 12, 12),
    new THREE.MeshStandardMaterial({color: 0xffffff, emissive: 0xffffff, emissiveIntensity: 2}));
  star.position.y = 4.0; g.add(star);
  g.position.set(x*0.13, 0, z*0.13);
  return g;
}

/* CITY MAP — towers generate permanent, streets have names */
var CITY_BUILT = false;
var CITY_TOWERS = [];
var STREET_NAMES = []; /* the King provides the list */

/* GOLDEN CITY — his vision */
var GOLD_MODE = false;

/* HEAVY BUILD — flying vehicles, spires, the guardian */
var HEAVY_BUILT = false;

/* ROYAL REGALIA — ermine, velvet, 