<!-- SOLID CITY · part 1958 -->
titude+=clamp(targetAlt-ai.altitude,-dt*1.18,dt*1.18);ai.corridorX+=clamp(targetX-ai.corridorX,-dt*.45,dt*.45)}}
    var urgent=null;corridorThreats.forEach(function(t){if(!t.cleared&&t.z<.38&&t.z>.07&&Math.abs(t.x-human.corridorX)<.34&&Math.abs(t.band-human.altitude)<.42&&(!urgent||t.z<urgent.z))urgent=t});
    if(armEl.checked&&urgent&&!input0.active){var escape=urgent.band>=0?-1:1;human.altitude+=clamp(escape-human.altitude,-dt*2.2,dt*2.2);if(!urgent.assisted){urgent.assisted=true;metrics.avoided++;logA('corridor assist · moved '+ships[0].label+' '+bandName(escape));notify(0,'EVADE ASSIST · '+bandName(escape),650)}}
    ships.forEach(function(s){s.x=1200+s.corridorX*520;s.y=800-s.altitude*360;s.vx=0;s.vy=0});updateFlight(dt);
    corridorStars.forEach(function(s){s.z-=dt*(.72+s.r*.06);if(s.z<.025){s.z=1;s.x=Math.random()*2-1;s.y=Math.random()*2-1}});
    progression.corridorRunT-=dt;if(progression.corridorRunT<=0&&progression.corridorCleared<24){progression.corridorRunT=2.15;spawnCorridorRun()}
    ships.forEach(function(s,i){if(!s.alive){s.respawn-=dt;if(s.respawn<=0){s.alive=true;s.hull=s.maxHull;s.altitude=0;s.corridorX=i?0.22:-.22;notify(i,'BACK IN THE CORRIDOR',850)}return}var now=performance.now();if(s.shieldCharges>0&&now>=s.shieldUntil)breakShield(s);if(s.build.bio>0&&s.hull<s.maxHull)s.hull=Math.min(s.maxHull,s.hull+dt*(.45+s.build.bio*.35));autoFire(s,i,dt);if(i===0)manualFire(s,i,dt)});
    corridorShots.forEach(function(s){s.life-=dt;s.z+=dt*1.7;var target=corridorThreats.find(function(t){return t.id===s.target&&!t.cleared});if(target&&flight.mode==='formation'){s.x+=(target.x-s.x)*dt*3.2;s.alt+=(target.band-s.alt)*dt*3.2}corridorThreats.forEach(function(t){if(t.cleared||s.life<=0)return;if(Math.abs(t.z-s.z)<.075&&Math.abs(t.x-s.x)<t.r&&Math.abs(t.band-s.alt)<.34){s.life=0;t.hull-=flight.mode==='formation'?2:1;if(t.hull<=0){t.cleared=true;progression.corridorCleared++;metrics.kills++;ships[s.owner].score+=100;metrics.coordinated+=flight.mode==='formation'?1:0;dropCorridorPower(t);notify(s.owner,flight.mode==='formation'?'FORMATION STRIKE':'HEAD-ON HIT',420)}}})});
    corridorThreats.forEach(function(t){if(t.cleared)return;t.phase+=dt*(t.type==='enemy'?4:1.7);if(t.type==='enemy')t.x+=Math.sin(t.phase)*dt*.045;t.z-=dt*(.255+Math.min(.11,levelElapsed*.0025));if(t.z<=.045){var hit=false;ships.forEach(function(s,i){if(s.alive&&Math.abs(t.x-s.corridorX)<t.r+.13&&Math.abs(t.band-s.altitude)<.38){damage(s,i,t.type==='enemy'?27:36,t.type==='enemy'?'attack run':'meteor');hit=true}});t.cleared=true;progression.corridorCleared++;if(!hit){ships[0].score+=30;ships[1].score+=30}}});
    corridorPickups.forEach(function(p){if(p.collected)return;p.phase+=dt*3;p.z-=dt*.22;var bestShip=nearestCorridorShip(p);if(bestShip&&p.z<.2&&Math.abs(p.x-bestShip.s.corridorX)<.26&&Math.abs(p.band-bestShip.s.altitude)<.38){p.collected=true;collectPower({type:p.type,component:false,life:1},bestShip.s,bestShip.i)}if(p.z<0)p.collected=true});
    corridorShots=corridorShots.filter(function(s){return s.life>0&&s.z<1.18});corridorThreats=corridorThreats.filter(function(t){return !t.cleared});corridorPickups=corridorPickups.filter(function(p){return !p.collected});
    objectiveEl.textContent='THREAD THE CORRIDOR · '+Math.min(24,progression.corridorCleared)+' / 24 · '+bandName(human.altitude);speedValueEl.textContent=String(Math.min(599,390+Math.round(levelElapsed*4))).padStart(3,'0');speedBarEl.style.setProperty('--speed','100%');if(progression.corridorCleared>=24&&levelElapsed>16)completeLevel()
  }
  function nearestCorridorShip(p){var best=null,bd=9;ships.forEach(function(s,i){if(!s.alive)return;var d=Math.abs(p.x-s.corridorX)+Math.abs(p.band-s.altitude);if(d<bd){bd=d;best={s:s,i:i}}});return best}
  function updateLevelSystems(dt){
    if(level===2||level===4){
      [0,1].forEach(function(owner){if(!rings.some(function(r){return r.owner===owner}))spawnSpeedRing(owner)});
      rings.forEach(function(r){r.phase+=dt*2;var s=ships[r.owner];if(s.alive&&distObj(r,s)<r.r+18){s.ringScore++;s.speedBank=Math.min(100,s.speedBank+42);r.life=0;notify(r.owner,'SPEED BANKED '+s.ringScore+'/3',700);burst(r.x,r.y,s.color,18)}});rings=rings.filter(function(r){return r.life!==0});
    }
    if(level===2){
      var p=progression.pursuer,target=ships[0].ringScore<ships[1].ringScore?ships[0]:ships[1];if(p){steer(p,target.x,target.y,dt,285);var pl=Math.hypot(p.vx,p.vy);if(pl>315){p.vx=p.vx/pl*315;p.vy=p.vy/pl*315}p.a=Math.atan2(p.vy,p.vx);p.x=wrapX(p.x+p.vx*dt);p.y=wrapY(p.y+p.vy*dt);ships.forEach(function(s,i){if(distObj(p,s)<58&&performance.now()-p.lastHit>700){p.lastHit=performance.now();damage(s,i,24,'pursuer');s.speedBank=Math.max(0,s.speedBank-30);var dx=delta(s.x,p.x,WORLD.w),dy=delta(s.y,p.y,WORLD.h),d=Math.hypot(dx,dy)||1;s.vx+=dx/d*180;s.vy+=dy/d*180;notify(i,'OUTRUN IT',600)}})}
      var fast=ships.every(function(s){return s.ringScore>=3&&Math.hypot(s.vx,s.vy)>=SPEED_TARGET});progression.speedHold=fa