<!-- RUBY-BACKUP · part 423 -->
me()" style="width:80px;height:80px;font-size:14px;background:#00ccff;color:#fff;border:3px solid #fff;border-radius:20px;">DOME</button>'+
        '<button onclick="kidPad()" style="width:80px;height:80px;font-size:14px;background:#ff00ff;color:#fff;border:3px solid #fff;border-radius:20px;">PAD</button>'+
        '<button onclick="kidRainbow()" style="width:80px;height:80px;font-size:14px;background:linear-gradient(135deg,#ff0000,#ffff00,#00ff00,#0088ff);color:#fff;border:3px solid #fff;border-radius:20px;">RAINBOW</button>'+
        '<button onclick="kidTreasure()" style="width:80px;height:80px;font-size:14px;background:#ffcc00;color:#000;border:3px solid #fff;border-radius:20px;">TREASURE</button>'+
        '<button onclick="kidPlay()" style="width:80px;height:80px;font-size:14px;background:#00ff88;color:#000;border:3px solid #fff;border-radius:20px;">SURPRISE</button>'+
        '<button onclick="toggleKidmode()" style="width:60px;height:80px;font-size:12px;background:#333;color:#fff;border:2px solid #fff;border-radius:15px;">OFF</button>';
      document.body.appendChild(k);
    }
    k.style.display = 'flex';
    codeStatus('kidmode on — big buttons, tap to play');
  }else{
    if(k) k.style.display = 'none';
    codeStatus('kidmode off');
  }
}
function kidDome(){
  /* they call it the dome */
  if(typeof handleCode==='function') handleCode('soliditronium');
  setTimeout(function(){ if(typeof handleCode==='function') handleCode('enter'); }, 1000);
}
function kidPad(){
  /* they call it the pad */
  showContinuum();
}
function kidRainbow(){ kidRainbowReal(); }
function kidRainbowReal(){
  if(typeof handleCode==='function') handleCode('rainbow');
  /* celebration sound via Web Audio */
  try{
    var ctx = new (window.AudioContext||window.webkitAudioContext)();
    var o = ctx.createOscillator(); o.type='sine'; o.frequency.value=880;
    var g = ctx.createGain(); g.gain.value=0.2;
    o.connect(g); g.connect(ctx.destination); o.start();
    o.frequency.exponentialRampToValueAtTime(1760, ctx.currentTime+0.5);
    o.stop(ctx.currentTime+0.6);
  }catch(e){}
}
function kidTreasure(){
  if(typeof handleCode==='function') handleCode('treasure');
}
function kidPlay(){
  if(typeof handleCode==='function') handleCode('play');
}

/* AGE GATE — adults to adult maps, kids stay safe */
var USER_AGE = null;
function setAge(n){
  USER_AGE = parseInt(n, 10);
  try{ localStorage.setItem('ruby-age', USER_AGE); }catch(e){}
  if(USER_AGE >= 18){
    codeStatus('adult confirmed — full building codes unlocked. Use "buildcodes" for all 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.mat