<!-- RUBY-BACKUP · part 115 -->
hedronGeometry(1.8);
    // outer shell
    var outer = new THREE.Mesh(geo, mat);
    outer.name = 'tetra-outer';
    g.add(outer);
    // inner hollow (scaled by wall depth)
    var innerScale = 1 - (wallDepth / 1.8);
    var inner = new THREE.Mesh(
      new THREE.TetrahedronGeometry(1.8 * innerScale),
      new THREE.MeshStandardMaterial({color:0x111111, roughness:0.9, side:THREE.BackSide})
    );
    inner.name = 'tetra-inner';
    g.add(inner);
    /* edges */
    var edges = new THREE.EdgesGeometry(geo);
    var lines = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({color:0xffd700}));
    lines.name = 'tetra-edges';
    g.add(lines);
    /* wall-depth control */
    window._setTetraWallDepth = function(d){
      window._tetraWallDepth = Math.max(0.05, Math.min(0.5, d));
      if(typeof codeStatus==='function') codeStatus('tetra wall: '+window._tetraWallDepth.toFixed(2));
    };
    /* corner nodes */
    var pos = geo.attributes.position;
    var seen = {};
    for(var i=0; i<pos.count; i++){
      var k = pos.getX(i).toFixed(2)+','+pos.getY(i).toFixed(2)+','+pos.getZ(i).toFixed(2);
      if(!seen[k]){
        seen[k] = true;
        var node = new THREE.Mesh(new THREE.SphereGeometry(0.15, 10, 8), new THREE.MeshStandardMaterial({color:0xffd700, metalness:0.8, roughness:0.2}));
        node.position.set(pos.getX(i), pos.getY(i), pos.getZ(i));
        node.name = 'tetra-node';
        g.add(node);
      }
    }
    try{
      if(typeof mePos !== 'undefined'){ g.position.set(mePos.x + 5, fortifiedGroundY(mePos.x + 5, mePos.z + 5), mePos.z + 5); }
      else { g.position.set(10, 2, 10); }
    }catch(e){ g.position.set(10, 2, 10); }
    if(typeof scene!=='undefined') scene.add(g);
    window._hollowTetra = g;
    g.userData.isPrimitive = true;
    var sceneRef = (typeof scene!=='undefined') ? scene : null;
    pushCommand({
      name: 'build hollow tetra',
      execute: function(){ if(sceneRef) sceneRef.add(g); },
      undo: function(){ if(sceneRef) sceneRef.remove(g); }
    });
    codeStatus('hollow tetra — real');
  }catch(e){ codeStatus('tetra failed'); }
}
function buildLayeredPyramid(){
  try{
    var g = new THREE.Group();
    var mat = new THREE.MeshStandardMaterial({color:0x9a9a9a, roughness:0.7});
    var goldMat = new THREE.MeshStandardMaterial({color:0xffd700, metalness:0.8, roughness:0.2});
    /* TRUE 0.13 SLICES (Playa 2.0 spec) — each layer exactly 0.13 */
    var SLICE = 0.13;
    var size = 3.0;
    var numLayers = 12;
    for(var l=0; l<numLayers; l++){
      var isTop = (l === numLayers-1);
      var layer = new THREE.Mesh(new THREE.BoxGeometry(size, SLICE, size), isTop ? goldMat : mat);
      layer.position.y = (SLICE/2) + l*SLICE;
      layer.name = 'pyramid-slice-' + l;
      g.add(layer);
      size -= 0.24;
      if(size < SLICE) size = SLICE;
    }
    try{
      if(typeof mePos !== 'undefined'){ g.position.set(mePos.x + 5, fortifiedGroundY(mePos.x + 5, mePos.z + 5), mePos.z + 5); }
      else { g.position.set(10, 2, 10); }
    }catch(e){ g.position.set(10, 2, 10); }
    if(typeof scene!=='undefined') scene.add(g);
    window._layeredPyramid = g;
    g.userData.isPrimitive = true;
    var sceneRef = (typeof scene!=='undefined') ? scene : null;
    pushCommand({
      name: 'build layered pyramid',
      execute: function(){ if(sceneRef) sceneRef.add(g); },
      undo: function(){ if(sceneRef) sceneRef.remove(g); }
    });
    codeStatus('layered pyramid — real');
  }catch(e){ codeStatus('pyramid failed'); }
}
function placeProvoltaInCity(){
  try{
    if(typeof PROVOLTA_MODEL==='undefined' || !PROVOLTA_MODEL) return;
    var cc = getCityCenter();
    PROVOLTA_MODEL.position.set(cc.x + 2, 0, cc.z + 2);
    try{
      var site = getLandingSite();
      PROVOLTA_MODEL.lookAt(site.x, 0, site.z);
    }catch(e){}
    /* she waits — she does not advance. You must engage. */
  }catch(e){}
}
setTimeout(function(){
  try{
    buildCity();
    if(typeof getProvoltaModel==='function'){
      getProvoltaModel(function(){ placeProvoltaInCity(); });
    }
  }catch(e){}
}, 6000);
/* LANDING: you're new to the planet — where you landed is home, remember it */
var LANDING_SITE = null;
try{
  var ls = localStorage.getItem('ruby-landing-site');
  if(ls) LANDING_SITE = JSON.parse(ls);
}catch(e){}
function recordLandingSite(){
  try{
    if(LANDING_SITE) return LANDING_SITE;
    var pos = {x: 0, z: 0};
    if(typeof camera!=='undefined'){
      pos.x = Math.round(camera.position.x);
      pos.z = Math.round(camera.position.z);
    }
    LANDING_SITE = pos;
    localStorage.setItem('ruby-landing-site', JSON.stringify(pos));
    return pos;
  }catch(e){ return {x:0, z:0}; }
}
function getLandingSite(){
  if(!LANDING_SITE) return recordLandingSite();
  return LANDING_SITE;
}
/* beacon at the landing site — so you remember where you are */
var LANDING_BEACON = null;
function buildLandingBeacon(){
  try{
    if(LANDING_BEACON) return;
    var site = getLandin