<!-- RUBY-BACKUP · part 535 -->
(){
  requestAnimationFrame(frame);
  var dt = Math.min(clock.getDelta(), 0.05), t = clock.elapsedTime;
  /* the ruby breathes */
  var pulse = 1 + Math.sin(t*2.4)*0.12;
  ruby.scale.set(pulse, pulse, pulse);
  ruby.position.y = 1.1 + Math.sin(t*1.7)*0.12;
  rubyLight.intensity = 2.6 + Math.sin(t*2.4)*0.6;
  ring.rotation.z = t*0.25;
  /* anchor nodes breathe */
  for(var ni=0; ni<anchorGroup.children.length; ni++){
    var np = 1 + Math.sin(t*3 + ni*1.7)*0.25;
    anchorGroup.children[ni].scale.set(np, np, np);
  }
  if(cursorDot.visible){ var cp = 1 + Math.sin(t*4)*0.2; cursorDot.scale.set(cp, cp, cp); }
  /* stones rise — the whole group grows from the ground */
  for(var i=anims.length-1;i>=0;i--){
    var a = anims[i]; a.t += dt/0.55;
    var e = a.t>=1 ? 1 : Math.max(0.01, easeOutBack(a.t));
    a.m.scale.set(e,e,e);
    if(a.t>=1){ anims.splice(i,1); a.m.scale.set(1,1,1); }
  }
  /* self-destruct: the whole frame crumbles at once */
  var hadDying = dying.length > 0;
  for(var dxi=dying.length-1; dxi>=0; dxi--){
    var dx = dying[dxi]; dx.t += dt;
    var dk = Math.max(0.001, 1 - dx.t/0.4);
    dx.m.scale.set(dx.sx*dk, dx.sy*dk, dx.sz*dk);
    if(dx.t >= 0.4){ stones.remove(dx.m); dying.splice(dxi,1); }
  }
  if(hadDying && !dying.length) save();
  for(var nki=0; nki<npcKings.length; nki++){ npcKings[nki].rotation.y += dt*0.25; }
  skyTick(dt);
  /* the look-target: origin, or the largest structure in center mode */
  var wantX = 0, wantZ = 0;
  if(renderMode==='center'){
    var LS = largestStone();
    if(LS){ wantX = LS.position.x; wantZ = LS.position.z; }
  }
  lookTarget.x += (wantX-lookTarget.x)*0.08;
  lookTarget.z += (wantZ-lookTarget.z)*0.08;
  /* the radiating disc follows the largest structure */
  if(renderMode==='radiate'){
    radiateDisc.visible = true;
    var RS = largestStone();
    radiateDisc.position.x = RS ? RS.position.x : 0;
    radiateDisc.position.z = RS ? RS.position.z : 0;
    radiateDisc.rotation.z = t*0.05;
  }else{
    radiateDisc.visible = false;
  }
  /* camera: a body when walking (from the view of Minimum), the high view otherwise */
  if(WALK){
    if(glide && !FLYM){
      _a1.set(glide.x-mePos.x, 0, glide.z-mePos.z);
      var _gd = _a1.length();
      if(_gd < 0.4 || Math.abs(joyX)>0.15 || Math.abs(joyY)>0.15) glide = null;
      else{
        _a1.normalize();
        mePos.addScaledVector(_a1, Math.min(_gd, 6*dt));
        faceYaw = Math.atan2(_a1.x, _a1.z);
      }
    }
    if(FLYM){
      /* the sword leads — fly toward its point, full 360 spherical */
      _a1.set(Math.sin(aimYaw)*Math.cos(aimPitch), Math.sin(aimPitch), Math.cos(aimYaw)*Math.cos(aimPitch));
      meVel.copy(_a1).multiplyScalar(5.2); /* 2x speed for the King */
      mePos.addScaledVector(meVel, dt);
      mePos.y = Math.max(groundY(mePos.x, mePos.z)+0.3, Math.min(30, mePos.y));
      faceYaw = aimYaw;
      if(CROWN){ camYaw = aimYaw; camPitch = aimPitch; }
    }else{
      /* run: the joystick, camera-relative — in crown cam, eye-relative */
      if(CROWN) _a1.set(Math.sin(camYaw), 0, Math.cos(camYaw));
      else{
        _a1.set(mePos.x-camera.position.x, 0, mePos.z-camera.position.z);
        if(_a1.lengthSq()>0.0001) _a1.normalize();
      }
      _a2.set(-_a1.z, 0, _a1.x);
      _a3.set(_a1.x*joyY+_a2.x*joyX, 0, _a1.z*joyY+_a2.z*joyX);
      var _fly = (typeof FLYM!=='undefined' && FLYM);
      var _spd = 31.2 * (_fly ? 15 : 1); /* walk fast, fly 5x faster (King's order) */
      if(window._solidFast) _spd = 3120; /* solidfast — 100% fast, no limits (King's order) */
      meVel.x += (_a3.x*_spd-meVel.x)*Math.min(1, dt*8);
      meVel.z += (_a3.z*_spd-meVel.z)*Math.min(1, dt*8);
      if(jumpQ){ if(onGround){ meVel.y = 1.9; onGround = false; } else { meVel.y = 0; } jumpQ = false; }
      /* gravity removed by the King's order — free movement */
      mePos.addScaledVector(meVel, dt);
      trackPlateau();
      var gy = fortifiedGroundY(mePos.x, mePos.z);
      /* highways are walkable — stand on top, not inside */
      try{
        if(typeof isOnHighway==='function' && isOnHighway(mePos.x, mePos.z)){
          var _rd = Math.sqrt(mePos.x*mePos.x + mePos.z*mePos.z);
          var _rh = 10 + Math.sin(_rd*0.02)*4 + Math.sin(_rd*0.05+1.3)*2 + 0.5;
          if(_rh > gy) gy = _rh;
        }
      }catch(e){}
      /* two invisible stones mirror him below the land */
      try{
        if(mirrorStones.length===2){
          mirrorStones[0].position.set(mePos.x-0.12, gy-0.25, mePos.z);
          mirrorStones[1].position.set(mePos.x+0.12, gy-0.25, mePos.z);
          /* they stop him — never below the mirrors */
          var mirrorY = gy-0.2;
          if(mePos.y < mirrorY+0.3){ mePos.y = mirrorY+0.3; if(meVel.y<0) meVel.y=0; onGround=true; }
        }
      }catch(e){}
      /* never through the land — absolute */
      if(mePos.y < gy+0.1){ mePos.y = gy+0.1; if(meVel.y<0) meVel.y = 0; onGround = true; }
      if(mePos.y < gy-0.5){ if(typeof setFly==="