<!-- RUBY-BACKUP · part 358 -->
 boxes */
    for(var i=0;i<3;i++){
      var b = new THREE.Mesh(new THREE.BoxGeometry(2,2,2), i%2?goldMat:blackMat);
      b.position.set(-24+i*4, 1, -20);
      shapes.push(b);
    }
    /* spheres */
    for(var j=0;j<3;j++){
      var s = new THREE.Mesh(new THREE.SphereGeometry(1.2, 16, 12), j%2?blackMat:goldMat);
      s.position.set(-24+j*4, 1.2, -14);
      shapes.push(s);
    }
    /* cylinders */
    for(var k=0;k<3;k++){
      var cy = new THREE.Mesh(new THREE.CylinderGeometry(1, 1, 2.5, 12), k%2?goldMat:blackMat);
      cy.position.set(-24+k*4, 1.25, -8);
      shapes.push(cy);
    }
    /* cones */
    for(var m=0;m<3;m++){
      var co = new THREE.Mesh(new THREE.ConeGeometry(1.2, 2.5, 4), m%2?blackMat:goldMat);
      co.position.set(-24+m*4, 1.25, -2);
      shapes.push(co);
    }
    shapes.forEach(function(sh){ g.add(sh); });
    if(typeof scene!=='undefined') scene.add(g);
    codeStatus('shapes stand');
  }catch(e){ codeStatus('shapes failed'); }
}
/* GEAR — craft a mechanical gear, the dynamics benchmark */
function buildGear(){
  try{
    var g = new THREE.Group();
    var goldMat = new THREE.MeshStandardMaterial({color:0xffd700, emissive:0xffd700, emissiveIntensity:0.4, roughness:0.3, metalness:0.7});
    var blackMat = new THREE.MeshStandardMaterial({color:0x1a1a1a, roughness:0.5, metalness:0.4});
    /* gear body — cylinder */
    var body = new THREE.Mesh(new THREE.CylinderGeometry(2, 2, 0.8, 24), goldMat);
    g.add(body);
    /* hub */
    var hub = new THREE.Mesh(new THREE.CylinderGeometry(0.6, 0.6, 1.0, 12), blackMat);
    g.add(hub);
    /* teeth — 12 around the edge */
    for(var i=0; i<12; i++){
      var angle = (i/12) * Math.PI * 2;
      var tooth = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.8, 0.6), goldMat);
      tooth.position.set(Math.cos(angle)*2.2, 0, Math.sin(angle)*2.2);
      tooth.rotation.y = -angle;
      g.add(tooth);
    }
    /* center hole visual */
    var hole = new THREE.Mesh(new THREE.CylinderGeometry(0.3, 0.3, 1.1, 8), blackMat);
    g.add(hole);
    g.position.set(0, 1, -24);
    /* lay flat like a gear on the ground, or stand it up */
    /* keep upright for visibility */
    if(typeof scene!=='undefined') scene.add(g);
    /* spin it slowly — dynamics! */
    var spinGear = function(){
      try{ g.rotation.y += 0.02; }catch(e){}
      if(g.parent) requestAnimationFrame(spinGear);
    };
    spinGear();
    window._lastGear = g;
    codeStatus('gear crafted — it turns');
  }catch(e){ codeStatus('gear failed'); }
}
/* PISTON — craft a mechanical piston, pumps back and forth */
function buildPiston(){
  try{
    var g = new THREE.Group();
    var goldMat = new THREE.MeshStandardMaterial({color:0xffd700, emissive:0xffd700, emissiveIntensity:0.3, roughness:0.4, metalness:0.6});
    var steelMat = new THREE.MeshStandardMaterial({color:0x888888, roughness:0.3, metalness:0.8});
    var blackMat = new THREE.MeshStandardMaterial({color:0x1a1a1a, roughness:0.6});
    /* chamber — the cylinder body */
    var chamber = new THREE.Mesh(new THREE.CylinderGeometry(1.2, 1.2, 3, 16), steelMat);
    chamber.rotation.z = Math.PI/2;
    chamber.position.set(0, 1.5, 0);
    g.add(chamber);
    /* end caps */
    for(var ci=0; ci<2; ci++){
      var cap = new THREE.Mesh(new THREE.CylinderGeometry(1.3, 1.3, 0.3, 16), blackMat);
      cap.rotation.z = Math.PI/2;
      cap.position.set(ci===0 ? -1.6 : 1.6, 1.5, 0);
      g.add(cap);
    }
    /* the rod — this is what pumps */
    var rod = new THREE.Mesh(new THREE.CylinderGeometry(0.4, 0.4, 4, 10), goldMat);
    rod.rotation.z = Math.PI/2;
    rod.position.set(2, 1.5, 0);
    g.add(rod);
    /* piston head */
    var head = new THREE.Mesh(new THREE.CylinderGeometry(0.9, 0.9, 0.5, 12), goldMat);
    head.rotation.z = Math.PI/2;
    head.position.set(0.5, 1.5, 0);
    g.add(head);
    g.position.set(6, 0, -24);
    if(typeof scene!=='undefined') scene.add(g);
    /* pump it — back and forth, dynamics! */
    var t = 0;
    var pumpPiston = function(){
      try{
        t += 0.05;
        var off = Math.sin(t) * 1.2;
        rod.position.x = 2 + off;
        head.position.x = 0.5 + off;
      }catch(e){}
      if(g.parent) requestAnimationFrame(pumpPiston);
    };
    pumpPiston();
    window._lastPiston = g;
    codeStatus('piston crafted — it pumps');
  }catch(e){ codeStatus('piston failed'); }
}
/* HUMAN BODY — intricate design, articulated */
function buildHumanBody(){
  try{
    var g = new THREE.Group();
    var skin = new THREE.MeshStandardMaterial({color:0xc8966a, roughness:0.6});
    var darkSkin = new THREE.MeshStandardMaterial({color:0xa8764a, roughness:0.6});
    var eyeW = new THREE.MeshStandardMaterial({color:0xffffff, roughness:0.3});
    var pupil = new THREE.MeshStandardMaterial({color:0x1a1a1a, roughness:0.3});
    var hairM = new THREE.MeshStandardMaterial({color:0x2a1a0a, roughness:0.8});
    var clothM = new THREE.MeshStandardMaterial({color:0x8a1a1a, roughness:0.7});
 