<!-- SAGA-STAGING · part 69 -->
;
    if(old){old.remove();return;}
    var panel=document.createElement("div");
    panel.id="world-intelligence-panel";
    panel.style.cssText="position:fixed;top:70px;left:12px;right:12px;z-index:999997;background:rgba(5,7,12,.96);color:#fff;border:2px solid #ffd700;border-radius:12px;padding:12px;font:12px/1.45 monospace;max-height:65vh;overflow:auto;pointer-events:auto;";
    var readout=document.createElement("div");
    readout.style.whiteSpace="pre-wrap";
    var controls=document.createElement("div");
    controls.style.cssText="display:flex;gap:8px;position:sticky;bottom:0;background:rgba(5,7,12,.96);padding-top:10px;";
    var aiBtn=document.createElement("button");
    aiBtn.id="v210-ai-drive";aiBtn.textContent="AI DRIVE";
    aiBtn.style.cssText="flex:1;min-height:48px;background:#1a1a2e;color:#ffd700;border:1px solid #ffd700;border-radius:8px;font-weight:bold;";
    var humanBtn=document.createElement("button");
    humanBtn.id="v210-human-drive";humanBtn.textContent="HUMAN DRIVE";
    humanBtn.style.cssText="flex:1;min-height:48px;background:#1a1a2e;color:#fff;border:1px solid #fff;border-radius:8px;font-weight:bold;";
    controls.appendChild(aiBtn);controls.appendChild(humanBtn);panel.appendChild(readout);panel.appendChild(controls);document.body.appendChild(panel);
    aiBtn.addEventListener("click",function(){var W=window.WORLD_INTELLIGENCE,R=window.ACTOR_RUNTIME;if(W&&R&&R.safetySupervisor&&R.safetySupervisor.permit){W.requestAI("world-ai");R.authority="ai_guarded";_ftvx=_ftvy=_ftvz=_fvx=_fvy=_fvz=0;}});
    humanBtn.addEventListener("click",function(){var W=window.WORLD_INTELLIGENCE,R=window.ACTOR_RUNTIME;if(R){R.authority="legacy";_ftvx=_ftvy=_ftvz=_fvx=_fvy=_fvz=0;}if(W)W.humanTakeover();});
    function update(){
      if(!document.body.contains(panel))return;
      var R=window.ACTOR_RUNTIME,F=window.WORLD_FOUNDATION,I=R?R.input:null,P=(R&&R.senseWorld)?R.senseWorld():null,S=R?R.shadowMotion:null,L=R?R.shadowLive:null,T=R?R.terrainPrediction:null,C=R?R.realCandidate:null,V=R?R.safetySupervisor:null;
      var lines=["WORLD INTELLIGENCE v216","HUMAN + AI READABLE","","RUNTIME     "+(R?"ONLINE":"OFFLINE"),"AUTHORITY   "+String(R?R.authority:"NONE").toUpperCase(),"CONTROL     "+(R?(R.enabled?"LIVE":"SHADOW"):"NONE"),"OWNER       "+String(I?I.owner:"NONE").toUpperCase(),"AI STATUS   "+(R&&R.ai.active?"ACTIVE / SHADOW":"READY"),"MODE        "+String(R?R.locomotion.requestedMode:"NONE").toUpperCase(),"","INPUT X/Z   "+(I?I.moveX.toFixed(2)+" / "+I.moveZ.toFixed(2):"NONE"),"MAGNITUDE   "+(I?I.magnitude.toFixed(2):"NONE"),"SHADOW V    "+(S?S.velocity.length().toFixed(2):"NONE"),"SAMPLES     "+(L?L.samples:0),"","SUPPORT     "+(P?(P.support?"YES":"NO"):"NONE"),"GROUNDED    "+(P?(P.grounded?"YES":"NO"):"NONE"),"AIRBORNE    "+(P?(P.airborne?"YES":"NO"):"NONE"),"FALLING     "+(P?(P.falling?"YES":"NO"):"NONE"),"SURFACE     "+(P?P.surface:"NONE"),"GROUND Y    "+(P&&P.groundY!==null?P.groundY.toFixed(2):"NONE"),"SLOPE       "+(P&&P.slope!==null?P.slope.toFixed(1)+" deg":"NONE"),"SAFE STAND  "+(P?(P.safeStand?"YES":"NO"):"NONE"),"SURFACES    "+(F?F.colliders.length:0),"","NEXT MOVE   "+(T?T.classification:"NONE"),"ROUTE SAFE  "+(T?(T.safe?"YES":"NO"):"NONE"),"NEXT GROUND "+(T&&T.groundY!==null?T.groundY.toFixed(2):"NONE"),"NEXT SLOPE  "+(T&&T.slope!==null?T.slope.toFixed(1)+" deg":"NONE"),"STEP DELTA  "+(T&&T.step!==null?T.step.toFixed(2):"NONE"),"NEXT SURFACE "+(T?T.surface:"NONE"),"","REAL CANDIDATE","VERDICT     "+(C?C.verdict:"NONE"),"REASON      "+(C?C.reason:"NONE"),"CANDIDATE   "+(C&&C.x!==null?C.x.toFixed(2)+" / "+C.y.toFixed(2)+" / "+C.z.toFixed(2):"NONE"),"GROUND      "+(C&&C.groundY!==null?C.groundY.toFixed(2):"NONE"),"STEP        "+(C&&C.step!==null?C.step.toFixed(2):"NONE"),"SLOPE       "+(C&&C.slope!==null?C.slope.toFixed(1)+" deg":"NONE"),"SURFACE     "+(C?C.surface:"NONE"),"","SAFETY SUPERVISOR","STATUS      "+(V?V.status:"NONE"),"PERMIT      "+(V&&V.permit?"YES":"NO"),"REASON      "+(V?V.reason:"NONE"),"LAST SAFE   "+(R&&R.safety.hasLastSafe?R.safety.lastSafe.x.toFixed(2)+" / "+R.safety.lastSafe.y.toFixed(2)+" / "+R.safety.lastSafe.z.toFixed(2):"NONE"),"SAFE SAMPLES "+(V?V.safeSamples:0),"BLOCKED     "+(V?V.blockedSamples:0),"","AI API      window.WORLD_INTELLIGENCE","MOVEMENT AUTHORITY: "+String(R?R.authority:"NONE").toUpperCase()];
      readout.textContent=lines.join(String.fromCharCode(10));
      aiBtn.textContent=R&&R.ai.active?"AI DRIVE: ARMED":"AI DRIVE";
      setTimeout(update,200);
    }
    update();
  });
  menu.querySelector('#m-playa').addEventListener('click', function(){
    window.location.href = '/ruby';
  });
  if(!document.getElementById("ai-stats-btn")){var ab=document.createElement("button");ab.id="ai-stats-btn";ab.textContent="AI";ab.title="AI World Intelligence";ab.style.cssText="position:fixed;top:12px;right:116px;z-index:9999;width:44px;height:44px;border-radius:50%;background:#1a1a2e;color:#ffd700;font:bold 13px monosp