<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Pastelito 💗</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
background: linear-gradient(145deg,#ffe6f0,#f8c5df,#fce4fa);
font-family: Georgia,serif;
color: #a83d72;
text-align: center;
overflow: hidden;
}
.screen {
min-height: 100vh;
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 22px;
}
.screen.active { display: flex; }
h1 { font-size: 29px; }
p { line-height: 1.6; }
button {
border: none;
border-radius: 30px;
background: #e95d9c;
color: white;
padding: 15px 28px;
font-size: 17px;
font-weight: bold;
margin-top: 25px;
box-shadow: 0 6px 15px #c84d8750;
cursor: pointer;
}
button:active { transform: scale(.95); }
.heart {
position: fixed;
bottom: -40px;
pointer-events: none;
animation: floatUp 5s linear forwards;
z-index: 10;
}
@keyframes floatUp {
to {
transform: translateY(-110vh) rotate(360deg);
opacity: 0;
}
}
#counter {
font-family: Arial,sans-serif;
font-size: 14px;
margin-top: 15px;
}
.bar {
width: 220px;
height: 8px;
background: #ffffffaa;
border-radius: 20px;
margin: 12px auto 25px;
overflow: hidden;
}
#progress {
width: 0%;
height: 100%;
background: #e95d9c;
transition: width .5s;
}
#stage {
width: 100%;
height: 280px;
display: flex;
align-items: center;
justify-content: center;
perspective: 900px;
}
.gift {
position: relative;
width: min(68vw,250px);
aspect-ratio: 1.35;
animation: appear .7s ease;
cursor: pointer;
transform-style: preserve-3d;
}
.gift-body {
position: absolute;
bottom: 0;
width: 100%;
height: 75%;
background: linear-gradient(120deg,#ffacd0,#ee6da5);
border: 3px solid #fff0f7;
border-radius: 7px 7px 13px 13px;
box-shadow: 0 14px 24px #a73c7044;
}
.gift-ribbon {
position: absolute;
left: 43%;
height: 100%;
width: 14%;
background: #fff0b8;
}
.gift-lid {
position: absolute;
z-index: 3;
left: -5%;
top: 18%;
width: 110%;
height: 32%;
background: linear-gradient(120deg,#ffc5df,#ff8ab8);
border: 3px solid white;
border-radius: 6px;
transform-origin: left bottom;
transition: transform 1s ease;
box-shadow: 0 4px 8px #a73c7044;
}
.gift-bow {
position: absolute;
z-index: 5;
top: -12%;
left: 50%;
transform: translateX(-50%);
font-size: clamp(38px,12vw,60px);
transition: .7s;
}
.gift.open .gift-lid {
transform: translate(-20px,-100px) rotate(-35deg);
}
.gift.open .gift-bow {
opacity: 0;
transform: translate(-50%,-100px);
}
#tap {
font-size: 17px;
animation: pulse 1.4s infinite;
}
@keyframes pulse {
50% { opacity: .45; }
}
@keyframes appear {
from { opacity: 0; transform: scale(.4); }
to { opacity: 1; transform: scale(1); }
}
#final h1 {
color: #d43e87;
font-size: clamp(27px,8vw,40px);
line-height: 1.5;
}
#final .big {
font-size: 65px;
animation: pulse 1.5s infinite;
}
#final p {
font-size: 21px;
font-weight: bold;
color: #bd4783;
}
</style>
</head>
<body>
<!-- BIENVENIDA -->
<section class="screen active" id="welcome">
<div style="font-size:75px">💗🎀💗</div>
<h1>Hola, pastelito...</h1>
<p>
Tengo algo preparado para ti.<br>
Pero tendrás que descubrirlo poco a poco.
</p>
<button onclick="start()">DESCUBRIR MI SORPRESA 💝</button>
<p style="font-size:13px">Hecho con muchísimo cariño ✨</p>
</section>
<!-- CAJAS -->
<section class="screen" id="game">
<h1 id="title">Una cajita para ti 💕</h1>
<div id="counter">CAJA 1 DE 10</div>
<div class="bar">
<div id="progress"></div>
</div>
<div id="stage">
<div class="gift" id="gift" onclick="openBox()">
<div class="gift-bow">🎀</div>
<div class="gift-lid"></div>
<div class="gift-body">
<div class="gift-ribbon"></div>
</div>
</div>
</div>
<div id="tap">Toca la caja para abrirla 🎁</div>
</section>
<!-- MENSAJE FINAL -->
<section class="screen" id="final">
<div class="big">💗✨💗</div>
<h1>
I LOVE SOOOOO<br>
MUUUUCH PRETTY,
</h1>
<p>
NUNCA LO OLVIDES<br>
PASTELITO 💕✨🫶
</p>
<div style="font-size:55px">🌷💝🌷</div>
<p style="font-size:16px;font-weight:normal">
Porque hay personas que merecen<br>
recordatorios bonitos. 💗
</p>
<button onclick="restart()">VOLVER A ABRIR 💕</button>
</section>
<script>
let current = 0;
let busy = false;
function show(id) {
document.querySelectorAll(".screen").forEach(s => {
s.classList.remove("active");
});
document.getElementById(id).classList.add("active");
}
function start() {
current = 0;
show("game");
nextBox();
}
function nextBox() {
current++;
document.getElementById("counter").textContent =
"CAJA " + current + " DE 10";
document.getElementById("progress").style.width =
(current * 10) + "%";
document.getElementById("title").textContent =
current === 10
? "¡La última cajita! 💗"
: "¡Hay otra dentro! 💝";
const stage = document.getElementById("stage");
stage.innerHTML = "";
const gift = document.createElement("div");
gift.className = "gift";
gift.id = "gift";
let size = Math.max(90,250 - (current - 1) * 17);
gift.style.width = size + "px";
gift.innerHTML = `
<div class="gift-bow">🎀</div>
<div class="gift-lid"></div>
<div class="gift-body">
<div class="gift-ribbon"></div>
</div>
`;
gift.onclick = openBox;
stage.appendChild(gift);
document.getElementById("tap").textContent =
"Toca la caja para abrirla 🎁";
}
function openBox() {
if (busy) return;
busy = true;
const gift = document.getElementById("gift");
gift.classList.add("open");
document.getElementById("tap").textContent =
"Abriendo tu sorpresa... 💗";
setTimeout(() => {
if (current >= 10) {
showFinal();
} else {
nextBox();
busy = false;
}
}, 1100);
}
function showFinal() {
show("final");
busy = false;
for (let i = 0; i < 60; i++) {
setTimeout(makeHeart, i * 90);
}
}
function makeHeart() {
const h = document.createElement("div");
h.className = "heart";
const symbols = ["💕","💗","💖","✨","🫶","🌸"];
h.textContent =
symbols[Math.floor(Math.random() * symbols.length)];
h.style.left = Math.random() * 100 + "vw";
h.style.fontSize = (20 + Math.random() * 25) + "px";
h.style.animationDuration = (3 + Math.random() * 3) + "s";
document.body.appendChild(h);
setTimeout(() => h.remove(), 6500);
}
function restart() {
current = 0;
busy = false;
document.getElementById("progress").style.width = "0%";
show("welcome");
}
</script>
</body>
</html>