<!-- SAGA-STAGING · part 78 -->
 disabled
  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){
      if(typeof say === "function") say("Maybe next time.");
      return;
    }
    showLoadingScreen();
    setTimeout(function(){ solidPushAway(); }, 1500);
  });
}
/* Hook: when absorbed to /1, start the intro */
(function(){
  var _introStarted = false;
  setInterval(function(){
    if(_introStarted) return;
    if(window.location.pathname.match(/\/saga-solid\/1/)){
      if(typeof scene !== "undefined" && typeof kingPos !== "undefined"){
        _introStarted = true;
        setTimeout(startSolidicismIntro, 2000);
      }
    }
  }, 1000);
})();

/* ===== GAME PROFILE SETUP — v88, simple username + password ===== */
function showProfileSetup(callback){
  /* Check if already logged in */
  fetch("/api/game/register", {method: "POST", headers: {"Content-Type": "application/json"},
    body: JSON.stringify({username: "", password: "", confirm: ""})})
    .then(function(r){ return r.json(); })
    .then(function(d){
      if(d.ok && d.user){ if(callback) callback(d.user); return; }
      /* Not logged in — show simple form */
      var div = document.createElement("div");
      div.id = "profile-setup";
      div.style.cssText = "position:fixed;top:25%;left:10%;right:10%;z-index:310;" +
        "background:rgba(0,0,0,0.95);border:2px solid #d8a920;border-radius:12px;" +
        "padding:24px;color:#ffd700;font-family:sans-serif;text-al