<!-- SOLID CITY · part 1956 -->
erBroke||distObj(s,human)>470;if(s.coverBroke)threat.rescueBroke=true;fx=threat.x;fy=threat.y;if(now>s.coverNotice){notify(1,'COVERING YOU',900);notify(0,'AI COVERING YOU',900);s.coverNotice=now+1200}}
    else if(s.coveringTarget===null&&distObj(s,human)>260){fx=human.x;fy=human.y}
    else if((level===2||level===4)&&ownRing){fx=ownRing.x;fy=ownRing.y}
    else if(power){fx=power.x;fy=power.y}
    else if(target&&distObj(s,target)<(level>=3?620:340)){fx=target.x;fy=target.y}
    else{var side=Math.sin(elapsed*.7)*70;fx=human.x+Math.cos(human.a+1.57)*side+115;fy=human.y+Math.sin(human.a+1.57)*side}
    var dodgeX=0,dodgeY=0;
    meteors.concat(bolts).forEach(function(o){var d=distObj(s,o);if(d<150){var dx=delta(s.x,o.x,WORLD.w),dy=delta(s.y,o.y,WORLD.h),q=(150-d)/150;dodgeX+=dx/(d||1)*q*3;dodgeY+=dy/(d||1)*q*3}});
    steer(s,fx,fy,dt,threat?390:315);s.vx+=dodgeX*330*dt;s.vy+=dodgeY*330*dt;s.actionTick++;
  }
  function drive(s,input,dt){if(!s.alive)return;var accel=520+s.build.thruster*85;s.vx+=input.x*accel*dt;s.vy+=input.y*accel*dt;s.actionTick++;if(input.active&&Math.hypot(s.vx,s.vy)>8)s.a=Math.atan2(s.vy,s.vx)}
  function assist(dt){
    if(!armEl.checked||!ships[0].alive||!ships[1].alive)return;
    var h=ships[0],human=humanInput(0),now=performance.now();
    meteors.forEach(function(m){
      if(m.resolved)return;var rx=delta(m.x,h.x,WORLD.w),ry=delta(m.y,h.y,WORLD.h),rvx=m.vx-h.vx,rvy=m.vy-h.vy,rv2=rvx*rvx+rvy*rvy;if(rv2<1)return;
      var t=-(rx*rvx+ry*rvy)/rv2;var cx=rx+rvx*t,cy=ry+rvy*t,miss=Math.hypot(cx,cy);
      if(t>0&&t<1.65&&miss<m.r+26){
        if(!m.threat){m.threat=true;metrics.threats[m.id]={shipTicks:[ships[0].actionTick,ships[1].actionTick],time:elapsed};logA('threat detected · meteor '+m.id);notify(0,'THREAT LOCK',650)}
        if(m.action==='none'){
          var d=Math.hypot(rx,ry);
          if(t>.64&&d<600&&distObj(ships[1],m)<190){m.action='intercept';logA('action · intercept meteor '+m.id);notify(1,'INTERCEPT',700);setTimeout(function(){if(running&&!m.resolved&&meteors.indexOf(m)>=0){burst(m.x,m.y,'#ffc84a',16);m.resolved=true;metrics.avoided++;awardRescue(m,1);logA('outcome · collision avoided');checkContinuity(m);meteors.splice(meteors.indexOf(m),1)}},220)}
          else if(!human.active){var side=(rx*rvy-ry*rvx)>0?1:-1,mag=260;h.assistVX=-rvy/(Math.hypot(rvx,rvy)||1)*side*mag;h.assistVY=rvx/(Math.hypot(rvx,rvy)||1)*side*mag;h.assistUntil=now+420;m.action='nudge';logA('action · emergency thruster nudge');notify(0,'EVADE ASSIST',900)}
        }
      }
    })
  }
  function checkContinuity(m){var t=metrics.threats[m.id];if(t){metrics.assistChecks++;if(ships[0].actionTick>t.shipTicks[0]&&ships[1].actionTick>t.shipTicks[1])metrics.assistContinuity++}}
  function buildTotal(s){return s.build.hull+s.build.cannon+s.build.thruster+s.build.bio}
  function dropComponent(x,y){
    var types=['hull','cannon','thruster','bio'],target=buildTotal(ships[0])<=buildTotal(ships[1])?0:1,type=types[progression.componentIndex++%types.length];
    if(ships[target].build[type]>=2){for(var i=0;i<types.length;i++)if(ships[target].build[types[i]]<2){type=types[i];break}}
    pickups.push({id:nextId++,type:type,component:true,target:target,x:x,y:y,vx:(Math.random()-.5)*45,vy:(Math.random()-.5)*45,phase:Math.random()*6.28,life:18})
  }
  function applyComponent(p,s,i){
    if(s.build[p.type]>=2)return;s.build[p.type]++;
    if(p.type==='hull'){s.maxHull+=25;s.hull=s.maxHull}
    if(p.type==='bio'){s.hull=Math.min(s.maxHull,s.hull+22)}
    var names={hull:'PLATING',cannon:'CANNON',thruster:'THRUSTER',bio:'BIO ADAPTATION'},solidity=buildTotal(s);notify(i,names[p.type]+' · SOLIDITY '+solidity+' / 8',1200);burst(s.x,s.y,p.type==='bio'?'#7dff96':s.color,26);p.life=0;
    var total=buildTotal(ships[0])+buildTotal(ships[1]);objectiveEl.textContent='SOLIDIVISM · '+total+' / 16';
    if(total>=16){objectiveEl.textContent='SHIPS SOLID';notify(0,'SHIP SOLID · WHOLE · UNBREAKABLE',1500);notify(1,'SHIP SOLID · WHOLE · UNBREAKABLE',1500);setTimeout(completeLevel,1500)}
  }
  function dropPower(x,y){if(Math.random()>.46)return;var r=Math.random(),type=r<.4?'shield':r<.62?'spread':r<.84?'rapid':'repair';pickups.push({id:nextId++,type:type,x:x,y:y,vx:(Math.random()-.5)*55,vy:(Math.random()-.5)*55,phase:Math.random()*6.28,life:14})}
  function collectPower(p,s,i){if(p.component){applyComponent(p,s,i);return}var now=performance.now();if(p.type==='shield'){s.shieldCharges=Math.min(5,s.shieldCharges+3);s.shieldUntil=now+12000;s.shieldRingUntil=now+700;notify(i,'SHIELD ONLINE',900);burst(s.x,s.y,'#6ef2ff',28)}else if(p.type==='spread'){s.spreadUntil=now+8000;notify(i,'TRIPLE SHOT',800);burst(s.x,s.y,'#ff9b57',18)}else if(p.type==='rapid'){s.rapidUntil=now+8000;notify(i,'RAPID FIRE',800);burst(s.x,s.y,'#fff26a',18)}else{s.hull=Math.min(s.maxHull,s.hull+38);s.repairUntil=now+1400;notify(i,'HULL REPAIRED',800);burst(s.x,s.y,'#72ff9d',18)}p.life=0}
  function fireShot(s,idx,manual){if(!s.ali