<!-- RUBY-BACKUP · part 443 -->
 = document.createElement('div');
  div.id = 'quest-hud';
  div.style.cssText = 'position:fixed;top:20px;left:50%;transform:translateX(-50%);z-index:9999;background:rgba(20,20,40,0.9);border:3px solid #ffcc00;border-radius:10px;padding:15px 25px;color:#fff;font-family:Arial;text-align:center;max-width:80%;';
  div.innerHTML = '<div style="color:#ffcc00;font-weight:bold;font-size:18px;">SIDE QUEST #'+q.id+'</div><div style="margin-top:8px;"><b>'+q.giver+':</b> <i>'+q.text+'</i></div><div style="margin-top:8px;font-size:12px;color:#aaa;">'+q.loc+' — type "questdone" when complete</div>';
  document.body.appendChild(div);
  /* auto-hide after 10s */
  setTimeout(function(){ var d=document.getElementById('quest-hud'); if(d) d.style.opacity='0.7'; }, 10000);
  codeStatus('quest #'+q.id+' — '+q.giver+': '+q.text);
  /* fill Continuum */
  try{ questToContinuum(q); }catch(e){}
  return q;
}
function completeQuest(){
  if(ACTIVE_QUEST){
    var q = ACTIVE_QUEST;
    ACTIVE_QUEST = null;
    var d = document.getElementById('quest-hud');
    if(d) d.remove();
    codeStatus('quest #'+q.id+' complete! Mahalo.');
  }else{
    codeStatus('no active quest — type "quest" for one');
  }
}
/* quests fill the Continuum to max 25 */
function questToContinuum(quest){
  if(typeof DESK_PAD==='undefined') return;
  /* map quest location to useful codes */
  var locCodes = {
    'city': ['city', 'ancestors', 'officer', 'purposes'],
    'dark': ['dark', 'quest'],
    'plaza': ['plaza', 'play'],
    'rural': ['rural'],
    'tribal': ['tribal'],
    'valley': ['valleys'],
    'terrain': ['wildterrain'],
    'wildlife': ['wildlife'],
    'spaceport': ['spaceport', 'hokulea', 'spacemission'],
    'cosmic': ['cosmic'],
    'all': ['ancestralcity'],
    'sky': ['cosmicsky']
  };
  var codes = locCodes[quest.loc] || ['quest'];
  codes.forEach(function(code){
    if(DESK_PAD.indexOf(code) < 0 && DESK_PAD.length < 25){
      DESK_PAD.push(code);
  try{ if(typeof continuumGathered==='function') continuumGathered(); }catch(e){}
    }
  });
  try{ localStorage.setItem('ruby-chartpad', JSON.stringify(DESK_PAD)); }catch(e){}
}
function fillContinuumMax(){
  if(typeof DESK_PAD==='undefined') return;
  /* essential codes for the full experience */
  var essentials = [
    'quest', 'ancestralcity', 'plaza', 'play', 'dark',
    'city', 'rural', 'tribal', 'valleys', 'wildterrain',
    'wildlife', 'spaceport', 'hokulea', 'cosmic',
    'ancestors', 'officer', 'spacemission', 'stranger',
    'continuum', 'dome', 'capsule', 'decree',
    'kidmode', 'tutorial', 'avatars'
  ];
  essentials.forEach(function(code){
    if(DESK_PAD.indexOf(code) < 0 && DESK_PAD.length < 25){
      DESK_PAD.push(code);
  try{ if(typeof continuumGathered==='function') continuumGathered(); }catch(e){}
    }
  });
  try{ localStorage.setItem('ruby-chartpad', JSON.stringify(DESK_PAD)); }catch(e){}
  codeStatus('Continuum filled to max — '+DESK_PAD.length+'/25');
  /* bonus unlocked! */
  if(DESK_PAD.length >= 25) unlockBonus();
}
function listQuests(){
  codeStatus(SIDE_QUESTS.length+' side quests available. Type "quest" for a random one.');
}

/* SPACE TRAVEL MISSIONS + THE RICH STRANGER */
var SPACE_MISSIONS = [
  {id: 'S1', text: 'Board Hokulea. She will take you to the stars.', detail: 'Stand beneath her orbit. Look up. She will lower a beam.'},
  {id: 'S2', text: 'Chart the three wormholes. Map where they lead.', detail: 'Enter each paradox wormhole. Remember what you see.'},
  {id: 'S3', text: 'Count Hokulea orbits. She circles every 4 minutes.', detail: 'Time her. The pattern reveals a message.'},
  {id: 'S4', text: 'Land on the blue planet in the cosmic sky.', detail: 'The planet is far. The ship knows the way.'},
  {id: 'S5', text: 'Collect stardust from the nebula.', detail: 'Fly through the magenta cloud. Your hull will glow.'},
  {id: 'S6', text: 'Race a spaceship around the city.', detail: 'Launch from the spaceport. Three laps. Do not hit the towers.'},
  {id: 'S7', text: 'Deliver a message to the orbit.', detail: 'Hokulea carries letters between worlds. Write one.'},
  {id: 'S8', text: 'Repair the landing pad lights.', detail: 'One beacon is dim. Find which. Fix it.'},
  {id: 'S9', text: 'Escort the mother ship through the storm.', detail: 'The storm beach reaches orbit. Guide her through.'},
  {id: 'S10', text: 'Find the star that fell.', detail: 'It is in the rough terrain, pretending to be a rock.'}
];
function spaceMission(){
  var m = SPACE_MISSIONS[Math.floor(Math.random()*SPACE_MISSIONS.length)];
  var div = document.createElement('div');
  var existing = document.getElementById('quest-hud');
  if(existing) existing.remove();
  div.id = 'quest-hud';
  div.style.cssText = 'position:fixed;top:20px;left:50%;transform:translateX(-50%);z-index:9999;background:rgba(5,10,30,0.95);border:3px solid #00ffff;border-radius:10px;padding:15px 25px;color:#fff;font-family:Arial;text-align:center;max-width:85%;';
  div.innerHTML = '<div style