<!-- RUBY-BACKUP · part 203 -->
_solid'); _origMeetSolid(); };
var _origCompleteQuest = completeQuest;
completeQuest = function(){ trackProgress('did_quest'); _origCompleteQuest(); };
var _origFillMax = fillContinuumMax;
fillContinuumMax = function(){ trackProgress('filled_max'); _origFillMax(); };
var _origHokulea = summonHokulea;
summonHokulea = function(){ trackProgress('saw_hokulea'); _origHokulea(); };
var _origCity = buildAncestralCity;
buildAncestralCity = function(){ trackProgress('visited_city'); _origCity(); };
var _origDark = buildDarkPlaces;
buildDarkPlaces = function(){ trackProgress('visited_dark'); _origDark(); };
var _origAsk = solidAnswer;
solidAnswer = function(q){ trackProgress('asked_solid'); _origAsk(q); };
function progress(){
  var prog = getProgress();
  var done = COMPLETION_KEYS.filter(function(k){ return prog[k]; });
  codeStatus('progress: '+done.length+'/'+COMPLETION_KEYS.length+' — '+done.join(', '));
}

/* THE EXPANDED WORLD — racing, court, work, influence, updates */
/* SPACE RACING — to Mars, Europa, and beyond */
var RACE_DESTINATIONS = [
  {name: 'Mars', distance: 100, color: 0xff4400},
  {name: 'Europa', distance: 150, color: 0xaaccff},
  {name: 'Titan', distance: 200, color: 0xffcc66},
  {name: 'Enceladus', distance: 180, color: 0xffffff},
  {name: 'Ganymede', distance: 220, color: 0x88aa66}
];
var RACE_ACTIVE = null;
function startRace(destName){
  var dest = RACE_DESTINATIONS.find(function(d){ return d.name.toLowerCase()===destName.toLowerCase(); });
  if(!dest){
    codeStatus('destinations: '+RACE_DESTINATIONS.map(function(d){ return d.name; }).join(', '));
    return;
  }
  codeStatus('racing to '+dest.name+' — distance '+dest.distance+'. Go!');
  RACE_ACTIVE = {dest: dest, progress: 0, start: Date.now()};
  var raceTimer = setInterval(function(){
    if(!RACE_ACTIVE) { clearInterval(raceTimer); return; }
    RACE_ACTIVE.progress += 2 + Math.random()*3;
    if(RACE_ACTIVE.progress >= dest.distance){
      var time = ((Date.now()-RACE_ACTIVE.start)/1000).toFixed(1);
      codeStatus('arrived at '+dest.name+' in '+time+'s! You win.');
      earnPay(100, 'space race to '+dest.name);
      unlockAchievement('Raced to '+dest.name);
      clearInterval(raceTimer);
      RACE_ACTIVE = null;
    }else{
      codeStatus('racing to '+dest.name+' — '+Math.floor(RACE_ACTIVE.progress/dest.distance*100)+'%');
    }
  }, 500);
}
/* COURT — logical arguments and achievements */
var ACHIEVEMENTS = [];
function unlockAchievement(name){
  if(ACHIEVEMENTS.indexOf(name) < 0){
    ACHIEVEMENTS.push(name);
    try{ localStorage.setItem('ruby-achievements', JSON.stringify(ACHIEVEMENTS)); }catch(e){}
    codeStatus('ACHIEVEMENT: '+name);
  }
}
function loadAchievements(){
  try{ ACHIEVEMENTS = JSON.parse(localStorage.getItem('ruby-achievements')||'[]'); }catch(e){ ACHIEVEMENTS = []; }
}
var COURT_CASES = [
  {claim: 'The sky is blue because the ocean reflects it', fallacy: 'False Cause', correct: 'Rayleigh scattering'},
  {claim: 'All towers are tall, therefore all tall things are towers', fallacy: 'Affirming the Consequent', correct: 'Invalid conversion'},
  {claim: 'You are either with us or against us', fallacy: 'False Dilemma', correct: 'More options exist'}
];

/* THE TWIN LIGHTNING — a hard case. You are a victim of circumstance. */
var TWIN_CASE = {
  title: 'The Twin Lightning',
  active: false,
  stage: 0,
  stages: [
    {
      prosecution: 'On the night of the storm, TWO lightning bolts struck. You were seen at BOTH places. How do you explain this?',
      choices: ['I was at the beach', 'I was at the peak', 'I do not know'],
      truth: 'You were at the beach. The second bolt was your twin — not by blood, but by lightning. The storm split you.'
    },
    {
      prosecution: 'Witnesses say you looked guilty. You were running. Innocent people do not run.',
      choices: ['I was running from the storm', 'I was running to help', 'I was scared'],
      truth: 'You were running to warn the village. The court calls it fleeing. It was courage.'
    },
    {
      prosecution: 'Your twin — this "other you" — has never been seen before or since. Convenient.',
      choices: ['The storm made us', 'We are one split in two', 'Believe me'],
      truth: 'Twin lightning creates twin souls. It lasts one night. Then you are whole again, but the court remembers the split.',
      sink: true
    },
    {
      prosecution: 'The court finds your story... unlikely. The lightning does not choose people.',
      choices: ['But it chose me', 'I am a victim of circumstance', 'Let the storm testify'],
      truth: 'You are a victim of circumstance. The storm chose. Not you.'
    },
    {
      prosecution: 'Tell us — did the twin lightning make you powerful? Is that why you took it?',
      choices: ['It gave me nothing', 'It took from me', 'It is backwards'],
      truth: 'It does not make him powerful at all. It is backwards. It steals his pad\'s energy. It takes and takes and gives nothing bac