html = r'''<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Holiday Adventures: Three Full Games</title>
<style>
*{box-sizing:border-box}
body{margin:0;padding:16px;font-family:Arial,sans-serif;background:#fff;color:#222}
#game{max-width:560px;margin:auto;display:flex;flex-direction:column;gap:10px}
.panel{border:1px solid #ddd;border-radius:12px;padding:10px;background:#fff}
.stat{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap}
.grid8{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;width:min(100%,440px);margin:auto}
.tile{aspect-ratio:1;min-width:0;border:1px solid #a7c9a0;border-radius:5px;background:#bce8ae;display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1.05;padding:1px;overflow:hidden;color:#243d2b;font-size:clamp(8px,2.5vw,12px)}
.tile .emoji{font-size:clamp(16px,4.3vw,24px)}
.tile small{font-size:clamp(6px,1.8vw,10px);font-weight:700;overflow-wrap:anywhere;text-align:center}
.tile.snow{background:#f1f9fc;border-color:#cbdfe8;color:#30434a}
.tile.pink{background:#f8cce0;border-color:#e7a9c6}
.tile.tree{background:#247344;color:white;border-color:#176039}
.tile.door{background:#c99a70;color:#422d1c}
.tile.station{background:#d9edff;border-color:#9fc6e5;color:#243c50}
.tile.special{background:#f7efc8}
.tile.player{outline:3px solid #f4b51e;outline-offset:-3px}
.tile.easter{background:#d9f1cf;border-color:#a6d49d}
.tile.thanksgiving{background:#f4d7a7;border-color:#d8b47c}
button{border:1px solid #ddd;border-radius:9px;padding:10px;background:#fff;color:#222;font-weight:600;cursor:pointer}
button.primary{background:#16804d;color:white;border-color:#16804d}
button.joy{font-size:20px;min-width:48px;min-height:44px;background:#f4f4f4}
input,select{width:100%;padding:9px;border:1px solid #ccc;border-radius:8px;background:#fff;color:#222}
.hide{display:none!important}
.muted{color:#666}
.outfits{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.outfits button.selected{outline:3px solid #e8ae20}
</style>
</head>
<body>
<div id="game">
<div id="modepick" class="panel" style="display:flex;flex-direction:column;gap:12px">
<b style="font-size:22px;text-align:center">🎉 Holiday Adventures</b>
<button class="panel" data-mode="Christmas" style="text-align:center"><div style="font-size:38px">🎄</div><b>Christmas: North Pole Workshop</b><small>Deliver toys, wrap presents, and avoid Santa!</small></button>
<button class="panel" data-mode="Easter" style="text-align:center"><div style="font-size:38px">🐰</div><b>Easter: Bunny's Egg Workshop</b><small>Find hidden eggs, decorate them, and fill the basket!</small></button>
<button class="panel" data-mode="Thanksgiving" style="text-align:center"><div style="font-size:38px">🦃</div><b>Thanksgiving: Turkey Farm</b><small>Find escaped turkeys and guide them to their safe pen!</small></button>
</div>
<div id="setup" class="panel hide" style="display:flex;flex-direction:column;gap:12px">
<b id="setupTitle" style="font-size:20px">Customize your character!</b>
<label>Character name<input id="charname" value="Maple" maxlength="16"></label>
<label>Character style<select id="charstyle"><option value="girl">Girl</option><option value="boy">Boy</option><option value="nonbinary">Nonbinary</option><option value="none">Prefer not to say</option></select></label>
<div>Choose your outfit:</div><div id="outfits" class="outfits"></div>
<div>Choose an accessory:</div><div id="accessories" class="outfits"></div>
<div class="panel" style="text-align:center"><div id="avatarPreview" style="font-size:48px">🧝🏻♀️</div><div id="avatarLabel" class="muted"></div></div>
<div class="panel"><b>📖 How to win</b><ol id="tutorial" style="padding-left:22px;margin-bottom:0"></ol></div>
<button id="begin" class="primary">Start adventure!</button>
<button id="backModes">← Back to holiday selection</button>
</div>
<div id="play" class="hide" style="display:flex;flex-direction:column;gap:10px">
<div class="stat"><b id="roomname">🎄 Elf Workshop</b><b id="roomtag">🏠 Indoor Workshop</b></div>
<div class="panel">
<div class="stat"><b id="objective">Objective</b><b id="progress">0/2</b></div>
<div id="childline" style="font-size:12px;margin-top:5px">Child: ???</div>
<div id="stationtop" class="hide" style="font-weight:bold;margin-top:8px">Stations visited: 0/4</div>
</div>
<div id="map" class="grid8"></div>
<div style="display:flex;flex-direction:column;align-items:center;gap:4px">
<button class="joy" data-move="0,-1">⬆️</button>
<div style="display:flex;gap:8px"><button class="joy" data-move="-1,0">⬅️</button><button class="joy" data-move="0,1">⬇️</button><button class="joy" data-move="1,0">➡️</button></div>
<small class="muted">Movement joystick</small>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:8px"><button id="interact" class="primary">Interact</button><button id="drop">Drop item</button></div>
<div class="panel stat"><span id="bag">🎒 Empty</span><span id="follower">🦌 Following you</span><span id="chaser">🎅 Safe</span></div>
<div class="panel" id="message">Your adventure is ready!</div>
<div id="stationPanel" class="panel hide"><b id="stationTitle">Stations</b><div style="font-size:12px;margin-top:5px">Stand on a station tile and press Interact.</div><div id="stationlist" style="margin-top:8px;font-size:12px"></div></div>
<div id="help" class="panel hide"><b id="helpTitle">Need help?</b><div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px"><button id="helper1">Helper 1</button><button id="helper2">Helper 2</button></div></div>
<button id="restart">Restart adventure</button><button id="changeMode">Change holiday</button>
</div>
</div>
<script>
(()=>{
const root=document.getElementById('game');if(root.dataset.ready)return;root.dataset.ready='1';
const $=id=>document.getElementById(id);
const configs={
Christmas:{
title:'🎄 North Pole Workshop',setup:'🎅 Customize your elf!',main:'workshop',wrap:'wrap',outside:'outside',
rooms:['🎄 Elf Workshop','🎁 Wrapping Room','❄️ Snowy Outside'],
tags:['🏠 Indoor Workshop','🎁 Wrapping Room','❄️ Snowy Outside'],
outfits:['🧝🏻♀️ Classic elf','🎅 Santa helper','❄️ Snow elf','🧝🏻♂️ Winter elf','🧑🎄 Festive helper','🎄 Holly elf'],
accessories:['🧢 Elf hat','🔔 Jingle bells','🦌 Reindeer antlers','❄️ Snowflake pin','🎀 Festive bow'],
tutorial:['Check the Nice List.','Pick up Ava’s teddy bear and kite.','Visit all four wrapping stations for each toy.','Take the wrapped toys outside to the sleigh.','Do not deliver the wrong or unwrapped toy!'],
listText:'📜 Nice List checked! Your assigned child is Ava. Find the teddy bear and kite.',
stations:[['Wrapping','🎁',2,1],['Bows','🎀',5,1],['Ribbon','🧵',2,6],['Decore','✨',5,6]],
toys:[['Teddy bear','Ava','🧸',1,1],['Kite','Ava','🪁',6,1],['Train','Oliver','🚂',1,5],['Ball','Oliver','⚽',6,5],['Doll','Sophie','🪆',4,1],['Yo-yo','Sophie','🔴',4,6]],
target:'Ava',goal:2,delivery:'🛷 SLEIGH',stationTitle:'🎁 Wrapping stations',follower:'🦌 Following you',chaser:'🎅 Safe',treeEmoji:'🎄',
listPos:[1,3],helper1:'Peppermint',helper2:'Jingle',
helper1msg:'Peppermint: Ava needs a teddy bear and a kite. Wrap both at all four stations!',
helper2msg:'Jingle: The reindeer watches deliveries. Wrong or unwrapped toys make it snitch!',
outsideTrees:[[6,0],[2,1],[6,1],[2,2],[6,2],[2,3],[4,3],[4,4],[4,5],[1,6],[4,6]]
},
Easter:{
title:'🐰 Bunny Egg Workshop',setup:'🐣 Customize your Easter character!',main:'workshop',wrap:'decorate',outside:'meadow',
rooms:['🐰 Bunny Workshop','🌸 Egg Decorating Room','🌷 Spring Meadow'],
tags:['🏡 Bunny Workshop','🌸 Decorating Room','🌷 Spring Meadow'],
outfits:['🐰 Bunny suit','🐥 Little chick','🌷 Spring gardener','🩷 Pastel bunny','🦋 Butterfly helper','🌼 Flower outfit'],
accessories:['🐰 Bunny ears','🌸 Flower crown','🥚 Egg basket','🐥 Chick clip','🎀 Pastel bow'],
tutorial:['Check the Bunny List to learn which eggs you need.','Explore the workshop to find hidden eggs.','Visit all four decorating stations for each egg.','Take your decorated eggs to the basket in the meadow.','Look carefully: eggs can be hidden behind bushes!'],
listText:'🐰 Bunny List checked! Find the 4 special eggs hidden around the workshop.',
stations:[['Paint','🎨',2,1],['Glitter','✨',5,1],['Patterns','🖌️',2,6],['Ribbons','🎀',5,6]],
toys:[],target:'Bunny Basket',goal:4,delivery:'🧺 EASTER BASKET',stationTitle:'🌸 Egg decorating stations',follower:'🐰 Bunny companion',chaser:'🥚 Egg hunt',treeEmoji:'🌳',
listPos:[1,3],helper1:'Daisy',helper2:'Clover',
helper1msg:'Daisy: Look around the bushes and garden corners. Some eggs are easy to miss!',
helper2msg:'Clover: Every egg needs all four decorating stations before it goes in the basket!',
outsideTrees:[[6,0],[2,1],[6,1],[2,2],[6,2],[2,3],[4,3],[4,4],[4,5],[1,6],[4,6]]
},
Thanksgiving:{
title:'🦃 Thanksgiving Turkey Farm',setup:'🍂 Customize your farm helper!',main:'farm',wrap:'barn',outside:'pasture',
rooms:['🍁 Turkey Farm','🌾 Harvest Barn','🍂 Turkey Pasture'],
tags:['🏡 Farmyard','🌾 Harvest Barn','🍂 Pasture'],
outfits:['🦃 Turkey costume','🍂 Autumn sweater','🎃 Pumpkin patch','🌻 Harvest helper','🧡 Cozy plaid','🌾 Farmer outfit'],
accessories:['🍁 Leaf crown','🧣 Cozy scarf','🦃 Turkey hat','🌻 Sunflower pin','🎀 Harvest bow'],
tutorial:['Check the Guest List to see how many turkeys escaped.','Find the turkeys wandering around the farm.','Get close and press Catch to catch each turkey.','Take the turkeys to the safe pen in the pasture.','Keep an eye out because the turkeys move around!'],
listText:'📋 Guest List checked! Two turkeys escaped. Find them and bring them safely to the pasture pen.',
stations:[['Feed','🌽',2,1],['Water','💧',5,1],['Hay','🌾',2,6],['Cozy straw','🪹',5,6]],
toys:[],target:'Safe Pen',goal:2,delivery:'🚧 TURKEY PEN',stationTitle:'🌾 Farm supply stations',follower:'🐓 Farm companion',chaser:'🦃 Turkeys',treeEmoji:'🌳',
listPos:[1,3],helper1:'Hazel',helper2:'Chestnut',
helper1msg:'Hazel: The turkeys like wandering near the hay bales and trees. Check the whole farm!',
helper2msg:'Chestnut: Once you catch a turkey, guide it to the safe pen outside.',
outsideTrees:[[6,0],[2,1],[6,1],[2,2],[6,2],[2,3],[4,3],[4,4],[4,5],[1,6],[4,6]]
}
};
let mode='Christmas',cfg=configs.Christmas,room='workshop',x=4,y=3,old={x:4,y:3},charname='Maple',outfit='',accessory='',checked=false,carried=null,stations=new Set(),wrapped=new Set(),delivered=new Set(),snitched=false,santaTurns=0,santaPos=null,santaTimer=null,started=false,turkeys=[],turkeyCaught=0,hiddenRevealed=new Set(),eggPositions=[];
function msg(t){$('message').textContent=t}
function parseOutfit(v){return v.split(' ').slice(1).join(' ')}
function renderSetup(){
$('setupTitle').textContent=cfg.setup;$('outfits').innerHTML='';$('accessories').innerHTML='';
cfg.outfits.forEach(v=>{let b=document.createElement('button');b.textContent=v;b.classList.toggle('selected',v===outfit);b.onclick=()=>{outfit=v;renderSetup()};$('outfits').append(b)});
cfg.accessories.forEach(v=>{let b=document.createElement('button');b.textContent=v;b.classList.toggle('selected',v===accessory);b.onclick=()=>{accessory=v;renderSetup()};$('accessories').append(b)});
$('avatarPreview').textContent=(outfit.split(' ')[0]||'🧝')+' '+(accessory.split(' ')[0]||'');
$('avatarLabel').textContent=parseOutfit(outfit)+' · '+parseOutfit(accessory);
$('tutorial').innerHTML='';cfg.tutorial.forEach(t=>{let li=document.createElement('li');li.textContent=t;$('tutorial').append(li)});
}
function chooseMode(m){
mode=m;cfg=configs[m];outfit=cfg.outfits[0];accessory=cfg.accessories[0];
$('modepick').classList.add('hide');$('play').classList.add('hide');$('setup').classList.remove('hide');renderSetup();
}
function resetState(){
room=cfg.main;x=4;y=3;old={x,y};checked=false;carried=null;stations.clear();wrapped.clear();delivered.clear();snitched=false;santaTurns=0;santaPos=null;turkeyCaught=0;hiddenRevealed.clear();turkeys=[];started=false;
if(santaTimer){clearInterval(santaTimer);santaTimer=null}
if(mode==='Thanksgiving')turkeys=[{x:1,y:1,caught:false},{x:6,y:1,caught:false}];
if(mode==='Easter')eggPositions=[{x:1,y:1},{x:6,y:1},{x:1,y:5},{x:6,y:5}];
}
function setRoom(r){
room=r;
if(r===cfg.main){x=4;y=3;old={x,y};msg('You entered '+cfg.rooms[0]+'.')}
else if(r===cfg.wrap){x=1;y=3;old={x,y};msg('You entered '+cfg.rooms[1]+'. Visit the stations!')}
else{x=0;y=3;old={x,y};msg('You are outside! Find your destination.')}
render();
}
function move(dx,dy){
if(!started)return;
let nx=x+dx,ny=y+dy;if(nx<0||nx>7||ny<0||ny>7)return;
if(room===cfg.outside&&cfg.outsideTrees.some(p=>p[0]===nx&&p[1]===ny))return;
old={x,y};x=nx;y=ny;
if(mode==='Christmas'&&santaTurns>0&&santaPos)moveSanta();
if(mode==='Thanksgiving'){
turkeys.forEach(t=>{if(!t.caught&&Math.random()<.45){let ds=[[1,0],[-1,0],[0,1],[0,-1],[0,0]],d=ds[Math.floor(Math.random()*ds.length)],tx=t.x+d[0],ty=t.y+d[1];if(tx>=0&&tx<8&&ty>=0&&ty<8&&!cfg.outsideTrees.some(p=>p[0]===tx&&p[1]===ty)){t.x=tx;t.y=ty}}});
}
if(mode==='Easter')eggPositions.forEach(p=>{if(Math.abs(x-p.x)+Math.abs(y-p.y)<=1)hiddenRevealed.add(p.x+','+p.y)});
render();
}
function moveSanta(){
if(!santaPos)return;
let dx=Math.sign(x-santaPos.x),dy=Math.sign(y-santaPos.y);
if(Math.abs(x-santaPos.x)>=Math.abs(y-santaPos.y))santaPos.x=Math.max(0,Math.min(7,santaPos.x+dx));
else santaPos.y=Math.max(0,Math.min(7,santaPos.y+dy));
}
function snitch(reason){
if(snitched)return;snitched=true;santaTurns=15;santaPos={x:7,y:0};msg('🦌 The reindeer snitched! Santa is coming! '+reason);$('chaser').textContent='🎅 Santa: 15';
if(santaTimer)clearInterval(santaTimer);
santaTimer=setInterval(()=>{
if(santaTurns<=0){clearInterval(santaTimer);santaTimer=null;$('chaser').textContent='🎅 Safe';msg('Santa has stopped chasing!');return}
santaTurns--;moveSanta();
if(santaTurns===0){$('chaser').textContent='🎅 Safe';msg('Santa has stopped chasing!')}
else $('chaser').textContent='🎅 Santa: '+santaTurns;
render();
},1200);
}
function interact(){
if(!started)return;
if(room===cfg.main){
if(x===cfg.listPos[0]&&y===cfg.listPos[1]){checked=true;msg(cfg.listText)}
else if(x===0&&y===3){setRoom(cfg.outside);return}
else if(x===7&&y===3){setRoom(cfg.wrap);return}
else if((x===2&&y===6)||(x===5&&y===6)){msg(x===2?cfg.helper1msg:cfg.helper2msg)}
else if(!checked)msg('Check the list before collecting anything!');
else if(mode==='Thanksgiving'){
let t=turkeys.find(t=>!t.caught&&t.x===x&&t.y===y);
if(t){t.caught=true;carried={name:'Turkey',kid:cfg.target,emoji:'🦃'};msg('🦃 You caught a turkey! Take it to the safe pen outside.')}
else msg('Get close to a turkey and press Catch!');
}else if(!carried){
if(mode==='Easter'){
let i=eggPositions.findIndex((p,index)=>p.x===x&&p.y===y&&!delivered.has('Egg '+(index+1)));
if(i>=0){let name='Egg '+(i+1);carried={name,kid:cfg.target,emoji:['🩷🥚','💙🥚','💛🥚','💜🥚'][i]};stations.clear();wrapped.delete(name);msg('🥚 You found '+name+'! Take it to the decorating room.')}
else msg('Search around the bushes for hidden eggs!');
}else{
let t=cfg.toys.find(t=>t[3]===x&&t[4]===y&&!delivered.has(t[0]));
if(t){carried={name:t[0],kid:t[1],emoji:t[2]};stations.clear();wrapped.delete(t[0]);msg('Picked up '+t[0]+' for '+t[1]+'.')}
else msg('Nothing to collect here. Look for the marked items!');
}
}else msg('You are already carrying something. Finish delivering it first.');
}else if(room===cfg.wrap){
if(x===0&&y===3){setRoom(cfg.main);return}
let s=cfg.stations.find(s=>s[2]===x&&s[3]===y);
if(s){
if(!carried)msg('Pick up an item before using the stations.');
else{stations.add(s[0]);msg(s[0]+' station visited! '+stations.size+'/4');if(stations.size===4){wrapped.add(carried.name);msg('✨ '+carried.name+' is ready!')}}
}else msg('Walk onto a station and press Interact.');
}else{
if(x===0&&y===3){setRoom(cfg.main);return}
if(x===7&&y===7){
if(mode==='Thanksgiving'){
if(!carried){msg('Catch a turkey first!');return}
turkeyCaught++;carried=null;msg('🦃 Turkey safely guided into the pen!');
if(turkeyCaught>=2){msg('🏆 YOU WON! Both turkeys are safe!');$('objective').textContent='Objective: Adventure complete!'}
}else{
if(!carried){msg('Pick up an item first!');return}
if(!checked){msg('Check the list first!');return}
if(mode==='Christmas'&&carried.kid!==cfg.target){snitch('Wrong toy delivered!');return}
if(!wrapped.has(carried.name)){if(mode==='Christmas')snitch('You delivered an unwrapped toy!');else msg('Visit all four stations before delivering!');return}
delivered.add(carried.name);msg('🎉 Delivered '+carried.name+'!');carried=null;stations.clear();
if(delivered.size>=cfg.goal){msg('🏆 YOU WON! Adventure complete!');$('objective').textContent='Objective: Adventure complete!'}
}
}else msg(mode==='Thanksgiving'?'Take the turkey to the safe pen in the bottom-right corner!':'Find your delivery basket outside!');
}
render();
}
function render(){
let ri=room===cfg.main?0:room===cfg.wrap?1:2;
$('roomname').textContent=cfg.rooms[ri];$('roomtag').textContent=cfg.tags[ri];
let complete=mode==='Thanksgiving'?turkeyCaught>=2:delivered.size>=cfg.goal;
$('objective').textContent=complete?'Objective: Adventure complete!':!checked?'Objective: Check the '+(mode==='Christmas'?'Nice List':mode==='Easter'?'Bunny List':'Guest List'):!carried?(mode==='Thanksgiving'?'Objective: Catch the escaped turkeys':'Objective: Collect your items'):room===cfg.wrap?'Objective: Visit all four stations':'Objective: Deliver your items';
$('progress').textContent=(mode==='Thanksgiving'?turkeyCaught:delivered.size)+'/'+cfg.goal;
$('childline').textContent=mode==='Christmas'?'Child: '+(checked?'Ava':'???')+' | Delivered: '+delivered.size+'/2':mode==='Easter'?'Eggs decorated and delivered: '+delivered.size+'/4':'Turkeys safely penned: '+turkeyCaught+'/2';
$('stationtop').classList.toggle('hide',room!==cfg.wrap);$('stationtop').textContent=(mode==='Christmas'?'🎁 Stations visited: ':'✨ Stations visited: ')+stations.size+'/4';
$('stationPanel').classList.toggle('hide',room!==cfg.wrap);$('stationTitle').textContent=cfg.stationTitle;
$('help').classList.toggle('hide',room!==cfg.main);$('helpTitle').textContent='Need help?';
$('helper1').textContent=cfg.helper1;$('helper2').textContent=cfg.helper2;
$('bag').textContent=carried?'🎒 '+carried.name+(wrapped.has(carried.name)?' (ready!)':''):'🎒 Empty';
$('follower').textContent=cfg.follower;
$('stationlist').textContent=cfg.stations.map(s=>(stations.has(s[0])?'✓ ':'○ ')+s[0]).join(' ');
$('chaser').textContent=mode==='Christmas'?(santaTurns?'🎅 Santa: '+santaTurns:'🎅 Safe'):cfg.chaser;
$('interact').textContent=mode==='Thanksgiving'?'Catch / Guide':'Interact';
$('drop').textContent=mode==='Thanksgiving'?'Release turkey':'Drop item';
let map=$('map');map.innerHTML='';
for(let yy=0;yy<8;yy++)for(let xx=0;xx<8;xx++){
let el=document.createElement('div');el.className='tile';let emoji='',label='';
if(room===cfg.main){
if(xx===0&&yy===3){el.classList.add('door');emoji='🚪';label=mode==='Christmas'?'OUTSIDE':mode==='Easter'?'MEADOW':'PASTURE'}
if(xx===7&&yy===3){el.classList.add('door');emoji='🚪';label=mode==='Christmas'?'WRAP':mode==='Easter'?'DECORATE':'BARN'}
if(xx===cfg.listPos[0]&&yy===cfg.listPos[1]){el.classList.add('special');emoji=mode==='Christmas'?'📜':mode==='Easter'?'🐰':'📋';label=mode==='Christmas'?'NICE LIST':mode==='Easter'?'BUNNY LIST':'GUEST LIST'}
if(xx===2&&yy===6){el.classList.add('special');emoji=mode==='Christmas'?'🧝':'🧑🌾';label=cfg.helper1.toUpperCase()}
if(xx===5&&yy===6){el.classList.add('special');emoji=mode==='Christmas'?'🧝':'🧑🌾';label=cfg.helper2.toUpperCase()}
if(checked&&mode==='Christmas'){l