<!-- RUBY-BACKUP · part 178 -->
200.');
  }else{
    codeStatus('kid mode — safe and fun. Use "kidmode" for big buttons.');
    /* auto-enable kidmode for under 18 */
    if(!KIDMODE_ON) toggleKidmode();
  }
}
function getAge(){
  if(USER_AGE!==null) return USER_AGE;
  try{
    var a = parseInt(localStorage.getItem('ruby-age')||'0', 10);
    if(a>0){ USER_AGE = a; return a; }
  }catch(e){}
  return null;
}
function isAdult(){
  var age = getAge();
  return age!==null && age>=18;
}
function requireAdult(){
  if(!isAdult()){
    codeStatus('18+ only — this is for adult maps');
    return false;
  }
  return true;
}
/* adult map area — separate region */
var ADULT_CX = 60, ADULT_CZ = 60;
function goAdultMap(){
  if(!requireAdult()) return;
  if(typeof sgoFunc==='function') sgoFunc(ADULT_CX, ADULT_CZ);
  codeStatus('adult map — build freely here');
}
setTimeout(function(){ getAge(); }, 2000);

/* KING SOLID'S DECREE — the law, bold */
var DECREE = [
  {t: 'I. AGE SEPARATION', d: 'Under 18: kid maps only, the dome and the pad. 18 and over: adult maps only. No crossing.'},
  {t: 'II. THE DOME IS SACRED', d: 'No building inside the dome. No destroying it. It stands for all.'},
  {t: 'III. THE CONTINUUM LIMIT', d: 'Twenty-five codes. No more. What you carry is what you need.'},
  {t: 'IV. THE CAPSULE IS SOLID\'S', d: 'Yielded by the King. No hand opens it but Solid\'s.'},
  {t: 'V. RESPECT BUILDS', d: 'Do not unmake what another has made, without their word.'},
  {t: 'VI. THE SPAWN IS SHARED', d: 'Keep the spawn point clear. Newcomers arrive here.'},
  {t: 'VII. NO EMPTY SPACE', d: 'Fill the gaps. The ancestors leave nothing unfinished.'},
  {t: 'VIII. NAMES HAVE MEANING', d: 'Codes are called what they are. The dome is the dome. The pad is the pad.'},
  {t: 'IX. SCYFY RETURNS ALL', d: 'What is emptied returns to the source. Nothing is ever lost.'},
  {t: 'X. THE KING\'S WORD IS LAW', d: 'What the King decrees, stands.'},
  {t: 'XI. BUILD FOR THE CHILDREN', d: 'The dome, the pad, the codes — all of it exists for the children who come after. This is why we build.'}
];

/* HELL — its own map, where the banished go */
var HELL_MAPS = ['testroom', 'v65test', 'one-life']; /* hell is our test maps */
var BANISHED = [];

/* CHILD MAP GUARD — adults 18+ on a child's map go to hell */
var CHILD_MAPS = ['kids', 'playground', 'children', 'kidzone'];
function currentWatchId(){
  var m = window.location.href.match(/[?&]watch=([^&]+)/);
  return m ? m[1] : 'sample';
}
function guardChildMap(){
  var watch = currentWatchId();
  var isChildMap = CHILD_MAPS.indexOf(watch)>=0;
  if(!isChildMap) return; /* not a child's map, no guard */
  var age = getAge();
  if(age===null) return; /* age not set, allow (they'll set it) */
  if(age>=18){
    /* sovereign (King/Solid) exempt */
    if(typeof hasSovereign==='function' && hasSovereign()) return;
    /* adult on a child's map — to hell */
    codeStatus('ADULT ON A CHILD\'S MAP — banished to hell');
    setTimeout(function(){ goHell(); }, 2000);
  }
}
/* check on load */
setTimeout(guardChildMap, 3000);
function goHell(){
  /* hell is its own map — navigate to it */
  var base = window.location.href.split('?')[0];
  try{ localStorage.setItem('ruby-banished', '1'); }catch(e){}
  codeStatus('BANISHED — hell is its own map. Going...');
  setTimeout(function(){
    var hm = HELL_MAPS[Math.floor(Math.random()*HELL_MAPS.length)];
    window.location.href = base + '?watch=' + hm;
  }, 1500);
}
function leaveHell(){
  /* redeemed — return to the main map */
  try{ localStorage.removeItem('ruby-banished'); }catch(e){}
  var base = window.location.href.split('?')[0];
  window.location.href = base + '?watch=sample';
}
function banish(){
  /* only the King or Solid (Sovereign Right) can banish */
  if(typeof hasSovereign==='function' && !hasSovereign()){
    codeStatus('only the King or Solid may banish');
    return;
  }
  /* banish the nearest other player, or self if alone */
  codeStatus('BANISHED to hell — the Decree is broken, the punishment stands');
  goHell();
}
function isBanished(){
  try{ return localStorage.getItem('ruby-banished')==='1'; }catch(e){ return false; }
}
/* check on load — if banished, go to hell */
setTimeout(function(){
  if(isBanished()) goHell();
}, 8000);
function showDecree(){
  var d = document.getElementById('decree');
  if(!d){
    d = document.createElement('div');
    d.id = 'decree';
    d.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:10002;background:#000;border:3px solid #ff0000;border-radius:12px;padding:20px;color:#fff;font:13px monospace;max-width:450px;max-height:85vh;overflow:auto;';
    document.body.appendChild(d);
  }
  d.style.display = 'block';
  var html = '<div style="text-align:center;margin-bottom:15px">';
  html += '<b style="color:#ff0000;font-size:18px;">KING SOLID\'S DECREE</b><br>';
  html += '<span style="color:#888">the law of the maps</span> ';
  html += '<button onclick="hideDecree()">CLOSE</b