<!-- RUBY-BACKUP · part 221 -->
        w.innerHTML += '<div style="height:12px;"></div>';
      }else{
        w.innerHTML += '<div style="margin:8px 0;opacity:0;animation:fadein 1.2s forwards;">'+words[i]+'</div>';
      }
      i++;
    }else{
      clearInterval(wt);
      setTimeout(function(){
        var d = document.getElementById('final-resolution');
        if(d){
          d.innerHTML += '<button onclick="document.getElementById(\'final-resolution\').remove()" style="margin-top:20px;padding:15px 45px;background:transparent;border:3px solid #00ffff;color:#00ffff;font-size:18px;border-radius:8px;cursor:pointer;">Play</button>';
        }
      }, 2000);
    }
  }, 2000);
  unlockAchievement('The Truth Set Him Free');
  codeStatus('all he ever needed was Soliditronium with the Continuum');
}
function courtStranger(){
  /* bypass the months requirement — the court earned him */
  try{ localStorage.setItem('ruby-first-play', (Date.now() - 61*24*60*60*1000).toString()); }catch(e){}
  summonStranger();
  /* his words after the court */
  setTimeout(function(){
    codeStatus('the stranger: "I watched your trial. You are free. Now — will you help me?"');
  }, 3000);
}
function endTwinCase(){
  TWIN_CASE.active = false;
  codeStatus('the case rests...');
  juryDeliberate(function(){
    var div = document.createElement('div');
    div.id = 'quest-hud';
    div.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:9999;background:rgba(10,20,10,0.97);border:3px solid #00ff88;border-radius:12px;padding:25px 40px;color:#fff;font-family:Georgia,serif;max-width:85%;text-align:center;';
    div.innerHTML = '<div style="color:#00ff88;font-weight:bold;font-size:26px;margin-bottom:15px;letter-spacing:2px;">NOT GUILTY</div>'
      + '<div style="font-style:italic;font-size:17px;line-height:1.8;">'
      + 'The jurors selected not guilty.<br>'
      + 'Because that is all they could really do.<br><br>'
      + 'You are free.'
      + '</div>'
      + '<div style="margin-top:20px;"><button onclick="document.getElementById(\'quest-hud\').remove()" style="padding:12px 30px;background:#224422;color:#fff;border:2px solid #00ff88;border-radius:6px;cursor:pointer;font-size:16px;">Walk Free</button></div>';
    document.body.appendChild(div);
    unlockAchievement('Survived The Twin Lightning');
    earnPay(150, 'twin lightning verdict');
    try{ raiseStat('courage', 10); }catch(e){}
    codeStatus('verdict: NOT GUILTY — that is all they could really do');
    /* the resolution — then the stranger */
    setTimeout(function(){
      var d = document.getElementById('quest-hud');
      if(d) d.remove();
      finalResolution();
      setTimeout(function(){ courtStranger(); }, 30000);
    }, 5000);
  });
}

/* THE CONTINUUM SERVER FLARE — they stop you that night */
var FLARE_CASE = {active: false, stage: 0};
var SPACE_JETS = [
  {name: 'Runner', cost: 200, mod: 1},
  {name: 'Runner X', cost: 400, mod: 3},
  {name: 'Runner X-Treme', cost: 800, mod: 5},
  {name: 'APEX RUNNER — Fully Modified', cost: 1500, mod: 10}
];
function showJets(){
  loadCredits();
  var html = '<b style="color:#0ff">SPACE RUNNER JETS</b> (you have '+CREDITS+' credits)<br><br>';
  SPACE_JETS.forEach(function(j, i){
    html += '<div style="margin:8px 0;padding:10px;border:1px solid #0ff;border-radius:5px;">'
      + '<b>'+j.name+'</b> — '+j.cost+' credits<br><small>Modification level: '+j.mod+'/10</small><br>'
      + '<button onclick="buyJet('+i+')" style="margin-top:5px;">BUY</button></div>';
  });
  var d = document.createElement('div');
  d.id = 'jet-panel';
  d.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:10000;background:rgba(5,20,30,0.95);border:3px solid #0ff;border-radius:12px;padding:20px;color:#fff;max-width:400px;max-height:70%;overflow:auto;';
  d.innerHTML = html + '<br><button onclick="document.getElementById(\'jet-panel\').remove()">CLOSE</button>';
  document.body.appendChild(d);
}
function buyJet(idx){
  loadCredits();
  var j = SPACE_JETS[idx];
  if(!j) return;
  if(CREDITS < j.cost){
    codeStatus('not enough credits — need '+j.cost);
    return;
  }
  CREDITS -= j.cost;
  try{ localStorage.setItem('ruby-credits', CREDITS.toString()); }catch(e){}
  var d = document.getElementById('jet-panel');
  if(d) d.remove();
  addToInventory({id: 'jet-'+Date.now(), name: j.name, value: j.cost, description: 'Space runner jet, mod level '+j.mod});
  codeStatus('you bought the '+j.name+'!');
  unlockAchievement('Owns '+j.name);
  /* the most modified — triggers the flare case that night */
  if(j.mod >= 10){
    if(courtIsReady()){
      setTimeout(function(){
        startFlareCase();
      }, 3000);
      codeStatus('tonight you go to pick it up...');
    }else{
      codeStatus('you bought the '+j.name+'! The court has not convened yet — keep playing.');
    }
  }
}

/* LIVE CASE — assumed guilty, news 24/7, militant court on the spot */
var LIVE_CASE = {active: false,