<!-- RUBY-BACKUP · part 454 -->
t.getElementById('return-mission');
  if(div) div.remove();
  /* remove from inventory */
  removeFromInventory('twin-crystal');
  codeStatus('the twin lightning is returned to the Soliditronium');
  unlockAchievement('Returned the Twin Lightning');
  /* the court searches him — cannot find it */
  setTimeout(function(){ courtSearch(); }, 3000);
}

/* THE GRID — the crystal cannot connect. He has no charger. */
function gridDesperation(){
  var div = document.createElement('div');
  div.id = 'grid-desperation';
  div.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:20000;background:rgba(5,15,25,0.97);border:3px solid #00ffff;border-radius:12px;padding:25px 40px;color:#fff;font-family:Georgia,serif;text-align:center;max-width:85%;';
  div.innerHTML = '<div style="color:#00ffff;font-weight:bold;font-size:20px;margin-bottom:15px;">WHY THEY MUST FIND IT</div>'
    + '<div id="grid-words" style="font-style:italic;font-size:17px;line-height:1.9;min-height:180px;text-align:left;"></div>';
  document.body.appendChild(div);
  var words = [
    'The twin lightning cannot connect to the grid.',
    'The grid is where everything is tracked. Controlled. Safe.',
    'But the crystal is backwards. It will not connect.',
    'It drains. It steals. It stays dark.',
    '',
    'He wants to connect to the grid.',
    'He wants to plug in. To be found. To be helped.',
    'But he has no charger.',
    'His pad is dead. The valley took it all.',
    '',
    '<span style="color:#ff6666;">That is why the court needs to find it.</span>',
    '<span style="color:#ff6666;">A thing that cannot be tracked, in the hands of a man who cannot call for help.</span>'
  ];
  var w = document.getElementById('grid-words');
  var i = 0;
  var wt = setInterval(function(){
    if(i < words.length){
      if(words[i]===''){
        w.innerHTML += '<div style="height:10px;"></div>';
      }else{
        w.innerHTML += '<div style="margin:8px 0;opacity:0;animation:fadein 1s forwards;">'+words[i]+'</div>';
      }
      i++;
    }else{
      clearInterval(wt);
      setTimeout(function(){
        var d = document.getElementById('grid-desperation');
        if(d) d.remove();
      }, 4000);
    }
  }, 1600);
}
function courtSearch(){
  gridDesperation();
  setTimeout(function(){
  var div = document.createElement('div');
  div.id = 'court-search';
  div.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:20000;background:rgba(25,5,5,0.97);border:3px solid #ff0000;border-radius:0;padding:25px 40px;color:#fff;font-family:Arial;text-align:center;max-width:85%;';
  div.innerHTML = '<div style="color:#ff0000;font-weight:bold;font-size:20px;margin-bottom:15px;">THE SEARCH</div>'
    + '<div id="search-words" style="font-size:16px;line-height:1.8;min-height:120px;"></div>';
  document.body.appendChild(div);
  var words = [
    'The officers search you.',
    'Pockets. Pack. Everywhere.',
    '<span style="color:#ff6666;font-weight:bold;">They cannot find it.</span>',
    'The twin lightning is NOT on him.',
    '"WHERE IS IT?!"',
    'They really get on the case now.'
  ];
  var w = document.getElementById('search-words');
  var i = 0;
  var wt = setInterval(function(){
    if(i < words.length){
      w.innerHTML += '<div style="margin:10px 0;opacity:0;animation:fadein 1s forwards;">'+words[i]+'</div>';
      i++;
    }else{
      clearInterval(wt);
      setTimeout(function(){
        var d = document.getElementById('court-search');
        if(d) d.remove();
        /* the case intensifies */
        if(typeof courtIsReady==='function' && courtIsReady()){
          startTwinCase();
        }
      }, 2000);
    }
  }, 1500);
  codeStatus('the court cannot find it on him — they get on the case');
  }, 18000); /* after grid desperation */
}
loadPadCharge();
function walkValley(){
  var div = document.getElementById('scary-valley');
  if(div) div.remove();
  /* the valley walk — creatures */
  codeStatus('you walk down the scary valley. Creatures watch from the dark.');
  /* spawn creature encounters */
  var encounters = 0;
  var et = setInterval(function(){
    encounters++;
    var creatures = ['eyes in the dark', 'something breathing', 'claws on stone', 'a shape that was not there before'];
    var cr = creatures[Math.floor(Math.random()*creatures.length)];
    codeStatus('valley: '+cr+'... ('+encounters+'/5)');
    /* the long walk drains the pad */
    drainPad(25);
    if(encounters >= 5){
      clearInterval(et);
      /* pad shuts down after the long walk */
      drainPad(100);
      codeStatus('you made it through the valley. Your pad is dead.');
    }
  }, 4000);
}
/* gun stores check if closed */
function weaponsStoreOpen(){
  try{
    return localStorage.getItem('ruby-aftermath')!=='1';
  }catch(e){ return true; }
}
try{
  if(localStorage.getItem('ruby-aftermath')==='1') AFTERMATH_ACTIVE = true;
}catch(e){}
function receiveTwinCrystal(){
