<!-- SOLID CITY · part 1833 -->

  function drawView(ctx,c,cam,index){var d=c._d||1,w=c._w||1,h=c._h||1;ctx.setTransform(d,0,0,d,0,0);ctx.clearRect(0,0,w,h);if(level===5){drawCorridorView(ctx,w,h,index);return}var g=ctx.createRadialGradient(w*.5,h*.45,10,w*.5,h*.5,Math.max(w,h));g.addColorStop(0,'#111b2b');g.addColorStop(1,'#02040a');ctx.fillStyle=g;ctx.fillRect(0,0,w,h);var baseScale=Math.max(.68,Math.min(1.05,Math.min(w/700,h/500))),scale=level===3?baseScale/(1+(progression.expansionStage-1)*.22):baseScale;
    nebula.forEach(function(n){var p=worldToScreen(n,cam,w,h,scale);ctx.beginPath();ctx.fillStyle=n.c;ctx.arc(p.x,p.y,n.r*scale,0,6.28);ctx.fill()});
    stars.forEach(function(s){var p=worldToScreen(s,cam,w,h,scale);if(p.x>-3&&p.x<w+3&&p.y>-3&&p.y<h+3){ctx.globalAlpha=s.a;ctx.fillStyle='#d8e9ff';ctx.fillRect(p.x,p.y,s.r,s.r)}});ctx.globalAlpha=1;
    hazards.forEach(function(q){if(progression.expansionStage<q.stage)return;var p=worldToScreen(q,cam,w,h,scale);if(onScreen(p,w,h,q.r*scale)){ctx.save();ctx.globalAlpha=.13+.04*Math.sin(elapsed*3);ctx.fillStyle=q.color;ctx.strokeStyle=q.color;ctx.lineWidth=2;ctx.beginPath();ctx.arc(p.x,p.y,q.r*scale,0,6.28);ctx.fill();ctx.setLineDash([7,9]);ctx.stroke();ctx.restore()}});
    rings.forEach(function(q){var p=worldToScreen(q,cam,w,h,scale);if(onScreen(p,w,h,45))drawSpeedRing(ctx,p,q,scale)});
    if(progression.pursuer){var p=worldToScreen(progression.pursuer,cam,w,h,scale);if(onScreen(p,w,h,70))drawPursuer(ctx,p,progression.pursuer,scale)}
    meteors.forEach(function(m){var p=worldToScreen(m,cam,w,h,scale);if(onScreen(p,w,h,50))drawMeteor(ctx,p,m,scale)});
    pickups.forEach(function(q){var p=worldToScreen(q,cam,w,h,scale);if(onScreen(p,w,h,30))drawPickup(ctx,p,q,scale)});
    enemies.forEach(function(e){var p=worldToScreen(e,cam,w,h,scale);if(onScreen(p,w,h,e===progression.boss?80:30)){if(e===progression.boss)drawBoss(ctx,p,e,scale);else drawDrone(ctx,p,e,scale)}});
    shots.forEach(function(s){var p=worldToScreen(s,cam,w,h,scale);if(onScreen(p,w,h,10)){ctx.strokeStyle=s.color;ctx.lineWidth=2;ctx.beginPath();ctx.moveTo(p.x,p.y);ctx.lineTo(p.x-s.vx*.025,p.y-s.vy*.025);ctx.stroke()}});
    bolts.forEach(function(b){var p=worldToScreen(b,cam,w,h,scale);if(onScreen(p,w,h,10)){ctx.fillStyle='#ff4864';ctx.shadowColor='#ff264d';ctx.shadowBlur=8;ctx.beginPath();ctx.arc(p.x,p.y,4,0,6.28);ctx.fill();ctx.shadowBlur=0}});
    sparks.forEach(function(s){var p=worldToScreen(s,cam,w,h,scale);if(onScreen(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.textA