<!-- RUBY-BACKUP · part 316 -->
  }
      /* Old flight stick retired — jet mode handles it */
      if(_fly && window._adminFlyVertical && !window._sonicClimb){
        var _vy = -joyY * _spd * 0.5; /* stick up = climb, down = dive */
        /* Diagonals: / and \ tilt the flight path */
        var _tilt = Math.abs(joyX) * 0.5; /* sideways tilt adds to climb */
        if(joyY < -0.2) _vy *= (1 + _tilt); /* / up-right climbs faster */
        if(joyY < -0.2 && joyX < -0.2) _vy *= (1 + _tilt); /* \ up-left climbs faster */
        meVel.y += (_vy - meVel.y) * Math.min(1, dt*4);
      }
      if(typeof window._speedBoost!=='undefined' && window._speedBoost>0) _spd *= window._speedBoost;
      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);
      /* SOLID FOUNDATION — raycast the real geometry, not the math */
      try{
        if(window._noRaycast){
          /* Raycasts off — use math for ground */
          try{
            var _mgy = fortifiedGroundY(mePos.x, mePos.z);
            /* Deck landing — the ship platform */
            if(window._deckZone){
              var _dz = window._deckZone;
              var _ddx = mePos.x - _dz.x, _ddz = mePos.z - _dz.z;
              if(Math.sqrt(_ddx*_ddx + _ddz*_ddz) < _dz.r && mePos.y < _dz.y + 0.5 && mePos.y > _dz.y - 5){
                _mgy = Math.max(_mgy, _dz.y);
              }
            }
            /* Hall landing — the main circle */
            if(window._hallZone){
              var _hz = window._hallZone;
              var _hdx = mePos.x - _hz.x, _hdz = mePos.z - _hz.z;
              if(Math.sqrt(_hdx*_hdx + _hdz*_hdz) < _hz.r && mePos.y < _hz.y + 0.5 && mePos.y > _hz.y - 5){
                _mgy = Math.max(_mgy, _hz.y);
              }
            }
            if(mePos.y < _mgy + 0.15){ mePos.y = _mgy + 0.15; if(meVel.y < 0) meVel.y = 0; onGround = true; }
          }catch(e){}
        }
        else if(typeof rayc !== 'undefined' && typeof THREE !== 'undefined' && typeof mePos !== 'undefined'){
          /* Shoot a ray down from above the player to find the true surface */
          rayc.set(new THREE.Vector3(mePos.x, mePos.y + 2, mePos.z), new THREE.Vector3(0, -1, 0));
          rayc.far = 10;
          /* Collect only solid world meshes — skip camera, lights, avatar, UI */
          var _targets = [];
          try{
            scene.traverse(function(o){
              if(!o.isMesh) return;
              if(o.isSprite) return; /* Sprites need a camera for raycast — skip */
              if(o === myAvatar) return;
              if(myAvatar && myAvatar.children && myAvatar.children.indexOf(o) >= 0) return;
              if(o.isCamera || o.isLight || o.isHelper) return;
              if(!o.geometry || !o.material) return;
              if(o.visible === false) return;
              /* Must have valid world matrix */
              try{ o.updateWorldMatrix(true, false); }catch(e){ return; }
              if(!o.matrixWorld) return;
              _targets.push(o);
              if(_targets.length > 200) return; /* cap for performance */
            });
          }catch(e){ _targets = []; }
          var _gh = [];
          try{
            if(_targets.length > 0) _gh = rayc.intersectObjects(_targets, false);
          }catch(e){ _gh = []; }
          if(_gh.length > 0){
            var _gy = _gh[0].point.y;
            /* Never below the true surface — walking or flying */
            if(mePos.y < _gy + 0.15){
              var _fallSpeed = -meVel.y;
              mePos.y = _gy + 0.15;
              if(meVel.y < 0) meVel.y = 0;
              onGround = true;
              /* Fall damage in player mode */
              if(_fallSpeed > 8 && !window._creatorMode && !window._isAdmin){
                window._soliditronium = Math.max(0, (window._soliditronium || 100) - _fallSpeed);
                if(typeof window.showVitals === 'function') window.showVitals();
              }
            }
          } else {
            /* No ground found below — fall back to math */
            var _mgy = fortifiedGroundY(mePos.x, mePos.z);
            if(mePos.y < _mgy + 0.1 && !FLYM){
              mePos.y = _mgy + 0.1;
              if(meVel.y < 0) meVel.y = 0;
              onGround = true;
            }
          }
        }
      }catch(e){}
        /* Object solidity: raycast down to find what you're standing on */
        if(typeof rayc !== 'undefined' && typeof THREE !== 'undefined'){
          rayc.set(new THREE.Vector3(mePos.x, mePos.y + 1, mePos.z), new THREE.Vector3(0, -1, 0));
          rayc.far = 3;
          var _hits = [];
          try{
            /* Filter sprites — they crash the raycast wi