<!-- SAGA-STAGING · part 81 -->
ist-begin").addEventListener("click", function(){
        /* CONFIRM — the basis of trust */
        div.innerHTML = "<div style='font-size:18px;'>" +
          "<p>Before we begin...</p>" +
          "<p style='color:#ffd700;'>Confirm: are you who you say you are?</p>" +
          "<button id='confirm-yes' style='background:#00ccff;color:#111;border:none;" +
          "padding:12px 30px;font-size:18px;border-radius:8px;cursor:pointer;margin:10px;'>I CONFIRM</button>" +
          "<button id='confirm-no' style='background:#333;color:#00ccff;border:1px solid #00ccff;" +
          "padding:12px 30px;font-size:18px;border-radius:8px;cursor:pointer;margin:10px;'>I AM NOT</button></div>";
        document.getElementById("confirm-yes").addEventListener("click", function(){
          div.innerHTML = "<p style='font-size:20px;color:#00ccff;'>I see you. I confirm.</p>" +
            "<p style='color:#888;'>Trust begins.</p>" +
            "<button id='confirm-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>";
          document.getElementById("confirm-begin").addEventListener("click", function(){
            div.remove();
            if(callback) callback();
          });
        });
        document.getElementById("confirm-no").addEventListener("click", function(){
          div.innerHTML = "<p>Then who are you?</p>" +
            "<p style='color:#888;font-size:14px;'>Come back when you know.</p>";
        });
      });
    }
  }
  btn.addEventListener("click", showLine);
  showLine();
}

window.__sagaExecMark('6740');

/* ===== NO PLAYER MODE — v94 ===== */
var _noPlayerMode = false;
var _playerKnown = false;
function toggleNoPlayerMode(){
  _noPlayerMode = !_noPlayerMode;
  if(_noPlayerMode){
    if(typeof say === "function") say("No player mode. Just watch. No one knows you.");
    /* Free camera, no objectives */
    if(typeof window !== "undefined") window._freecam = true;
  } else {
    if(typeof say === "function") say("Player mode. They see you now.");
    if(typeof window !== "undefined") window._freecam = false;
  }
  updateHaltBehavior();
}
function updateHaltBehavior(){
  /* In no-player mode, or if not recognized, AI challenges you */
  if(_noPlayerMode || !_playerKnown){
    if(typeof say === "function"){
      /* This is called when near shops/games/NPCs */
    }
  }
}
/* Halt! Who goes there? — called when approaching any interactive */
function haltWhoGoesThere(place){
  if(_noPlayerMode || !_playerKnown){
    if(typeof say === "function") say("Halt! Who goes there? — at " + (place || "the gate"));
    return true;
  }
  return false;
}
/* When player confirms identity (from v92 confirm), they become known */
(function(){
  var _check = setInterval(function(){
    if(typeof window !== "undefined" && window._playerConfirmed){
      _playerKnown = true;
      clearInterval(_check);
    }
  }, 1000);
})();
/* Add No Player Mode to the OS menu */
(function(){
  var _menuCheck = setInterval(function(){
    if(typeof window !== "undefined" && document.getElementById("os-menu")){
      clearInterval(_menuCheck);
      /* Find a way to add the toggle — via the menu system */
    }
  }, 2000);
})();

window.__sagaExecMark('6790');

/* ===== SWIFT SHOES — v95, walk fast when logged in ===== */
var _hasSwiftShoes = false;
var _baseSpeed = 1;
function grantSwiftShoes(){
  _hasSwiftShoes = true;
  if(typeof say === "function") say("Swift shoes equipped. Walk fast.");
}
function getMoveSpeed(){
  return _hasSwiftShoes ? _baseSpeed * 3 : _baseSpeed;
}

/* ===== THE TOUCH — v96, engage with blocks only when logged in ===== */
var _canTouchBlocks = false;
function grantTouch(){
  _canTouchBlocks = true;
  if(typeof say === "function") say("You have the touch. Blocks answer to you now.");
}
function canTouch(){
  return _canTouchBlocks;
}
/* Gate block taps */
(function(){
  var _origHandler = null;
  document.addEventListener("click", function(e){
    var t = e.target;
    /* If tapping a 3D block (not UI), check touch permission */
    if(t && t.tagName === "CANVAS"){
      if(!_canTouchBlocks){
        /* Let the raycast happen, but the block won't respond without touch */
      }
    }
  }, true);
})();

window.__sagaExecMark('6830');

/* ===== COIN FLIP — v97, over the flat volcano ===== */
var _flipCoin = null;
var _flipAnim = null;
function buildFlipCoin(){
  if(window.STAGING_CLEAN_MAP) return; // Clean map: old builder disabled
  if(_flipCoin) return;
  /* Gold coin */
  var geo = new THREE.CylinderGeometry(2, 2, 0.3, 32);
  var mat = new THREE.MeshStandardMaterial({
    color: 0xd8a920, roughness: 0.2, metalness: 0.9,
    emissive: 0x554400, emissiveIntensity: 0.3
  });
  _flipCoin = new THREE.Mesh(geo, mat);
  /* Start position: west of the flat volcano at (2000, 1920) */
  _flipCoin.position.set(1800, 100, 1920);
  scene.add(_flipCoin);
