LAST NATO PROMISE

Views: 106 • Nov 05, 2026
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Little Forest 🌿</title>

<style>
:root{
 --cream:#f5eedf;
 --paper:#fffaf0;
 --sage:#a8b59a;
 --green:#526b4d;
 --dark:#344b37;
 --moss:#7d9066;
 --brown:#94775b;
 --tan:#e8d7bd;
 --line:#d9c9ad;
 --shadow:rgba(65,76,49,.15);
}

*{box-sizing:border-box}

body{
 margin:0;
 color:var(--dark);
 font-family:Georgia,"Trebuchet MS",serif;
 background-color:var(--cream);
 background-image:
 radial-gradient(#c8b99b 0.7px,transparent 0.7px);
 background-size:18px 18px;
}

button,input,textarea{
 font-family:inherit;
}

header{
 background:linear-gradient(135deg,#d9e0c9,#b7c5a4,#e7d9c0);
 text-align:center;
 padding:42px 15px;
 border-bottom:5px dashed #f9f2e5;
}

.header-art{
 font-size:35px;
 letter-spacing:10px;
}

header h1{
 font-size:clamp(34px,7vw,55px);
 color:#435b40;
 margin:12px 0;
}

header p{
 color:#56684e;
}

nav{
 display:flex;
 justify-content:center;
 flex-wrap:wrap;
 gap:8px;
 padding:14px;
 background:#fdf8ed;
 position:sticky;
 top:0;
 z-index:20;
 box-shadow:0 3px 12px var(--shadow);
}

nav a{
 text-decoration:none;
 color:#526b4d;
 background:#e8eddd;
 padding:9px 13px;
 border-radius:20px;
 font-size:13px;
 font-weight:bold;
}

nav a:hover{
 background:#d4dfc7;
}

.container{
 width:92%;
 max-width:950px;
 margin:25px auto;
}

.card{
 background:var(--paper);
 border:2px solid white;
 border-radius:13px;
 padding:23px;
 margin-bottom:22px;
 box-shadow:4px 5px 13px var(--shadow);
 position:relative;
}

.card h2{
 color:#647b58;
 border-bottom:2px dashed var(--line);
 padding-bottom:10px;
 margin-top:0;
}

.card p{
 line-height:1.8;
}

.hero{
 display:grid;
 grid-template-columns:1fr 145px;
 align-items:center;
 gap:15px;
}

.mascot{
 background:#e8eddd;
 border:2px dashed #b2c29f;
 border-radius:50%;
 width:130px;
 height:130px;
 display:flex;
 align-items:center;
 justify-content:center;
 font-size:70px;
 margin:auto;
}

.info-grid{
 display:grid;
 grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
 gap:12px;
}

.info{
 background:#edf0e4;
 border:1px solid #dbe1d0;
 border-radius:10px;
 padding:14px;
}

.info:nth-child(2n){
 background:#f4eadb;
 border-color:#e9dac4;
}

.info:nth-child(3n){
 background:#e9eee9;
}

.info b{
 display:block;
 color:#637b57;
 margin-bottom:8px;
}

.tag{
 display:inline-block;
 background:#e5ebd9;
 color:#526b4d;
 padding:8px 13px;
 border-radius:20px;
 margin:4px;
 font-size:13px;
}

.sticker{
 position:absolute;
 top:13px;
 right:17px;
 font-size:25px;
}

.timeline{
 border-left:3px dashed #a8b59a;
 padding-left:18px;
 margin-left:8px;
}

.event{
 background:#f1eadc;
 border-radius:10px;
 padding:13px;
 margin-bottom:18px;
}

.secret{
 background:#f1eee2;
 border:2px dashed #9caa88;
}

.controls{
 position:fixed;
 right:12px;
 bottom:12px;
 z-index:40;
 display:flex;
 flex-direction:column;
 gap:7px;
}

button{
 background:#647b58;
 color:white;
 border:0;
 border-radius:20px;
 padding:11px 16px;
 cursor:pointer;
 font-weight:bold;
}

button:hover{
 background:#435b40;
}

button.secondary{
 background:#b49a78;
}

input,textarea{
 width:100%;
 border:1px solid #c9d1b9;
 border-radius:9px;
 padding:11px;
 background:#fffdf6;
 color:#435b40;
 margin:6px 0 12px;
}

textarea{
 resize:vertical;
 min-height:90px;
}

.editing [contenteditable="true"]{
 outline:2px dashed #81966e;
 background:#f0f3e8;
 border-radius:4px;
}

.editing [contenteditable="true"]:focus{
 outline:2px solid #647b58;
}

.gallery{
 display:grid;
 grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
 gap:15px;
}

.photo{
 background:white;
 padding:9px 9px 18px;
 box-shadow:2px 4px 9px var(--shadow);
 transform:rotate(-1deg);
}

.photo:nth-child(even){
 transform:rotate(2deg);
}

.photo img{
 width:100%;
 aspect-ratio:1/1;
 object-fit:cover;
 display:block;
}

.photo p{
 text-align:center;
 font-size:13px;
 margin:9px 0 0;
}

.photo button{
 width:100%;
 margin-top:8px;
}

.player{
 background:#e8eddd;
 padding:18px;
 border-radius:14px;
 text-align:center;
}

.player button{
 margin:4px;
}

.trackname{
 font-weight:bold;
 margin:12px 0;
}

.diary-gate{
 background:linear-gradient(140deg,#e5ead9,#f5ead7);
 border:3px dashed #9aaa83;
 border-radius:15px;
 padding:25px;
 text-align:center;
 max-width:480px;
 margin:15px auto;
}

.diary-gate .lock{
 font-size:55px;
}

.diary-entry{
 background:#fffaf0;
 border-left:4px solid #93a47d;
 border-radius:8px;
 padding:15px;
 margin:13px 0;
}

.diary-entry small{
 color:#8b987d;
}

.guest-entry{
 background:#edf0e4;
 border-radius:10px;
 padding:13px;
 margin:12px 0;
 border-left:4px solid #849773;
}

.footer{
 text-align:center;
 padding:30px;
 color:#647b58;
}

.small{
 font-size:12px;
 color:#8c927e;
}

.hidden{
 display:none!important;
}

#toast{
 position:fixed;
 bottom:15px;
 left:50%;
 transform:translateX(-50%);
 background:#435b40;
 color:white;
 padding:12px 20px;
 border-radius:20px;
 display:none;
 z-index:100;
}

@media(max-width:600px){
 .hero{
  grid-template-columns:1fr;
  text-align:center;
 }
 .mascot{
  width:110px;
  height:110px;
 }
 .card{
  padding:17px;
 }
 nav{
  position:relative;
 }
}
</style>
</head>

<body>

<header>
 <div class="header-art">🌿 🍄 🐻 🍃</div>
 <h1 contenteditable="false" data-edit>My Little Forest</h1>
 <p contenteditable="false" data-edit>
  A little corner of the internet where my stories grow.
 </p>
 <p>✧・゚: *✧・゚:* 🌲 *:・゚✧*:・゚✧</p>
</header>

<nav>
 <a href="#home">Home</a>
 <a href="#about">About Me</a>
 <a href="#special">Talents</a>
 <a href="#life">My Life</a>
 <a href="#experience">Memories</a>
 <a href="#favorites">Favorites</a>
 <a href="#gallery">Gallery</a>
 <a href="#music">Music</a>
 <a href="#diary">Diary 🔒</a>
 <a href="#guestbook">Guestbook</a>
 <a href="#dreams">Dreams</a>
</nav>

<div class="container">

<!-- HOME -->
<section class="card hero" id="home">
 <div>
  <h2>☘ Welcome, I'm
   <span contenteditable="false" data-edit>Your Name</span>!
  </h2>
  <p contenteditable="false" data-edit>
   Hello! Welcome to my little forest. This is my personal
   space where I keep my memories, interests, dreams,
   experiences, and little things that make me who I am.
  </p>
  <p contenteditable="false" data-edit>
   Take a little walk around and get to know me!
  </p>
  <span class="tag">🌱 Dreamer</span>
  <span class="tag">🍄 Creative</span>
  <span class="tag">🧸 Just Me</span>
 </div>
 <div class="mascot">🐻</div>
</section>

<!-- ABOUT -->
<section class="card" id="about">
 <div class="sticker">🌼</div>
 <h2>🌿 About Me</h2>
 <p contenteditable="false" data-edit>
  Let me introduce myself! I am someone with my own
  personality, interests, dreams, and experiences.
  I am still growing and discovering who I want to become.
 </p>

 <div class="info-grid">
  <div class="info"><b>♡ Full Name</b><span contenteditable="false" data-edit>Your full name</span></div>
  <div class="info"><b>♡ Nickname</b><span contenteditable="false" data-edit>Your nickname</span></div>
  <div class="info"><b>🎂 Birthday</b><span contenteditable="false" data-edit>Month / Day</span></div>
  <div class="info"><b>🎈 Age</b><span contenteditable="false" data-edit>Your age</span></div>
  <div class="info"><b>📍 Where I Live</b><span contenteditable="false" data-edit>Your city or hometown</span></div>
  <div class="info"><b>🎓 School / Occupation</b><span contenteditable="false" data-edit>Your school or occupation</span></div>
  <div class="info"><b>🌈 Personality</b><span contenteditable="false" data-edit>Describe yourself</span></div>
  <div class="info"><b>💭 My Motto</b><span contenteditable="false" data-edit>Your favorite quote</span></div>
 </div>
</section>

<!-- SPECIALTIES -->
<section class="card" id="special">
 <div class="sticker">⭐</div>
 <h2>✧ My Specialties & Talents</h2>
 <p contenteditable="false" data-edit>
  The things I am good at, the skills I have learned,
  and the activities I enjoy.
 </p>
 <div class="info-grid">
  <div class="info"><b>🎤 Talent #1</b><span contenteditable="false" data-edit>Example: Public speaking</span></div>
  <div class="info"><b>✍️ Talent #2</b><span contenteditable="false" data-edit>Example: Writing</span></div>
  <div class="info"><b>🎨 Talent #3</b><span contenteditable="false" data-edit>Example: Drawing</span></div>
  <div class="info"><b>💡 Something I'm good at</b><span contenteditable="false" data-edit>Write here</span></div>
 </div>
 <h3>My Skills</h3>
 <div contenteditable="false" data-edit>
  <span class="tag">Communication</span>
  <span class="tag">Creativity</span>
  <span class="tag">Leadership</span>
  <span class="tag">Problem Solving</span>
 </div>
</section>

<!-- LIFE -->
<section class="card" id="life">
 <div class="sticker">🏡</div>
 <h2>🍃 My Little Life</h2>
 <div class="info-grid">
  <div class="info"><b>🏡 My Hometown</b><span contenteditable="false" data-edit>Where I grew up</span></div>
  <div class="info"><b>👨‍👩‍👧 My Family</b><span contenteditable="false" data-edit>Tell something about your family</span></div>
  <div class="info"><b>👥 My Friends</b><span contenteditable="false" data-edit>Tell something about your friends</span></div>
  <div class="info"><b>📚 My Daily Life</b><span contenteditable="false" data-edit>Describe your usual day</span></div>
 </div>
</section>

<!-- EXPERIENCES -->
<section class="card" id="experience">
 <div class="sticker">📖</div>
 <h2>♡ My Experiences & Memories</h2>
 <p contenteditable="false" data-edit>
  Every experience helps shape the person I am today.
  Here are some moments I want to remember.
 </p>
 <div class="timeline">
  <div class="event">
   <b>🌱 A memorable beginning</b>
   <p contenteditable="false" data-edit>Write about an important moment.</p>
  </div>
  <div class="event">
   <b>🏆 An achievement</b>
   <p contenteditable="false" data-edit>Write about something you are proud of.</p>
  </div>
  <div class="event">
   <b>💚 A special memory</b>
   <p contenteditable="false" data-edit>Write about a memory you will never forget.</p>
  </div>
  <div class="event">
   <b>🦋 A lesson I learned</b>
   <p contenteditable="false" data-edit>Write about a challenge that changed you.</p>
  </div>
 </div>
</section>

<!-- FAVORITES -->
<section class="card" id="favorites">
 <div class="sticker">🍓</div>
 <h2>♡ My Favorite Things</h2>
 <div class="info-grid">
  <div class="info"><b>🎵 Favorite Song</b><span contenteditable="false" data-edit>Your favorite song</span></div>
  <div class="info"><b>🎬 Favorite Movie</b><span contenteditable="false" data-edit>Your favorite movie</span></div>
  <div class="info"><b>🍰 Favorite Food</b><span contenteditable="false" data-edit>Your favorite food</span></div>
  <div class="info"><b>🎨 Favorite Color</b><span contenteditable="false" data-edit>Your favorite color</span></div>
  <div class="info"><b>🐱 Favorite Animal</b><span contenteditable="false" data-edit>Your favorite animal</span></div>
  <div class="info"><b>🎮 Favorite Game</b><span contenteditable="false" data-edit>Your favorite game</span></div>
  <div class="info"><b>📺 Favorite Show</b><span contenteditable="false" data-edit>Your favorite show</span></div>
  <div class="info"><b>🌎 Favorite Place</b><span contenteditable="false" data-edit>Your favorite place</span></div>
 </div>
</section>

<!-- GALLERY -->
<section class="card" id="gallery">
 <div class="sticker">📸</div>
 <h2>📷 My Photo Scrapbook</h2>
 <p>Little snapshots of my life. Add your favorite pictures!</p>

 <label for="photoInput">Choose photos from your device:</label>
 <input type="file" id="photoInput" accept="image/*" multiple>
 <div class="gallery" id="galleryGrid"></div>
 <p class="small">Photos are saved in this browser when storage allows.</p>
</section>

<!-- MUSIC -->
<section class="card" id="music">
 <div class="sticker">🎶</div>
 <h2>🎵 My Little Music Corner</h2>
 <p>Music that reminds me of different moments in my life.</p>

 <div class="player">
  <div style="font-size:40px">🌲 🎧 🍃</div>
  <div class="trackname" id="trackName">Choose a song to begin ♡</div>
  <audio id="audio" controls style="width:100%"></audio>
  <div>
   <button onclick="previousSong()">⏮ Previous</button>
   <button onclick="playSong()">▶ Play</button>
   <button onclick="pauseSong()">⏸ Pause</button>
   <button onclick="nextSong()">Next ⏭</button>
  </div>
  <label for="musicInput">Add your music files:</label>
  <input type="file" id="musicInput" accept="audio/*" multiple>
  <div id="playlist"></div>
 </div>
 <p class="small">Music files are selected from your device and may need to be added again after refreshing.</p>
</section>

<!-- DIARY -->
<section class="card secret" id="diary">
 <div class="sticker">🔐</div>
 <h2>📔 My Secret Diary</h2>

 <div id="diaryLocked" class="diary-gate">
  <div class="lock">🔒</div>
  <h3>This little book is private.</h3>
  <p>Only someone who knows the secret password can enter.</p>
  <label for="diaryPassword">Enter your password</label>
  <input type="password" id="diaryPassword" placeholder="Enter password..." autocomplete="off">
  <button onclick="unlockDiary()">🔑 Unlock My Diary</button>
  <p id="passwordError" style="color:#a64e4e"></p>
 </div>

 <div id="diaryUnlocked" class="hidden">
  <div style="text-align:center;font-size:35px">🗝️ 📖 🌿</div>
  <h3>Welcome back, dear diary.</h3>
  <label for="diaryTitle">Entry title</label>
  <input id="diaryTitle" placeholder="A little title for today...">
  <label for="diaryText">Write your thoughts</label>
  <textarea id="diaryText" placeholder="Dear diary, today..."></textarea>
  <button onclick="saveDiaryEntry()">Save Entry ♡</button>
  <button class="secondary" onclick="lockDiary()">🔒 Lock Diary</button>
  <h3>My Diary Entries</h3>
  <div id="diaryEntries"></div>
 </div>
 <p class="small">Reminder: this password screen is a simple browser lock, not strong encryption. Don't use it for highly sensitive information.</p>
</section>

<!-- CRUSH -->
<section class="card secret">
 <div class="sticker">💌</div>
 <h2>🌷 A Little Secret...</h2>
 <p contenteditable="false" data-edit>
  Everyone has someone who makes their day a little brighter.
  This is my little corner for talking about that special person.
 </p>
 <div class="info-grid">
  <div class="info"><b>💌 Their Name / Nickname</b><span contenteditable="false" data-edit>Write here</span></div>
  <div class="info"><b>🌷 When I Started Liking Them</b><span contenteditable="false" data-edit>Write here</span></div>
  <div class="info"><b>💭 What I Like About Them</b><span contenteditable="false" data-edit>Write here</span></div>
  <div class="info"><b>🦋 Our Story</b><span contenteditable="false" data-edit>Write your story here</span></div>
 </div>
</section>

<!-- GUESTBOOK -->
<section class="card" id="guestbook">
 <div class="sticker">✉️</div>
 <h2>💌 Forest Guestbook</h2>
 <p>Leave a little note for me! Thank you for visiting my forest.</p>

 <label for="guestName">Your name or nickname</label>
 <input id="guestName" placeholder="Who are you?">
 <label for="guestMessage">Your message</label>
 <textarea id="guestMessage" placeholder="Write a little message..."></textarea>
 <button onclick="addGuest()">Leave a Message 🌿</button>

 <h3>Messages from Visitors</h3>
 <div id="guestEntries"></div>
</section>

<!-- DREAMS -->
<section class="card" id="dreams">
 <div class="sticker">☁️</div>
 <h2>✨ My Dreams & Future</h2>
 <div class="info-grid">
  <div class="info"><b>🌟 My Biggest Dream</b><span contenteditable="false" data-edit>Write your biggest dream</span></div>
  <div class="info"><b>🎓 Career Goal</b><span contenteditable="false" data-edit>What career do you want?</span></div>
  <div class="info"><b>✈️ Places I Want to Visit</b><span contenteditable="false" data-edit>List your dream destinations</span></div>
  <div class="info"><b>💌 A Message to Future Me</b><span contenteditable="false" data-edit>Write a message to yourself</span></div>
 </div>
</section>

<section class="card">
 <h2>🍄 Random Facts About Me</h2>
 <p contenteditable="false" data-edit>
  1. I have a lot of random thoughts.
  <br>2. I enjoy learning new things.
  <br>3. I have dreams I want to achieve.
  <br>4. I love making memories.
  <br>5. I am still figuring myself out.
 </p>
</section>

</div>

<footer class="footer">
 <h2>Made with ♡ by Me</h2>
 <p>Thank you for visiting my little forest!</p>
 <p>🌿 🍄 🐻 🌼 🍃</p>
 <p class="small">A little world filled with pieces of me.</p>
</footer>

<div class="controls">
 <button onclick="toggleEdit()" id="editBtn">✏️ Edit Website</button>
 <button onclick="saveWebsite()">💾 Save Changes</button>
 <button class="secondary" onclick="resetWebsite()">↩ Reset Profile Text</button>
</div>

<div id="toast"></div>

<script>
"use strict";

/* GENERAL PROFILE EDITING */

const editable=document.querySelectorAll("[data-edit]");
let editing=false;

function toggleEdit(){
 editing=!editing;
 document.body.classList.toggle("editing",editing);

 editable.forEach(item=>{
  item.contentEditable=editing?"true":"false";
 });

 document.getElementById("editBtn").textContent=
 editing?"✓ Finish Editing":"✏️ Edit Website";
}

function saveWebsite(){
 const data=[];
 editable.forEach(item=>data.push(item.innerHTML));
 localStorage.setItem("forestProfile",JSON.stringify(data));
 toast("Your profile has been saved! 🌿");
}

function loadWebsite(){
 const saved=localStorage.getItem("forestProfile");
 if(!saved)return;
 try{
  const data=JSON.parse(saved);
  editable.forEach((item,index)=>{
   if(data[index]!==undefined)item.innerHTML=data[index];
  });
 }catch(e){}
}

function resetWebsite(){
 if(!confirm("Reset your profile text?"))return;
 localStorage.removeItem("forestProfile");
 location.reload();
}

/* NOTIFICATION */

function toast(text){
 const box=document.getElementById("toast");
 box.textContent=text;
 box.style.display="block";
 clearTimeout(window.toastTimer);
 window.toastTimer=setTimeout(()=>box.style.display="none",2500);
}

/* PHOTO GALLERY */

const photoInput=document.getElementById("photoInput");
const galleryGrid=document.getElementById("galleryGrid");
let photos=[];

function loadPhotos(){
 try{
  photos=JSON.parse(localStorage.getItem("forestPhotos")||"[]");
 }catch(e){photos=[]}
 renderPhotos();
}

function renderPhotos(){
 galleryGrid.innerHTML="";
 photos.forEach((photo,index)=>{
  const card=document.createElement("div");
  card.className="photo";

  const img=document.createElement("img");
  img.src=photo.src;
  img.alt=photo.caption||"My photo";

  const caption=document.createElement("p");
  caption.textContent=photo.caption||"A little memory ♡";

  const edit=document.createElement("button");
  edit.textContent="Edit caption";
  edit.onclick=()=>{
   const value=prompt("Write a caption:",photo.caption||"");
   if(value===null)return;
   photo.caption=value;
   savePhotos();
   renderPhotos();
  };

  const remove=document.createElement("button");
  remove.textContent="Remove";
  remove.className="secondary";
  remove.onclick=()=>{
   photos.splice(index,1);
   savePhotos();
   renderPhotos();
  };

  card.append(img,caption,edit,remove);
  galleryGrid.appendChild(card);
 });
}

function savePhotos(){
 try{
  localStorage.setItem("forestPhotos",JSON.stringify(photos));
 }catch(e){
  toast("Storage is full. Try smaller photos.");
 }
}

photoInput.addEventListener("change",function(){
 const files=Array.from(this.files||[]);
 files.forEach(file=>{
  if(!file.type.startsWith("image/"))return;
  const reader=new FileReader();
  reader.onload=()=>{
   const image=new Image();
   image.onload=()=>{
    const canvas=document.createElement("canvas");
    const max=900;
    const scale=Math.min(1,max/image.width,max/image.height);
    canvas.width=Math.round(image.width*scale);
    canvas.height=Math.round(image.height*scale);
    const ctx=canvas.getContext("2d");
    ctx.drawImage(image,0,0,canvas.width,canvas.height);
    const src=canvas.toDataURL("image/jpeg",.75);
    photos.push({src:src,caption:file.name.replace(/\.[^/.]+$/,"")});
    savePhotos();
    renderPhotos();
   };
   image.src=reader.result;
  };
  reader.readAsDataURL(file);
 });
 this.value="";
});

/* MUSIC PLAYER */

const audio=document.getElementById("audio");
const musicInput=document.getElementById("musicInput");
const trackName=document.getElementById("trackName");
const playlist=document.getElementById("playlist");
let songs=[];
let currentSong=0;

musicInput.addEventListener("change",function(){
 Array.from(this.files||[]).forEach(file=>{
  songs.push({name:file.name,url:URL.createObjectURL(file)});
 });
 renderPlaylist();
 if(songs.length&&audio.paused)playTrack(songs.length-1);
 this.value="";
});

function renderPlaylist(){
 playlist.innerHTML="";
 songs.forEach((song,index)=>{
  const btn=document.createElement("button");
  btn.textContent=(index+1)+". "+song.name;
  btn.className="secondary";
  btn.onclick=()=>playTrack(index);
  playlist.appendChild(btn);
 });
}

function playTrack(index){
 if(!songs.length)return;
 currentSong=(index+songs.length)%songs.length;
 audio.src=songs[currentSong].url;
 trackName.textContent="🎵 "+songs[currentSong].name;
 audio.play().catch(()=>toast("Tap Play to start the song."));
}

function playSong(){
 if(!songs.length){
  toast("Choose music files first!");
  return;
 }
 if(!audio.src)playTrack(currentSong);
 else audio.play();
}

function pauseSong(){audio.pause();}
function nextSong(){playTrack(currentSong+1);}
function previousSong(){playTrack(currentSong-1);}

audio.addEventListener("ended",nextSong);

/* SECRET DIARY */

const DIARY_PASSWORD="0810";
let diaryOpen=false;

const diaryLocked=document.getElementById("diaryLocked");
const diaryUnlocked=document.getElementById("diaryUnlocked");
const diaryPassword=document.getElementById("diaryPassword");
const diaryEntries=document.getElementById("diaryEntries");

function unlockDiary(){
 if(diaryPassword.value===DIARY_PASSWORD){
  diaryOpen=true;
  diaryLocked.classList.add("hidden");
  diaryUnlocked.classList.remove("hidden");
  document.getElementById("passwordError").textContent="";
  diaryPassword.value="";
  renderDiary();
  toast("Welcome to your secret diary! 🍃");
 }else{
  document.getElementById("passwordError").textContent=
   "Incorrect password. Try again.";
  diaryPassword.value="";
 }
}

diaryPassword.addEventListener("keydown",e=>{
 if(e.key==="Enter")unlockDiary();
});

function lockDiary(){
 diaryOpen=false;
 diaryUnlocked.classList.add("hidden");
 diaryLocked.classList.remove("hidden");
 document.getElementById("diaryTitle").value="";
 document.getElementById("diaryText").value="";
}

function getDiaries(){
 try{return JSON.parse(localStorage.getItem("forestDiary")||"[]");}
 catch(e){return [];}
}

function saveDiaryEntry(){
 if(!diaryOpen)return;

 const title=document.getElementById("diaryTitle").value.trim();
 const content=document.getElementById("diaryText").value.trim();

 if(!content){
  toast("Write something first!");
  return;
 }

 const entries=getDiaries();
 entries.unshift({
  title:title||"Untitled entry",
  content:content,
  date:new Date().toLocaleString()
 });

 localStorage.setItem("forestDiary",JSON.stringify(entries));
 document.getElementById("diaryTitle").value="";
 document.getElementById("diaryText").value="";
 renderDiary();
 toast("Your diary entry has been saved! 📖");
}

function renderDiary(){
 if(!diaryOpen)return;
 const entries=getDiaries();
 diaryEntries.innerHTML="";

 if(!entries.length){
  diaryEntries.textContent="No entries yet. Write your first little story!";
  return;
 }

 entries.forEach((entry,index)=>{
  const box=document.createElement("div");
  box.className="diary-entry";

  const title=document.createElement("h3");
  title.textContent="📖 "+entry.title;

  const date=document.createElement("small");
  date.textContent=entry.date;

  const content=document.createElement("p");
  content.style.whiteSpace="pre-wrap";
  content.textContent=entry.content;

  const remove=document.createElement("button");
  remove.textContent="Delete entry";
  remove.className="secondary";
  remove.onclick=()=>{
   if(!confirm("Delete this diary entry?"))return;
   const list=getDiaries();
   list.splice(index,1);
   localStorage.setItem("forestDiary",JSON.stringify(list));
   renderDiary();
  };

  box.append(title,date,content,remove);
  diaryEntries.appendChild(box);
 });
}

/* GUESTBOOK */

function getGuests(){
 try{return JSON.parse(localStorage.getItem("forestGuests")||"[]");}
 catch(e){return [];}
}

function addGuest(){
 const name=document.getElementById("guestName").value.trim();
 const message=document.getElementById("guestMessage").value.trim();

 if(!name||!message){
  toast("Please enter your name and message.");
  return;
 }

 const entries=getGuests();
 entries.unshift({
  name:name,
  message:message,
  date:new Date().toLocaleString()
 });

 localStorage.setItem("forestGuests",JSON.stringify(entries));
 document.getElementById("guestName").value="";
 document.getElementById("guestMessage").value="";
 renderGuests();
 toast("Your message has been added! 💌");
}

function renderGuests(){
 const box=document.getElementById("guestEntries");
 box.innerHTML="";
 const entries=getGuests();

 if(!entries.length){
  box.textContent="No messages yet. Be the first to leave one!";
  return;
 }

 entries.forEach(entry=>{
  const item=document.createElement("div");
  item.className="guest-entry";

  const name=document.createElement("b");
  name.textContent="🌿 "+entry.name;

  const date=document.createElement("small");
  date.textContent=" — "+entry.date;

  const msg=document.createElement("p");
  msg.textContent=entry.message;

  item.append(name,date,msg);
  box.appendChild(item);
 });
}

/* START */

loadWebsite();
loadPhotos();
renderGuests();
lockDiary();

</script>
</body>
</html>