<!-- RUBY-BACKUP · part 568 -->
    }catch(e){}
      }
      var msg = 'captured ' + n + ' of ' + ns.length + ' nodes';
      if(typeof codeStatus==='function') codeStatus(msg);
      return msg;
    }catch(e){ return 'capture failed: ' + e.message; }
  };

  // The network: all solid nodes linked
  var nodeNetwork = null;

  window.connectAll = function(){
    try{
      var ids = Object.keys(solidNodes);
      if(ids.length < 2) return 'need 2+ solid nodes — capture all first';
      // Build the network: every node linked to every other
      nodeNetwork = {members: ids.slice(), links: []};
      for(var i=0;i<ids.length;i++){
        for(var j=i+1;j<ids.length;j++){
          nodeNetwork.links.push([ids[i], ids[j]]);
          // Mark each pair as portal-linked for instant travel
          try{
            var a = solidNodes[ids[i]], b = solidNodes[ids[j]];
            a.portals = a.portals || []; b.portals = b.portals || [];
            if(a.portals.indexOf(ids[j])<0) a.portals.push(ids[j]);
            if(b.portals.indexOf(ids[i])<0) b.portals.push(ids[i]);
          }catch(e){}
        }
      }
      // Shared mode: set all to SOLID platforms (the network ground)
      for(var k=0;k<ids.length;k++){
        try{ window.setNodeMode(ids[k], 'solid'); }catch(e){}
      }
      var msg = 'connected ' + ids.length + ' nodes — ' + nodeNetwork.links.length + ' links, one network';
      if(typeof codeStatus==='function') codeStatus(msg);
      return msg;
    }catch(e){ return 'connect failed: ' + e.message; }
  };

  window.disconnectAll = function(){
    try{
      var n = 0;
      for(var nid in solidNodes){
        try{
          var sn = solidNodes[nid];
          if(sn.portals){ n += sn.portals.length; sn.portals = []; }
        }catch(e){}
      }
      nodeNetwork = null;
      var msg = 'network dissolved — ' + n + ' links cut';
      if(typeof codeStatus==='function') codeStatus(msg);
      return msg;
    }catch(e){ return 'disconnect failed'; }
  };

  window.networkStatus = function(){
    if(!nodeNetwork) return 'no network — connect all first';
    return nodeNetwork.members.length + ' nodes, ' + nodeNetwork.links.length + ' links';
  };
  try{ console.log('[solidify] ready'); }catch(e){}
  /* chain into runLine: stand, solidify, nodes */
  try{
    window.__doSolidHook = function(){
      if(typeof window.runLine !== 'function' || window.runLine.__solidHooked) return false;

      var origRL = window.runLine;
      window.runLine = function(line){
        try{
          var tl = String(line||'').trim().toLowerCase();
          if(tl.indexOf('stand ')===0){
            var nid = String(line).trim().slice(6).trim();
            var r = window.standOn(nid);
            if(typeof codeStatus==='function') codeStatus(r);
            return true;
          }
          if(tl.indexOf('solidify ')===0){
            var nid2 = String(line).trim().slice(9).trim();
            var r2 = window.solidifyNode(nid2);
            if(typeof codeStatus==='function') codeStatus(r2);
            return true;
          }
          if(tl.indexOf('latch ')===0){
            var nid3 = String(line).trim().slice(6).trim();
            var r3 = window.latchNode(nid3);
            if(typeof codeStatus==='function') codeStatus(r3);
            return true;
          }
          if(tl.indexOf('solid ')===0){
            var nid4 = String(line).trim().slice(6).trim();
            var r4 = window.solidNode(nid4);
            if(typeof codeStatus==='function') codeStatus(r4);
            return true;
          }
          if(tl==='capture all'){
            var r5 = window.captureAll();
            return true;
          }
          if(tl==='connect all'){
            var r6 = window.connectAll();
            return true;
          }
          if(tl==='disconnect all'){
            var r7 = window.disconnectAll();
            return true;
          }
          if(tl==='network'){
            var r8 = window.networkStatus();
            if(typeof codeStatus==='function') codeStatus(r8);
            return true;
          }
          if(tl==='nodes'){
            var codes = window.solidCodes();
            var msg = (typeof codes==='string') ? codes : (codes.length+' nodes ready');
            if(typeof codeStatus==='function') codeStatus(msg);
            return true;
          }
        }catch(e){}
        return origRL.apply(this, arguments);
      };
      window.runLine.__solidHooked = true;
    
      return true;
    };
    /* register with the hook manager — the one script to bind them all */
    (function(){
      function reg(){
        try{
          if(typeof window.registerHook === 'function'){
            window.registerHook('solid', window.__doSolidHook);
            return;
          }
        }catch(e){}
        setTimeout(reg, 500);
      }
      setTimeout(reg, 300);
      /* fallback: own retry in case manager is missing */
      var tries = 0;
      function attempt(){
        tries++;
        try{ if(