<!-- RUBY-BACKUP · part 415 -->

  loadPad();
  var c = document.getElementById('continuum');
  if(!c){
    c = document.createElement('div');
    c.id = 'continuum';
    c.style.cssText = 'position:fixed;bottom:10px;left:10px;z-index:9999;background:rgba(10,0,20,0.9);border:2px solid #ff00ff;border-radius:12px;padding:12px;color:#fff;font:12px monospace;max-width:350px;';
    document.body.appendChild(c);
  }
  c.style.display = c.style.display==='block' ? 'none' : 'block';
  if(c.style.display==='block') renderContinuum();
}
function renderContinuum(){
  var c = document.getElementById('continuum');
  if(!c) return;
  var html = '<b style="color:#f0f">CONTINUUM</b> <button onclick="showContinuum()">CLOSE</button><br><br>';
  /* your pad */
  html += '<b>Your Pad:</b><br>';
  if(DESK_PAD.length===0) html += '<i>empty — visit the Soliditronium dome to gather codes</i><br>';
  DESK_PAD.forEach(function(code){
    html += '<button onclick="runCodeByName(\''+code+'\')" style="margin:2px">'+code+'</button> ';
  });
  /* context-aware: suggest based on vicinity */
  html += '<br><br><b>Nearby suggests:</b><br>';
  var suggests = suggestForVicinity();
  if(suggests.length===0) html += '<i>move near objects to see suggestions</i>';
  suggests.forEach(function(s){
    html += '<button onclick="runCodeByName(\''+s.code+'\')" style="margin:2px;background:#303">'+s.code+' <small>('+s.why+')</small></button> ';
  });
  c.innerHTML = html;
}
function runCodeByName(code){
  /* run a code as if typed */
  if(typeof runLine==='function') runLine(code);
  else if(typeof handleCode==='function') handleCode(code);
  else if(typeof doCode==='function') doCode(code);
  else codeStatus('cannot run '+code);
}
function suggestForVicinity(){
  var out = [];
  if(typeof mePos==='undefined' || typeof stoneAt==='undefined') return out;
  var px = Math.round(mePos.x), pz = Math.round(mePos.z);
  var nearStone = false, nearConn = false, nearDome = false;
  for(var dx=-3; dx<=3; dx++){
    for(var dz=-3; dz<=3; dz++){
      if(stoneAt(px+dx, pz+dz, 0)) nearStone = true;
    }
  }
  /* near dome? */
  var ddx = mePos.x-25, ddz = mePos.z-25;
  if(Math.sqrt(ddx*ddx+ddz*ddz) < 8) nearDome = true;
  /* near a connection? (check CONN_LIST) */
  if(typeof CONN_LIST!=='undefined'){
    CONN_LIST.forEach(function(pos){
      if(Math.abs(pos.x-px)<3 && Math.abs(pos.z-pz)<3) nearConn = true;
    });
  }
  if(nearStone){
    out.push({code:'movemode', why:'stone nearby'});
    out.push({code:'fillgaps', why:'gaps nearby'});
  }
  if(nearConn){
    out.push({code:'conncolor', why:'connection nearby'});
    out.push({code:'recolor', why:'connection nearby'});
  }
  if(nearDome){
    out.push({code:'enter', why:'at the dome'});
  }
  if(!nearStone && !nearConn && !nearDome){
    out.push({code:'spawnpt', why:'open space'});
    out.push({code:'holomap', why:'navigate'});
  }
  return out;
}

/* SCYFY — another form of wifi, sci-fi wireless */
var SCYFY_ARCHIVE = [];
function scyfyTransmit(){
  loadPad();
  if(DESK_PAD.length===0){
    codeStatus('Continuum empty — nothing to transmit');
    return;
  }
  var count = DESK_PAD.length;
  /* archive at the Soliditronium */
  try{
    var arch = JSON.parse(localStorage.getItem('ruby-scyfy-archive')||'[]');
    DESK_PAD.forEach(function(code){
      if(arch.indexOf(code)<0) arch.push(code);
    });
    localStorage.setItem('ruby-scyfy-archive', JSON.stringify(arch));
    SCYFY_ARCHIVE = arch;
  }catch(e){}
  /* visual: beam from player to dome */
  scyfyBeam();
  /* clear the pad — data returns to the source */
  try{ if(typeof DESK_PAD!=='undefined' && DESK_PAD.length > 0 && typeof continuumSpent==='function'){ for(var _i=0;_i<DESK_PAD.length;_i++) continuumSpent(); } }catch(e){}
  DESK_PAD = [];
  try{ localStorage.setItem('ruby-chartpad','[]'); }catch(e){}
  codeStatus('scyfy transmitted '+count+' codes back to the Soliditronium — the ancestors receive them');
  if(typeof renderContinuum==='function') renderContinuum();
}
function scyfyBeam(){
  /* cyan beam particles from player toward dome */
  if(typeof THREE==='undefined' || typeof scene==='undefined') return;
  if(typeof mePos==='undefined') return;
  var start = new THREE.Vector3(mePos.x*0.13, 2, mePos.z*0.13);
  var end = new THREE.Vector3(25*0.13, 3, 25*0.13);
  var geo = new THREE.BufferGeometry().setFromPoints([start, end]);
  var mat = new THREE.LineBasicMaterial({color: 0x00ffff, transparent: true, opacity: 0.9});
  var beam = new THREE.Line(geo, mat);
  scene.add(beam);
  /* fade and remove */
  var op = 0.9;
  var iv = setInterval(function(){
    op -= 0.1;
    mat.opacity = op;
    if(op<=0){ scene.remove(beam); clearInterval(iv); }
  }, 100);
  codeStatus('scyfy beam — wireless to the dome');
}
function scyfyStatus(){
  try{
    var arch = JSON.parse(localStorage.getItem('ruby-scyfy-archive')||'[]');
    codeStatus('scyfy archive at Soliditronium: '+arch.length+' codes returned by travelers');
  }catch(e){
    codeStatus('scyfy archive e