const nodes = { start: { text: `Voice: Wake up alice! they are coming. you need to find your way out NOW please... You find yourself on a little cute bed, you see out of the window into the fog, you turn to see whom is speaking to only find a door.`, choices: [ { idx: 'A', text: 'You silently walk up to the door.', next: 'door' }, { idx: 'B', text: 'Poke your head out of the window to see what\'s there.', next: 'window' }, { idx: 'C', text: 'In a panic you hide under the bed', next: 'bed' }, ] }, door: { text: `You press your ear against the wood. Silence. Then — footsteps, slow and deliberate, getting closer from the other side.`, choices: [ { idx: 'A', text: 'Open the door.', next: 'door' }, { idx: 'B', text: 'Step back and hide under the bed.', next: 'bed' }, { idx: 'C', text: 'Go to the window now', next: 'highrise' }, ] }, window: { text: `The fog shifts. Below you, shapes move through it — too tall, too still. One of them looks up.`, choices: [ { idx: 'A', text: 'Duck back inside immediately.', next: 'start' }, { idx: 'B', text: 'Keep watching. You need to know what they are.', next: 'highrise' }, ] }, bed: { text: `you feel silent and place your ear against the floor listen to noice below. A deep voice you seem to reconise talk, you cant make it out. You turn your head to use the other ear, you see a old book in the corner.`, choices: [ { idx: 'A', text: 'Pickup the book', next: 'book'}, { idx: 'B', text: 'wait, consentrait to listend closely to the words.', next: 'start' }, { idx: 'C', text: 'go to the window and see ', next: 'window' }, { idx: 'D', text: 'leave to walk to the door', next: 'door' }, ] }, book: { text: `The book is old and dusty as one may expect, but underneath that. A rare bueaty you have never seen before.`, choices: [ { idx: 'A', text: 'go to the window and see ', next: 'window' }, { idx: 'B', text: 'leave to walk to the door', next: 'door' }, ] }, wait: { text: `You hear the man say: "she is mine to keep" unsure of the meaning of this. You quickly find yourself exposed to the room to choice a path. `, choices: [ { idx: 'A', text: 'go to the window and see ', next: 'window' }, { idx: 'B', text: 'leave to walk to the door', next: 'door' }, ] }, highrise: { text: `your eyes get in focus and see stears below, you find yourself on a highrise building. two people a talking on the ground below.`, choices: [ {idx: 'A', text: 'walk out to small staers balcany', next: 'window'}, {idx: 'B', text: 'Go back to the door', next: 'window'} ] } }; function goTo(nodeId) { const node = nodes[nodeId]; if (!node) return; document.getElementById('story-text').innerText = node.text; const choicesEl = document.getElementById('choices'); choicesEl.innerHTML = ''; node.choices.forEach(c => { const btn = document.createElement('button'); btn.className = 'choice-btn'; btn.innerHTML = `${c.idx}${c.text}`; btn.onclick = () => goTo(c.next); choicesEl.appendChild(btn); }); } goTo('start');