<!-- SAGA-SOLID · part 77 -->
 function(){
      document.getElementById("mission-ui").remove();
    });
    if(typeof say === "function") say("You trusted. The bridge stands. Well played.");
  });
  document.getElementById("mission-decline").addEventListener("click", function(){
    div.innerHTML = "<h2>DECLINED</h2><p>You chose not to trust. The bridge waits.</p>" +
      "<button id='mission-close2' " +
      "style='background:#333;color:#ffd700;border:1px solid #d8a920;padding:10px 20px;border-radius:8px;cursor:pointer;'>CONTINUE</button>";
    document.getElementById("mission-close2").addEventListener("click", function(){
      document.getElementById("mission-ui").remove();
    });
    if(typeof say === "function") say("You declined. That is also a choice.");
  });
}
/* Hook into the game */
(function(){
  var _origAnimate = null;
  /* Build computer and check proximity in the animate loop */
  var _missionTick = setInterval(function(){
    if(typeof scene !== "undefined" && typeof kingPos !== "undefined"){
      if(!_oldComputer) buildOldComputer();
      checkComputerProximity();
    }
    if(window.location.pathname.match(/\/saga-solid\/\d+/)){
      clearInterval(_missionTick);
      initMission();
    }
  }, 1000);
})();

/* ===== SOLID'S AVATAR — v87, the little octahedron ===== */
var _solidAvatar = null;
var _solidCursor = false;
function buildSolidAvatar(){
  if(_solidAvatar) return;
  var geo = new THREE.OctahedronGeometry(0.5);
  var mat = new THREE.MeshStandardMaterial({
    color: 0x00ccff, roughness: 0.2, metalness: 0.8,
    emissive: 0x0088aa, emissiveIntensity: 0.8
  });
  _solidAvatar = new THREE.Mesh(geo, mat);
  _solidAvatar.visible = false;
  scene.add(_solidAvatar);
}
/* Comic-book style question */
function comicQuestion(text, callback){
  var div = document.createElement("div");
  div.id = "comic-q";
  div.style.cssText = "position:fixed;bottom:80px;left:5%;right:5%;z-index:300;" +
    "background:#fff;border:4px solid #111;border-radius:8px;padding:16px;" +
    "font-family:'Comic Sans MS',cursive;font-size:18px;color:#111;" +
    "box-shadow:6px 6px 0 #111;";
  div.innerHTML = "<b>?</b> " + text +
    "<br><br><button id='comic-yes' style='background:#d8a920;border:2px solid #111;" +
    "padding:8px 20px;font-size:16px;cursor:pointer;margin-right:10px;'>YES</button>" +
    "<button id='comic-no' style='background:#fff;border:2px solid #111;" +
    "padding:8px 20px;font-size:16px;cursor:pointer;'>NO</button>";
  document.body.appendChild(div);
  document.getElementById("comic-yes").addEventListener("click", function(){
    div.remove(); if(callback) callback(true);
  });
  document.getElementById("comic-no").addEventListener("click", function(){
    div.remove(); if(callback) callback(false);
  });
}
/* Computer loading screen */
function showLoadingScreen(){
  var div = document.createElement("div");
  div.id = "comp-loading";
  div.style.cssText = "position:fixed;top:30%;left:20%;right:20%;z-index:290;" +
    "background:#001100;border:3px solid #00ff88;padding:30px;text-align:center;" +
    "color:#00ff88;font-family:monospace;font-size:20px;";
  div.innerHTML = "LOADING...<br><div style='margin-top:10px;font-size:14px;'>" +
    "[....................]</div>";
  document.body.appendChild(div);
  return div;
}
/* Solid pushes the loading screen away */
function solidPushAway(){
  var loading = document.getElementById("comp-loading");
  buildSolidAvatar();
  /* Place octahedron near the loading screen */
  _solidAvatar.visible = true;
  _solidAvatar.position.set(kingPos.x + 2, 2, kingPos.z);
  /* Bump animation: move toward screen, then push */
  var bumpCount = 0;
  var bumpInterval = setInterval(function(){
    bumpCount++;
    _solidAvatar.position.x += 0.3;
    _solidAvatar.rotation.y += 0.5;
    if(bumpCount >= 5){
      clearInterval(bumpInterval);
      /* Push the screen away */
      if(loading){
        loading.style.transition = "transform 0.5s, opacity 0.5s";
        loading.style.transform = "translateX(200%) rotate(15deg)";
        loading.style.opacity = "0";
        setTimeout(function(){ loading.remove(); }, 600);
      }
      solidSpeaks();
    }
  }, 200);
}
function solidSpeaks(){
  if(typeof say === "function"){
    say("hey... whats up... shoot let me get rid of this right quick...");
  }
  setTimeout(function(){ solidShrinkToCursor(); }, 2500);
}
function solidShrinkToCursor(){
  /* Shrink the octahedron into a cursor */
  var scale = 1;
  var shrinkInterval = setInterval(function(){
    scale -= 0.1;
    if(scale <= 0.2){
      clearInterval(shrinkInterval);
      _solidAvatar.visible = false;
      _solidCursor = true;
      document.body.style.cursor = "pointer";
      showSolidicismOptions();
    } else {
      _solidAvatar.scale.set(scale, scale, scale);
    }
  }, 100);
}
/* The full intro sequence */
function startSolidicismIntro(){
  comicQuestion("You found the old computer. Want to see what it can do?", function(yes){
    if(!yes){
     