<!-- SOLID CITY · part 1926 -->
n(p,w,h,6)){ctx.globalAlpha=Math.min(1,s.life*2);ctx.fillStyle=s.color;ctx.fillRect(p.x,p.y,2,2)}});ctx.globalAlpha=1;
    muzzles.forEach(function(m){var p=worldToScreen(m,cam,w,h,scale);if(onScreen(p,w,h,12)){ctx.globalAlpha=Math.min(1,m.life*10);ctx.fillStyle='#fff7c5';ctx.shadowColor=m.color;ctx.shadowBlur=16;ctx.beginPath();ctx.arc(p.x,p.y,4+m.life*35,0,6.28);ctx.fill();ctx.shadowBlur=0}});ctx.globalAlpha=1;
    if(level>=3){ctx.save();ctx.strokeStyle=level===4&&flight.mode==='formation'?'#44e1d055':'#ffffff18';ctx.lineWidth=1;ctx.setLineDash([3,8]);ctx.beginPath();ctx.arc(w/2,h/2,(level===3?140:180)+(progression.expansionStage-1)*34,0,6.28);ctx.stroke();ctx.restore()}
    drawTogetherness(ctx,cam,w,h,scale,index);
    ships.forEach(function(s,si){if(!s.alive)return;var p=worldToScreen(s,cam,w,h,scale);if(onScreen(p,w,h,55))drawShip(ctx,p,s,scale,si===index)});
    if(index===0&&armEl.checked){ctx.strokeStyle='#ffc84a20';ctx.setLineDash([4,6]);ctx.beginPath();ctx.arc(w/2,h/2,82,0,6.28);ctx.stroke();ctx.setLineDash([])}
    ctx.fillStyle='rgba(0,0,0,.16)';ctx.fillRect(0,0,w,28);ctx.fillRect(0,h-18,w,18)
  }
  function drawTogetherness(ctx,cam,w,h,scale,index){
    if(!ships[0].alive||!ships[1].alive)return;var partner=ships[index?0:1],p=worldToScreen(partner,cam,w,h,scale),now=performance.now();
    if(flight.mode==='formation'){
      var self=worldToScreen(ships[index],cam,w,h,scale),pulse=.22+Math.sin(elapsed*5)*.06;ctx.save();ctx.strokeStyle='rgba(112,239,220,'+pulse+')';ctx.lineWidth=1.4;ctx.setLineDash([5,7]);ctx.beginPath();ctx.moveTo(self.x,self.y);ctx.lineTo(p.x,p.y);ctx.stroke();ctx.setLineDash([]);
      if(now<flight.reunionUntil){var q=1-(flight.reunionUntil-now)/1500;ctx.globalAlpha=Math.max(0,1-q);ctx.strokeStyle='#fff2a8';ctx.lineWidth=2;ctx.beginPath();ctx.arc(self.x,self.y,35+q*90,0,6.28);ctx.stroke()}ctx.restore();return
    }
    var dx=delta(partner.x,cam.x,WORLD.w),dy=delta(partner.y,cam.y,WORLD.h),a=Math.atan2(dy,dx),pad=32,cx=w/2,cy=h/2,ux=Math.cos(a),uy=Math.sin(a),tx=Math.abs(ux)>.001?(w/2-pad)/Math.abs(ux):1e9,ty=Math.abs(uy)>.001?(h/2-pad)/Math.abs(uy):1e9,t=Math.min(tx,ty),x=cx+ux*t,y=cy+uy*t;
    ctx.save();ctx.translate(x,y);ctx.rotate(a);ctx.fillStyle=index?'#ffc84a':'#44e1d0';ctx.shadowColor=ctx.fillStyle;ctx.shadowBlur=10;ctx.beginPath();ctx.moveTo(13,0);ctx.lineTo(-8,-7);ctx.lineTo(-4,0);ctx.lineTo(-8,7);ctx.closePath();ctx.fill();ctx.shadowBlur=0;ctx.rotate(-a);ctx.fillStyle='#fff';ctx.font='900 9px ui-monospace,monospace';ctx.textAlign=ux<-.3?'left':ux>.3?'right':'center';ctx.textBaseline=uy<0?'bottom':'top';ctx.fillText('HOME '+Math.round(flight.lastDistance),ux<-.3?12:ux>.3?-12:0,uy<0?13:-13);ctx.restore()
  }
  function onScreen(p,w,h,m){return p.x>-m&&p.x<w+m&&p.y>-m&&p.y<h+m}
  function drawShip(ctx,p,s,scale,focus){var now=performance.now();ctx.save();ctx.translate(p.x,p.y);ctx.scale(scale,scale);if(s.shieldCharges>0&&now<s.shieldUntil){var pulse=2+Math.sin(elapsed*7)*2;ctx.fillStyle='rgba(70,224,255,.08)';ctx.strokeStyle=now<s.shieldHitUntil?'#ffffff':'#6ef2ff';ctx.lineWidth=now<s.shieldHitUntil?4:1.6;ctx.shadowColor='#38dfff';ctx.shadowBlur=10+pulse;ctx.beginPath();ctx.arc(0,0,31+pulse,0,6.28);ctx.fill();ctx.stroke();ctx.shadowBlur=0;if(now<s.shieldRingUntil){var q=1-(s.shieldRingUntil-now)/700;ctx.globalAlpha=1-q;ctx.lineWidth=2;ctx.beginPath();ctx.arc(0,0,35+q*40,0,6.28);ctx.stroke();ctx.globalAlpha=1}if(now<s.shieldHitUntil){ctx.strokeStyle='#fff';ctx.lineWidth=1;for(var z=0;z<4;z++){var a=z*1.5+elapsed*2;ctx.beginPath();ctx.moveTo(Math.cos(a)*24,Math.sin(a)*24);ctx.lineTo(Math.cos(a+.14)*34,Math.sin(a+.14)*34);ctx.lineTo(Math.cos(a-.08)*39,Math.sin(a-.08)*39);ctx.stroke()}}}else if(now<s.shieldShatterUntil){ctx.globalAlpha=Math.max(0,(s.shieldShatterUntil-now)/500);ctx.strokeStyle='#6ef2ff';ctx.setLineDash([4,6]);ctx.beginPath();ctx.arc(0,0,34+(1-ctx.globalAlpha)*28,0,6.28);ctx.stroke();ctx.setLineDash([]);ctx.globalAlpha=1}ctx.rotate(s.a);if(s.build.bio>0){ctx.save();ctx.strokeStyle='#7dff96';ctx.lineWidth=1.5+s.build.bio*.5;ctx.shadowColor='#46ff77';ctx.shadowBlur=8;for(var t=-1;t<=1;t+=2){ctx.beginPath();ctx.moveTo(-5,t*7);ctx.bezierCurveTo(-17,t*(13+s.build.bio*3),-25,t*(7+s.build.bio*5),-31-s.build.bio*4,t*(12+s.build.bio*3));ctx.stroke()}ctx.globalAlpha=.45+.15*Math.sin(elapsed*4);ctx.fillStyle='#7dff96';ctx.beginPath();ctx.ellipse(-2,0,8+s.build.bio*2,4+s.build.bio,0,0,6.28);ctx.fill();ctx.restore()}ctx.shadowColor=s.color;ctx.shadowBlur=focus?14:8;ctx.fillStyle=s.color;ctx.beginPath();ctx.moveTo(23,0);ctx.lineTo(-14,-12);ctx.lineTo(-8,0);ctx.lineTo(-14,12);ctx.closePath();ctx.fill();if(s.build.thruster>0){ctx.fillStyle=s.color;ctx.globalAlpha=.72;ctx.beginPath();ctx.moveTo(-7,-10);ctx.lineTo(-19-s.build.thruster*4,-18-s.build.thruster*2);ctx.lineTo(-14,-5);ctx.closePath();ctx.fill();ctx.beginPath();ctx.moveTo(-7,10);ctx.lineTo(-19-s.build.thruster*4,18+s.build.thruster*2);ctx.lineTo(-14,5);ctx.closePath();ctx.fill(