<!-- SAGA-STAGING · part 93 -->
 * Synchronization is idempotent.
     * No arbitrary 11-second assumption is required.
     */
    WF.syncMountains();

    var support = WF.supportBelow(
      kingPos,
      {
        startOffset:2,
        maxDrop:8,
        maxSlope:60
      }
    );

    WF.debug.support = support;

    var el = WF.ensureDebugger();

    var supportY =
      support.hit ? support.height.toFixed(2) : 'NONE';

    var delta =
      support.hit ? support.playerDelta.toFixed(2) : '—';

    var slope =
      support.hit ? support.slope.toFixed(1) + '°' : '—';

    var kind =
      support.hit ? support.kind : 'NONE';

    el.textContent =
      'FOUNDATION 1  OBSERVE ONLY\n' +
      'MODE ' +
        (window.SAGA_CORE && window.SAGA_CORE.getMoveMode ? window.SAGA_CORE.getMoveMode() : '?') + '\n' +
      'PLAYER ' +
        kingPos.x.toFixed(1) + ', ' +
        kingPos.y.toFixed(1) + ', ' +
        kingPos.z.toFixed(1) + '\n' +
      'SUPPORT Y ' + supportY + '\n' +
      'DELTA ' + delta + '\n' +
      'VALID ' + (!!support.valid) + '\n' +
      'SURFACE ' + kind + '\n' +
      'SLOPE ' + slope + '\n' +
      'SURFACES ' + WF.colliders.length + '\nHYPER ' + (window.HYPER_MOVE ? (window.HYPER_MOVE.grounded ? 'GROUND' : 'AIR') : 'WAIT');
  };

  /*
   * Install debugger command into the existing command system.
   */
  if(typeof CODES !== 'undefined'){
    CODES.shadowdebug = {cat:"Special",desc:"Toggle V206 live shadow debugger",fn:function(){var R=window.ACTOR_RUNTIME;if(!R)return;R.debug.showingTest=false;if(!R.debug.mobile)R.toggleDebug();R.debug.shadowLiveDisplay=!R.debug.shadowLiveDisplay;if(R.debug.shadowLiveDisplay){R.debug.shadowTimer=setInterval(function(){if(!R.debugElement||!R.debug.shadowLiveDisplay)return;var I=R.input,S=R.shadowMotion,L=R.shadowLive;R.debugElement.textContent="V206 LIVE SHADOW\n\nINPUT      "+I.moveX.toFixed(2)+" / "+I.moveZ.toFixed(2)+"\nMAG        "+I.magnitude.toFixed(2)+"\nDESIRED    "+S.desired.length().toFixed(2)+"\nSHADOW V   "+S.velocity.length().toFixed(2)+"\nPRED STEP  "+(L.lastPredictionError===null?"NONE":L.lastPredictionError.toFixed(3))+"\nSAMPLES    "+L.samples+"\nOWNER      "+String(I.owner).toUpperCase()+"\nMODE       "+String(R.locomotion.requestedMode).toUpperCase()+"\n\nREAL PLAYER: LEGACY\nSHADOW: OBSERVE ONLY";},100);}else{clearInterval(R.debug.shadowTimer);}}};
    CODES.aipilot = {cat:"Special",desc:"Start V211 terrain-aware AI shadow pilot",fn:function(){var A=window.AI_TERRAIN_PILOT;if(A)A.start();}};
    CODES.aistop = {cat:"Special",desc:"Stop AI pilot and return control to human",fn:function(){var A=window.AI_TERRAIN_PILOT,W=window.WORLD_INTELLIGENCE;if(A)A.stop();if(W)W.humanTakeover();}};
    CODES.aiforward = {cat:"Special",desc:"V210 AI shadow forward for 2 seconds",fn:function(){var W=window.WORLD_INTELLIGENCE,R=window.ACTOR_RUNTIME;if(!W||!R)return;if(!W.requestAI("world-ai"))return;W.drive("world-ai",{moveX:0,moveZ:1});setTimeout(function(){if(window.WORLD_INTELLIGENCE)window.WORLD_INTELLIGENCE.stop("world-ai");},2000);}};
    CODES.aitest = {cat:"Special",desc:"Run V209 AI control interface test",fn:function(){var W=window.WORLD_INTELLIGENCE,R=window.ACTOR_RUNTIME,start=kingPos.clone(),r=[];function t(n,v){r.push((v?"PASS  ":"FAIL  ")+n);}t("AI API",!!W&&typeof W.snapshot==="function"&&typeof W.drive==="function");var snap=W.snapshot();t("WORLD SNAPSHOT",!!snap&&!!snap.player&&!!snap.perception&&!!snap.terrain);t("REQUEST AI",W.requestAI("test-ai")===true&&R.ai.active===true);t("AI FORWARD",W.drive("test-ai",{moveX:0,moveZ:1})===true&&R.input.owner==="ai"&&R.input.moveZ===1);t("AI RIGHT",W.drive("test-ai",{moveX:1,moveZ:0})===true&&R.input.moveX===1);t("AI DIAGONAL",W.drive("test-ai",{moveX:.5,moveZ:.5})===true&&R.input.owner==="ai");t("AI STOP",W.stop("test-ai")===true&&R.input.magnitude===0);t("HUMAN TAKEOVER",W.humanTakeover()===true&&R.input.owner==="human"&&R.ai.active===false);t("NO KINGPOS WRITE",start.distanceTo(kingPos)<.0001);t("LEGACY AUTHORITY",R.authority==="legacy"&&R.enabled===false);var n=r.filter(function(x){return x.indexOf("PASS")===0;}).length;R.debug.showingTest=true;if(!R.debug.mobile)R.toggleDebug();R.debugElement.textContent="AI DRIVE INTERFACE TEST v209\n\n"+r.join("\n")+"\n\n"+n+" / "+r.length+" PASS\n\nREAL PLAYER  UNCHANGED\nAUTHORITY    "+String(R.authority).toUpperCase();}};
    CODES.motiontest = {cat:"Special",desc:"Run V206 shadow locomotion test",fn:function(){var R=window.ACTOR_RUNTIME,S=R.shadowMotion,real=kingPos.clone(),r=[];function t(n,v){r.push((v?"PASS  ":"FAIL  ")+n);}function reset(){S.velocity.set(0,0,0);S.desired.set(0,0,0);}reset();R.calculateShadowMotion(.05,{moveX:0,moveZ:0},0,new THREE.Vector3(10,5,20));t("NEUTRAL ZERO",S.desired.length()<.0001);reset();R.calculateShadowMotion(.05,{moveX:0,moveZ:1},0,new THREE.Vector3());t("FORWARD SPEED",Math.abs(S.desired.length()-R.physics.walkSpeed)<.001);t("FORWARD AXIS",Math.abs(S.desired.x+R.physics.walkSpeed)<.001&&Math.abs(S.desire