<!-- SAGA-STAGING · part 80 -->
 +
          "<button id='prize-collect' style='background:#d8a920;color:#111;border:none;" +
          "padding:14px 40px;font-size:20px;border-radius:8px;cursor:pointer;'>COLLECT</button>";
        document.getElementById("prize-collect").addEventListener("click", function(){
          if(typeof grantSwiftShoes === "function") grantSwiftShoes();
          if(typeof grantTouch === "function") grantTouch();
          div.remove();
          if(typeof say === "function") say("Prize collected. Now run to the old computer.");
        });
      });
    }
  });
}
/* Hook: after profile setup, start the tiny game */
(function(){
  var _origCallback = null;
  /* Wrap showProfileSetup to trigger tiny game after login */
  var _checkInt = setInterval(function(){
    if(typeof showProfileSetup === "function"){
      clearInterval(_checkInt);
      var _orig = showProfileSetup;
      showProfileSetup = function(callback){
        _orig(function(user){
          if(user) startTinyWinGame(user);
          if(callback) callback(user);
        });
      };
    }
  }, 500);
})();

/* ===== ACT 2: LOG IN — v90 ===== */
function showLoginAct(callback){
  var div = document.createElement("div");
  div.id = "login-act";
  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-align:center;";
  div.innerHTML =
    "<h2 style='margin:0 0 8px;'>ACT 2: LOG IN</h2>" +
    "<p style='font-size:14px;color:#aaa;'>You registered. Now log in.</p>" +
    "<input id='login-user' type='text' placeholder='username' " +
    "style='display:block;width:80%;margin:10px auto;padding:12px;font-size:18px;" +
    "background:#111;border:1px solid #d8a920;color:#ffd700;border-radius:8px;text-align:center;' />" +
    "<input id='login-pass' type='password' placeholder='password' " +
    "style='display:block;width:80%;margin:10px auto;padding:12px;font-size:18px;" +
    "background:#111;border:1px solid #d8a920;color:#ffd700;border-radius:8px;text-align:center;' />" +
    "<div id='login-error' style='color:#ff6666;font-size:14px;min-height:20px;'></div>" +
    "<button id='login-send' style='background:#d8a920;color:#111;border:none;" +
    "padding:14px 40px;font-size:20px;border-radius:8px;cursor:pointer;margin-top:10px;'>SEND</button>";
  document.body.appendChild(div);
  document.getElementById("login-send").addEventListener("click", function(){
    var u = document.getElementById("login-user").value.trim();
    var p = document.getElementById("login-pass").value;
    fetch("/api/game/login", {method: "POST",
      headers: {"Content-Type": "application/json"},
      body: JSON.stringify({username: u, password: p})})
      .then(function(r){ return r.json(); })
      .then(function(d){
        if(d.ok){
          div.remove();
          if(callback) callback(d.user);
        } else {
          document.getElementById("login-error").textContent = d.error || "Failed";
        }
      });
  });
}

/* ===== EXISTENTIAL DIALOGUE — v91 ===== */
function solidExistentialDialogue(username, callback){
  var lines = [
    "Wait a second...",
    "Now who even are you?",
    "What even is all of this?",
    "Why am I... or you... even here?",
    "Who, what, when, why, how... and WHERE even are we?"
  ];
  var div = document.createElement("div");
  div.id = "existential";
  div.style.cssText = "position:fixed;top:20%;left:8%;right:8%;z-index:315;" +
    "background:rgba(0,0,0,0.95);border:2px solid #00ccff;border-radius:12px;" +
    "padding:24px;color:#00ccff;font-family:sans-serif;text-align:center;";
  div.innerHTML = "<div id='exist-line' style='font-size:20px;min-height:80px;'></div>" +
    "<button id='exist-next' style='background:#00ccff;color:#111;border:none;" +
    "padding:10px 30px;font-size:16px;border-radius:8px;cursor:pointer;margin-top:16px;'>...</button>";
  document.body.appendChild(div);
  var idx = 0;
  var lineEl = document.getElementById("exist-line");
  var btn = document.getElementById("exist-next");
  function showLine(){
    if(idx < lines.length){
      lineEl.textContent = lines[idx];
      btn.textContent = idx === lines.length - 1 ? "Look" : "...";
      idx++;
    } else {
      /* Look at profile through octahedron */
      div.innerHTML = "<div style='font-size:18px;'>" +
        "<div style='width:60px;height:60px;margin:0 auto 16px;" +
        "background:radial-gradient(circle,#00ccff,#0088aa);" +
        "clip-path:polygon(50% 0%,100% 50%,50% 100%,0% 50%);'></div>" +
        "<p>Oh... it's you?</p>" +
        "<p style='color:#888;font-size:14px;'>But who are you, really?</p>" +
        "<button id='exist-begin' style='background:#d8a920;color:#111;border:none;" +
        "padding:12px 30px;font-size:18px;border-radius:8px;cursor:pointer;margin-top:16px;'>BEGIN SOLIDICISM</button></div>";
      document.getElementById("ex