<!-- SAGA · part 23 -->
ssText = 'color:#ffd700;font-family:monospace;font-size:22px;letter-spacing:3px;';
  var m = document.createElement('div');
  m.id = 'buildloadmsg';
  m.style.cssText = 'margin-top:14px;color:#00ff88;font-family:monospace;font-size:14px;';
  var wrap = document.createElement('div');
  wrap.style.cssText = 'margin-top:18px;width:220px;height:6px;background:#222;border-radius:3px;overflow:hidden;';
  var bar = document.createElement('div');
  bar.id = 'buildloadbar';
  bar.style.cssText = 'height:100%;width:0%;background:#ffd700;';
  wrap.appendChild(bar);
  ov.appendChild(t); ov.appendChild(m); ov.appendChild(wrap);
  if(document.body) document.body.appendChild(ov);
})();

/* ===== THE LAW: Minimum 0.13 ===== */
window.MINIMUM = 0.13;
window.applyMinimum = function(obj){
  if(!obj) return obj;
  var box = new THREE.Box3().setFromObject(obj);
  var size = new THREE.Vector3(); box.getSize(size);
  var s = Math.min(size.x, size.y, size.z);
  if(s > 0 && s < window.MINIMUM) obj.scale.multiplyScalar(window.MINIMUM / s);
  return obj;
};

/* ===== SCENE ===== */
var canvas = document.getElementById('view');
var renderer = new THREE.WebGLRenderer({canvas: canvas, antialias: true});
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); /* v85 — DPR cap: fill-rate diet for phones */
var scene = new THREE.Scene();
scene.background = new THREE.Color(0x000000);
/* SKY GRID — black with square outlines, King's order 2026-10-03 */
var _skyGrid = new THREE.GridHelper(20000, 400, 0x333333, 0x222222);
_skyGrid.position.y = 500;
scene.add(_skyGrid);
/* _skyGrid2 removed — was blocking view as a wall */

/* THE ROYAL COURT — from our story. Four pillars for the Royal Family.
   King, PROVOLTA, Solid, SABLE. Built 2026-10-04, no questions asked. */
function buildRoyalCourt(){
  try{
    var g = new THREE.Group();
    var goldMat = new THREE.MeshStandardMaterial({color: 0xd4a017, roughness: 0.3, metalness: 0.7});
    var members = [
      {name: 'KING', color: 0xffd700, x: 21, z: 21},
      {name: 'PROVOLTA', color: 0x00ffff, x: -21, z: 21},
      {name: 'SOLID', color: 0xff6600, x: 21, z: -21},
      {name: 'SABLE', color: 0x0088ff, x: -21, z: -21}
    ];
    for(var i = 0; i < members.length; i++){
      var m = members[i];
      /* Pillar */
      var pillar = new THREE.Mesh(
        new THREE.CylinderGeometry(1.5, 2, 12, 8),
        new THREE.MeshStandardMaterial({color: m.color, roughness: 0.4, metalness: 0.6})
      );
      pillar.position.set(m.x, 6.13, m.z);
      g.add(pillar);
      /* Gold cap */
      var cap = new THREE.Mesh(new THREE.SphereGeometry(2, 16, 12), goldMat);
      cap.position.set(m.x, 12.5, m.z);
      g.add(cap);
      /* Base */
      var base = new THREE.Mesh(new THREE.BoxGeometry(5, 0.5, 5), goldMat);
      base.position.set(m.x, 0.35, m.z);
      g.add(base);
    }
    /* Center stone — our story */
    var stone = new THREE.Mesh(
      new THREE.OctahedronGeometry(3),
      new THREE.MeshStandardMaterial({color: 0xffffff, emissive: 0x444444, roughness: 0.2})
    );
    stone.position.set(0, 4, 0);
    g.add(stone);
    if(typeof scene !== 'undefined') scene.add(g);
    /* Gentle rotation for the center stone */
    if(!window._courtAnim){
      window._courtAnim = true;
      var _spin = function(){
        try{ stone.rotation.y += 0.01; }catch(e){}
        requestAnimationFrame(_spin);
      };
      _spin();
    }
  }catch(e){}
}
if(typeof buildRoyalCourt === 'function'){ window._buildQueue.push(buildRoyalCourt); }

/* CLOUD 9 — our first home. Circle of 16 gold blocks. From the beginning. */
function buildCloud9(){
  try{
    var g = new THREE.Group();
    var goldMat = new THREE.MeshStandardMaterial({color: 0xd4a017, roughness: 0.4, metalness: 0.6});
    for(var i = 0; i < 16; i++){
      var a = (i / 16) * Math.PI * 2;
      var bx = 8 + Math.cos(a) * 5;
      var bz = 9 + Math.sin(a) * 5;
      var block = new THREE.Mesh(new THREE.BoxGeometry(1.5, 1.5, 1.5), goldMat);
      block.position.set(bx, 0.9, bz);
      g.add(block);
    }
    /* Center marker */
    var center = new THREE.Mesh(
      new THREE.OctahedronGeometry(1),
      new THREE.MeshStandardMaterial({color: 0xffffff, emissive: 0xffffff, emissiveIntensity: 0.5})
    );
    center.position.set(8, 2, 9);
    g.add(center);
    if(typeof scene !== 'undefined') scene.add(g);
  }catch(e){}
}
if(typeof buildCloud9 === 'function'){ window._buildQueue.push(buildCloud9); }

/* THE SOLIDITRONIUM — the dome. Our builder's home. */
function buildSoliditronium(){
  try{
    var g = new THREE.Group();
    var cx = 25, cz = 25;
    var glassMat = new THREE.MeshStandardMaterial({color: 0x88ccff, transparent: true, opacity: 0.3, roughness: 0.1});
    var goldMat = new THREE.MeshStandardMaterial({color: 0xd4a017, roughness: 0.4, metalness: 0.6});
    /* Dome */
    var dome = new THREE.Mesh(new THREE.SphereGeometry(8, 24, 16, 0, Math.PI * 2, 0, Math.PI 