<!-- SAGA-SOLID · part 48 -->

    {type:'pylon', name:'Pylon'},
    {type:'tetra', name:'Tetra'},
    {type:'pyramid', name:'Pyramid'}
  ];
  blocks.forEach(function(b, i){
    var x = (i / (blocks.length - 1)) * 60 - 30 + cx; // 0-60 spread, centered
    var g = new THREE.Group();
    // Pedestal
    var ped = new THREE.Mesh(new THREE.CylinderGeometry(4, 5, 2, 16), marbleMat);
    ped.position.y = 4; g.add(ped);
    // Block
    var block;
    if(b.type === 'cube'){
      block = new THREE.Mesh(new THREE.BoxGeometry(5,5,5), goldMat.clone());
    } else if(b.type === 'hourglass'){
      block = new THREE.Group();
      var t = new THREE.Mesh(new THREE.ConeGeometry(2.5,3.5,4), goldMat.clone()); t.rotation.x = Math.PI; t.position.y = 1.75; block.add(t);
      var bo = new THREE.Mesh(new THREE.ConeGeometry(2.5,3.5,4), goldMat.clone()); bo.position.y = -1.75; block.add(bo);
    } else if(b.type === 'pylon'){
      block = new THREE.Mesh(new THREE.CylinderGeometry(1.2,1.8,10,8), marbleMat.clone());
    } else if(b.type === 'tetra'){
      block = new THREE.Mesh(new THREE.TetrahedronGeometry(3.5), cyanMat.clone());
    } else if(b.type === 'pyramid'){
      block = new THREE.Group();
      var p1 = new THREE.Mesh(new THREE.ConeGeometry(3.5,2.5,4), goldMat.clone()); p1.position.y = 1.25; block.add(p1);
      var p2 = new THREE.Mesh(new THREE.ConeGeometry(2.2,2,4), marbleMat.clone()); p2.position.y = 3.5; block.add(p2);
    }
    block.position.y = 10;
    block.traverse(function(o){ if(o.isMesh) o.castShadow = true; });
    g.add(block);
    // Label (gold ring)
    var ring = new THREE.Mesh(new THREE.TorusGeometry(6, 0.3, 8, 24), goldMat);
    ring.rotation.x = Math.PI/2;
    ring.position.y = 3.2;
    g.add(ring);
    g.position.set(x, 0, cz + 40);
    g.userData.playaBlock = true;
    g.userData.blockType = b.type;
    scene.add(g);
  });
  // ALL TOOLS — as physical toggle switches on the surface (second row)
  var tools = ['Select','Move','Rotate','Scale','Duplicate','Color','Align','Delete','Undo'];
  tools.forEach(function(tool, i){
    var x = (i / (tools.length - 1)) * 80 - 40 + cx;
    var tg = new THREE.Group();
    // Switch base
    var sbase = new THREE.Mesh(new THREE.BoxGeometry(6, 1, 4), darkMat);
    sbase.position.y = 4; tg.add(sbase);
    // Switch lever
    var lever = new THREE.Mesh(new THREE.BoxGeometry(1.5, 4, 1.5), goldMat.clone());
    lever.position.y = 6.5;
    lever.userData.toolSwitch = true;
    lever.userData.toolName = tool.toLowerCase();
    tg.add(lever);
    // Gold frame
    var frame = new THREE.Mesh(new THREE.BoxGeometry(7, 0.5, 5), goldMat);
    frame.position.y = 3.5; tg.add(frame);
    tg.position.set(x, 0, cz - 40);
    scene.add(tg);
    // Store for tap handling
    if(!window._toolSwitches) window._toolSwitches = [];
    window._toolSwitches.push(lever);
  });
  // Tap tools on surface
  var raycaster = new THREE.Raycaster();
  var mouse = new THREE.Vector2();
  document.addEventListener('click', function(e){
    if(!window._sagaCamera || !window._toolSwitches) return;
    var panel = document.getElementById('creator-ui');
    if(panel && panel.style.display === 'flex') return;
    var x = (e.clientX / window.innerWidth) * 2 - 1;
    var y = -(e.clientY / window.innerHeight) * 2 + 1;
    mouse.set(x, y);
    raycaster.setFromCamera(mouse, window._sagaCamera);
    var hits = raycaster.intersectObjects(window._toolSwitches);
    if(hits.length > 0){
      var tool = hits[0].object.userData.toolName;
      // Flip the switch
      hits[0].object.rotation.z = hits[0].object.rotation.z === 0 ? 0.5 : 0;
      if(tool === 'align' && typeof window._unfoldAll === 'function'){
        window._unfoldAll();
        if(typeof say === 'function') say('Aligned 0-60');
      } else if(tool === 'locker'){
        if(typeof sayLocker === 'function') sayLocker();
      } else if(window.openCreator){
        window.openCreator();
      }
    }
  });
  if(typeof trackNewThing === 'function') trackNewThing('playa-exposed', 'All of Playa exposed on the surface at LAT 60.0, LON 0.0');
})();


/* PLAYA 2.0 UNFOLD — button makes Playa unfold in the world */
(function(){
  var cx = 0, cz = 3333.6;
  var diamondMat = new THREE.MeshStandardMaterial({color:0xffd700, roughness:0.2, metalness:0.9, emissive:0x664400, emissiveIntensity:0.4});
  var bodyMat = new THREE.MeshStandardMaterial({color:0x1a1a2e, roughness:0.5, metalness:0.7});
  var cyanMat = new THREE.MeshStandardMaterial({color:0x00ccff, roughness:0.3, metalness:0.5, emissive:0x0088aa, emissiveIntensity:0.6});
  // Playa 2.0 — starts folded as a diamond, unfolds into a figure
  var playaG = new THREE.Group();
  playaG.position.set(cx, 0, cz);
  // Folded form: diamond (octahedron)
  var folded = new THREE.Mesh(new THREE.OctahedronGeometry(4), diamondMat);
  folded.position.y = 6;
  playaG.add(folded);
  // Unfolded parts (hidden initially, positioned at center)
  var parts = [];
  // Head
  var head = new THREE.Mesh(new THREE.SphereGeome