<!-- RUBY-BACKUP · part 462 -->
><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, newsTimer: null};
var NEWS_HEADLINES = [
  'BREAKING: Suspect held at spaceport in server flare case',
  'Continuum activated — all systems go',
  'Officers: "The picture does not lie"',
  'Public demands answers in flare investigation',
  'Apex Runner purchase linked to server core theft',
  'Militant court convenes on the spot',
  'Witnesses describe suspect as "nervous"',
  'Server flare damage estimated at 5000 credits',
  'Hokulea declines to comment from orbit',
  'Ancestors watch — streets silent tonight'
];

/* STATS AND ENDORSEMENTS */
var PLAYER_STATS = {courage: 10, wisdom: 10, kindness: 10, influence: 0};
function loadStats(){
  try{
    var s = JSON.parse(localStorage.getItem('ruby-stats')||'null');
    if(s) PLAYER_STATS = s;
  }catch(e){}
}
function saveStats(){
  try{ localStorage.setItem('ruby-stats', JSON.stringify(PLAYER_STATS)); }catch(e){}
}
function raiseStat(stat, amount){
  loadStats();
  PLAYER_STATS[stat] = (PLAYER_STATS[stat]||10) + amount;
  saveStats();
  codeStatus(stat+' +'+amount+' — now '+PLAYER_STATS[stat]);
}
function showStats(){
  loadStats();
  var html = Object.keys(PLAYER_STATS).map(function(k){
    return k+': '+PLAYER_STATS[k];
  }).join(' | ');
  codeStatus('stats — '+html);
}
var ENDORSEMENTS = [];
function addEndorsement(from, text){
  ENDORSEMENTS.push({from: from, text: text, date: Date.now()});
  try{
    var e = JSON.parse(localStorage.getItem('ruby-endorsements')||'[]');
    e.push({from: from, text: text});
    localStorage.setItem('ruby-endorsements', JSON.stringify(e));
  }catch(err){}
  /* show */
  var div = document.createElement('div');
  div.style.cssText = 'position:fixed;bottom:80px;right:20px;z-index:9999;background:rgba(20,30,20,0.95);border:2px solid #00ff88;border-radius:10px;padding:12px 18px;color:#fff;font-family:Arial;max-width:300px;';
  div.innerHTML = '<div style="color:#00ff88;font-weight:bold;margin-bottom:6px;">✓ ENDORSEMENT</div>'
    + '<div style="font-size:13px;"><b>'+from+':</b> <i>"'+text+'"</i></div>';
  document.body.appendChild(div);
  setTimeout(function(){ if(div.parentElement) div.remove(); }, 6000);
  codeStatus('endorsed by '+from);
}
/* endorsements after not guilty */
function grantFlareEndorsements(){
  addEndorsement('Officer Kane', 'Stood firm under pressure. Innocent.');
  setTimeout(function(){ addEndorsement('Hokulea', 'From orbit, we saw the truth.'); }, 2000);
  setTimeout(function(){ addEndorsement('The Ancestors', 'The streets remember your courage.'); }, 4000);
  setTimeout(function(){ addEndorsement('Solid', 'You did all you could do.'); }, 6000);
  /* stats raise */
  raiseStat('courage', 15);
  raiseStat('wisdom', 10);
  raiseStat('influence', 25);
}
loadStats();
function activateContinuumAllSystems(){
  /* continuum goes all systems go */
  var div = document.createElement('div');
  div.id = 'continuum-alert';
  div.style.cssText = 'position:fixed;top:0;left:0;width:100%;z-index:15000;background:#ff0000;color:#fff;font-family:monospace;font-weight:bold;text-align:center;padding:8px;font-size:14px;';
  div.innerHTML = '⚠️ CONTINUUM ACTIVATED — ALL SYSTEMS GO ⚠️';
  document.body.appendChild(div);
  /* flash */
  var flash = 0;
  var ft = setInterval(function(){
    flash++;
    var d = document.getElementById('continuum-alert');
    if(!d){ clearInterval(ft); return; }
    d.style.background = flash%2 ? '#ff0000' : '#880000';
    if(flash > 20){ clearInte