<!-- SOLID CITY · part 2899 -->
else if(state.anchor.phase==='hidden'&&p)setAdvice(p.id+' is '+Math.round(dist(s,p))+' meters away. Approach inside the rescue ring.');
      else if(state.anchor.phase==='hidden'&&!p)setAdvice('Waiting on human triage. Choose the next life at your command station.');
      adviceTimer=4;
    }
  }

  function beginAnchor(){
    if(state.anchor.phase!=='hidden')return;
    state.anchor.phase='scan';state.anchor.integrity=100;state.triageTarget=null;state.enemies=[];state.shots=[];
    $('#anchorMeter').classList.remove('hidden');recordEvent('anchorPhase',{phase:'scan',message:'Lantern Anchor is breaking apart.'});
    setAdvice('The ghost echo is a heartbeat. Lantern Anchor has one person aboard. Scanning the lower spine.');updateCommand();
  }
  function updateAnchor(dt){
    const a=state.anchor,s=state.ship;if(a.phase==='hidden'||a.phase==='done')return;
    const d=dist(s,a);
    if(a.phase==='scan'){
      if(d<150){a.scan=Math.min(100,a.scan+dt*24);if(a.scan>=100&&!a.scanReady){a.scanReady=true;setAdvice('Structural weakness located. Human command must mark the safe anchoring face.');updateCommand()}else if(Math.floor(a.scan)%12===0){const b=$('#commandActions button');if(b&&!a.scanReady)b.textContent='SCANNING '+Math.floor(a.scan)+'%'}}
    }else if(a.phase==='anchor'){
      a.integrity=Math.max(0,a.integrity-dt*2.15);
      if(state.anchorHeld&&d<125){a.hold=Math.min(100,a.hold+dt*15);a.lights=Math.max(a.lights,a.hold/100);if(a.hold>=45&&!a.lightsAnnounced){a.lightsAnnounced=true;const first=state.pods.find(p=>p.status==='rescued');setAdvice((first?first.id:'A survivor')+' reached the relay — lights are waking across the station, one by one.');recordEvent('lights',{by:first?first.id:'survivor'})}}
      if(a.hold>=100){state.anchorHeld=false;a.phase='choice';a.heartbeat.status='located';recordEvent('anchorPhase',{phase:'choice',message:'Fourth heartbeat confirmed: Iona.'});setAdvice('Fourth heartbeat confirmed. Iona is trapped below the fracture. This choice belongs to you.');updateCommand()}
    }else if(a.phase==='retrieve'){
      a.integrity=Math.max(0,a.integrity-dt*4.8);
      if(state.retrievalHeld&&d<130){a.retrieval=Math.min(100,a.retrieval+dt*18);s.hp=Math.max(1,s.hp-dt*1.7)}
      if(a.retrieval>=100){state.retrievalHeld=false;a.heartbeat.status='rescued';state.rescued++;a.phase='escape';s.hp=Math.max(22,s.hp-18);recordEvent('rescue',{pod:'Iona'});recordEvent('anchorPhase',{phase:'escape',message:'Iona is aboard. Lantern Anchor is falling.'});setAdvice('Iona aboard. Break away — the Anchor is collapsing behind us.');updateCommand()}
    }
    if((a.phase==='anchor'||a.phase==='retrieve')&&a.integrity<=0){
      state.anchorHeld=false;state.retrievalHeld=false;
      if(a.heartbeat.status!=='rescued'){a.heartbeat.status='lost';a.heartbeat.lostReason=a.phase==='retrieve'?'retrieval hold broke as Lantern Anchor collapsed':'Lantern Anchor collapsed before the crossing was secured';state.lost++;recordEvent('lost',{pod:'Iona'})}
      a.phase='escape';s.hp=Math.max(12,s.hp-24);setAdvice('Lantern Anchor collapsed. AI pilot is burning for the gate.');updateCommand();
    }
    if(a.phase==='escape'&&dist(s,state.gate)<state.gate.r+8)finishMission();
  }

  function updateWorld(dt){
    const s=state.ship;
    state.debris.forEach(d=>{d.x+=d.vx*dt;d.y+=d.vy*dt;if(d.x<170)d.x=850;if(d.y<60)d.y=530;if(d.y>540)d.y=70;if(dist(s,d)<d.r+15){damageShip(4*dt)}});
    state.hazards.forEach(h=>{h.spin+=dt*.35;if(dist(s,h)<h.r){damageShip(11*dt);if(s.cargo)s.cargo.hp-=7*dt}});
    if(state.anchor.phase==='hidden'&&spawnTimer<=0&&state.enemies.length<6){
      const livePods=state.pods.some(p=>p.status==='adrift'||p.status==='cargo');if(livePods){state.enemies.push({x:W+25,y:80+Math.random()*440,hp:36,vx:-22-Math.random()*14,phase:Math.random()*6});spawnTimer=5.5+Math.random()*3}
    }
    state.enemies.forEach(e=>{
      if(e.hp<=0)return;e.phase+=dt;e.x+=e.vx*dt;e.y+=Math.sin(e.phase*1.7)*15*dt;
      const target=state.ship.cargo?state.ship:(nearestPod()||state.ship),d=dist(e,target);if(d<185){e.x+=(target.x-e.x)/d*24*dt;e.y+=(target.y-e.y)/d*24*dt}
      if(dist(e,s)<30){damageShip(16*dt);e.hp=0}
      state.pods.filter(p=>p.status==='adrift').forEach(p=>{if(dist(e,p)<75)p.hp-=1.2*dt});
    });
    state.shots.forEach(sh=>{if(!sh.target||sh.target.hp<=0){sh.dead=true;return}const dx=sh.target.x-sh.x,dy=sh.target.y-sh.y,d=Math.max(1,Math.hypot(dx,dy));sh.x+=dx/d*470*dt;sh.y+=dy/d*470*dt;if(d<16){sh.target.hp-=18;sh.dead=true;if(sh.target.hp<=0)recordEvent('interception',{owner:sh.owner})}});
    state.shots=state.shots.filter(x=>!x.dead);state.enemies=state.enemies.filter(e=>e.hp>0&&e.x>-50);
    state.pods.forEach(p=>{if(state.anchor.phase==='hidden'&&p.status==='adrift')p.hp-=.34*dt;if(p.hp<=0&&p.status==='adrift'){p.hp=0;p.status='lost';p.lostReason='life support failed before the rescue vessel reached the pod';state.lost++;if(state.triageTarget===p.id)state.triageTarge