<!-- RUBY-BACKUP · part 188 -->
ands — 40x40, fountain of galaxy water');
}
function goldenCity(){
  GOLD_MODE = true;
  try{ localStorage.setItem('ruby-gold-mode', '1'); }catch(e){}
  codeStatus('the city dresses in gold...');
  /* sky signs */
  try{ skySign('GALAXY WEALTH', -20, 25, 0xffd700); }catch(e){}
  try{ skySign('ETERNAL FORTUNE', 20, 25, 0xff66ff); }catch(e){}
  /* cosmic dusk */
  if(typeof scene!=='undefined'){
    try{
      scene.background = new THREE.Color(0x1a0f2e);
      scene.fog = new THREE.Fog(0x1a0f2e, 30, 120);
    }catch(e){}
  }
  /* gold light */
  if(typeof scene!=='undefined'){
    try{
      var goldLight = new THREE.DirectionalLight(0xffd700, 0.6);
      goldLight.position.set(30, 40, -30);
      scene.add(goldLight);
    }catch(e){}
  }
  /* recolor EXISTING towers to gold */
  if(typeof scene!=='undefined'){
    try{
      var goldMat = new THREE.MeshStandardMaterial({color: 0xd4af37, metalness: 0.95, roughness: 0.15});
      var jewelColors = [0xffd700, 0xff66ff, 0x66ffff, 0xffffff, 0xff3355];
      var count = 0;
      scene.traverse(function(obj){
        if(obj.userData && obj.userData.permanent && obj.geometry && obj.geometry.type==='BoxGeometry'){
          obj.material = goldMat;
          count++;
        }
        /* jeweled windows */
        if(obj.geometry && obj.geometry.type==='PlaneGeometry' && obj.material && obj.material.emissive){
          var jc = jewelColors[Math.floor(Math.random()*jewelColors.length)];
          obj.material.color.set(jc);
          obj.material.emissive.set(jc);
          obj.material.emissiveIntensity = 1.5;
        }
      });
      codeStatus('dressed '+count+' towers in gold');
    }catch(e){}
  }
  /* heavy build */
  setTimeout(function(){ heavyBuild(); }, 2000);
  setTimeout(function(){ placeRegalia(); }, 4000);
  setTimeout(function(){ placeGraffiti(); }, 6000);
  setTimeout(function(){ placeGuardian(); }, 8000);
}
function skySign(text, x, y, color){
  if(typeof scene==='undefined') return;
  var cv = document.createElement('canvas');
  cv.width = 1024; cv.height = 128;
  var ctx = cv.getContext('2d');
  ctx.fillStyle = 'rgba(0,0,0,0)';
  ctx.fillRect(0, 0, 1024, 128);
  ctx.font = 'bold 72px Arial';
  ctx.textAlign = 'center';
  ctx.shadowColor = '#'+color.toString(16).padStart(6,'0');
  ctx.shadowBlur = 30;
  ctx.fillStyle = '#'+color.toString(16).padStart(6,'0');
  ctx.fillText(text, 512, 90);
  var tex = new THREE.CanvasTexture(cv);
  var sign = new THREE.Mesh(new THREE.PlaneGeometry(12, 1.5),
    new THREE.MeshBasicMaterial({map: tex, transparent: true}));
  sign.position.set(x, y, -40);
  scene.add(sign);
  /* glow behind */
  var glow = new THREE.Mesh(new THREE.PlaneGeometry(14, 3),
    new THREE.MeshBasicMaterial({color: color, transparent: true, opacity: 0.15}));
  glow.position.set(x, y, -40.5);
  scene.add(glow);
}
function buildTower(x, z, height, hue){
  var g = new THREE.Group();
  /* tower — permanent, solid */
  var towerMat;
  try{
    if(typeof GOLD_MODE!=='undefined' && GOLD_MODE){
      towerMat = new THREE.MeshStandardMaterial({
        color: 0xd4af37, metalness: 0.95, roughness: 0.15
      });
    }else{
      towerMat = new THREE.MeshStandardMaterial({
        color: new THREE.Color().setHSL(hue, 0.3, 0.4),
        metalness: 0.6, roughness: 0.4
      });
    }
  }catch(e){
    towerMat = new THREE.MeshStandardMaterial({
      color: new THREE.Color().setHSL(hue, 0.3, 0.4),
      metalness: 0.6, roughness: 0.4
    });
  }
  var tower = new THREE.Mesh(new THREE.BoxGeometry(1.5, height, 1.5), towerMat);
  tower.position.y = height/2;
  tower.userData.permanent = true; /* permanent */
  g.add(tower);
  /* windows — lit */
  var winMat;
  try{
    if(typeof GOLD_MODE!=='undefined' && GOLD_MODE){
      var jewelColors = [0xffd700, 0xff66ff, 0x66ffff, 0xffffff, 0xff3355];
      var jc = jewelColors[Math.floor(Math.random()*jewelColors.length)];
      winMat = new THREE.MeshStandardMaterial({
        color: jc, emissive: jc, emissiveIntensity: 1.5
      });
    }else{
      winMat = new THREE.MeshStandardMaterial({
        color: 0xffffcc, emissive: 0xffffcc, emissiveIntensity: 0.8
      });
    }
  }catch(e){
    winMat = new THREE.MeshStandardMaterial({
      color: 0xffffcc, emissive: 0xffffcc, emissiveIntensity: 0.8
    });
  }
  for(var f=1; f<height; f+=0.8){
    for(var s=0; s<4; s++){
      var win = new THREE.Mesh(new THREE.PlaneGeometry(0.2, 0.2), winMat);
      var ang = s*Math.PI/2;
      win.position.set(Math.sin(ang)*0.76, f, Math.cos(ang)*0.76);
      win.rotation.y = ang;
      g.add(win);
    }
  }
  /* rooftop beacon */
  var beacon = new THREE.Mesh(new THREE.SphereGeometry(0.08, 10, 10),
    new THREE.MeshStandardMaterial({color: 0xff0000, emissive: 0xff0000, emissiveIntensity: 2}));
  beacon.position.y = height + 0.1;
  g.add(beacon);
  g.position.set(x*0.13, 0, z*0.13);
  /* persist */
  try{
    var key = 'city-tower-'+x+'-'+z;
    localStorage.setItem(key, JSON.stringify({x: x, z: z,