<!-- RUBY-BACKUP · part 222 -->
 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){ clearInterval(ft); if(d) d.style.background = '#880000'; }
  }, 300);
}
function showGuiltyOrder(){
  /* assumed guilty — on the page and game interface */
  var div = document.createElement('div');
  div.id = 'guilty-order';
  div.style.cssText = 'position:fixed;bottom:0;left:0;width:100%;z-index:15000;background:rgba(100,0,0,0.92);border-top:4px solid #ff0000;color:#fff;font-family:Arial;text-align:center;padding:12px;';
  div.innerHTML = '<div style="font-size:20px;font-weight:bold;color:#ff6666;letter-spacing:3px;">ASSUMED GUILTY</div>'
    + '<div style="font-size:13px;margin-top:5px;">Subject detained at spaceport — Continuum Server Flare investigation</div>'
    + '<div style="font-size:11px;color:#aaa;margin-top:3px;">Order #FLARE-001 — All units on alert</div>';
  document.body.appendChild(div);
}
function startNewsBroadcast(){
  /* 24/7 news ticker */
  var ticker = document.createElement('div');
  ticker.id = 'news-ticker';
  ticker.style.cssText = 'position:fixed;top:35px;left:0;width:100%;z-index:14999;background:rgba(0,0,50,0.9);color:#88ccff;font-family:monospace;font-size:13px;padding:6px;overflow:hidden;white-space:nowrap;';
  document.body.appendChild(ticker);
  var idx = 0;
  LIVE_CASE.newsTimer = setInterval(function(){
    var t = document.getElementById('news-ticker');
    if(!t){ clearInterval(LIVE_CASE.newsTimer); return; }
    t.innerHTML = '<span style="color:#ff6666;font-weight:bold;">LIVE 24/7</span> — '+NEWS_HEADLINES[idx % NEWS_HEADLINES.length];
    idx++;
  }, 4000);
}
function stopLiveCase(){
  ['