* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --rosa: #ff4d7d;
  --rosa2: #ff8fab;
  --crema: #fff8f3;
  --texto: #5a2a3a;
}

html, body { min-height: 100%; }

body {
  font-family: 'Poppins', sans-serif;
  color: var(--texto);
  background: linear-gradient(160deg, #ffe0e8 0%, #ffb3c6 50%, #ff8fab 100%) fixed;
  overflow-x: hidden;
}

main { position: relative; z-index: 1; }

/* ---------- Pantallas ---------- */
.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px 18px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.screen.active { display: flex; animation: fadeIn .7s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.card {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(6px);
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 15px 40px rgba(200, 50, 90, .25);
}

h1, h2 { font-family: 'Dancing Script', cursive; color: var(--rosa); line-height: 1.15; }
h1 { font-size: 2.6rem; margin: 10px 0; }
h2 { font-size: 2rem; margin-bottom: 16px; }
p { line-height: 1.6; margin: 10px 0; }
hr { border: none; border-top: 2px dashed #ffc2d1; margin: 22px 0; }
.small { font-size: .85rem; opacity: .75; }
.hidden { display: none !important; }

.btn {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--rosa), #ff7096);
  border: none;
  border-radius: 50px;
  padding: 14px 32px;
  margin-top: 18px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 77, 125, .4);
  transition: transform .2s;
}
.btn:active { transform: scale(.95); }
.btn.ghost { background: #fff; color: var(--rosa); border: 2px solid var(--rosa2); box-shadow: none; }

.big-heart { font-size: 4rem; animation: beat 1.3s infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.18); }
  30% { transform: scale(1); }
  45% { transform: scale(1.12); }
}

/* ---------- Corazones de fondo ---------- */
#bg-hearts { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#bg-hearts span { position: absolute; bottom: -60px; opacity: .45; animation: floatUp linear infinite; }
@keyframes floatUp { to { transform: translateY(-115vh) rotate(40deg); opacity: 0; } }

/* ---------- Música ---------- */
#music-btn {
  position: fixed; top: 14px; right: 14px; z-index: 300;
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: #fff; font-size: 1.3rem; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
}
#music-btn.off { opacity: .45; }

/* ---------- Juego ---------- */
#s-game { justify-content: flex-start; padding: 0; height: 100vh; height: 100dvh; }
.game-hud { position: relative; z-index: 2; width: 100%; padding: 18px 20px; background: rgba(255, 255, 255, .75); }
.game-hud p { margin: 0; }
.bar { height: 14px; background: #ffe0e8; border-radius: 10px; overflow: hidden; margin-top: 8px; }
#bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--rosa2), var(--rosa)); transition: width .3s; }
#game-area { position: relative; flex: 1; width: 100%; overflow: hidden; touch-action: none; user-select: none; }

.falling {
  position: absolute; top: -10%;
  padding: 8px; line-height: 1;
  cursor: pointer; user-select: none;
  animation: fall linear forwards;
}
@keyframes fall { from { top: -10%; } to { top: 105%; } }
.falling.pop { animation: pop .35s ease-out forwards; }
@keyframes pop { to { transform: scale(2.2); opacity: 0; } }

.float-text {
  position: fixed; z-index: 50; font-weight: 700; font-size: 1.2rem;
  color: var(--rosa); pointer-events: none;
  animation: rise .8s ease-out forwards;
}
@keyframes rise { to { transform: translateY(-60px); opacity: 0; } }

.toast {
  position: fixed; top: 50%; left: 50%; z-index: 100;
  background: #fff; padding: 26px 34px; border-radius: 22px;
  font-size: 1.4rem; font-weight: 600; color: var(--rosa);
  box-shadow: 0 15px 40px rgba(200, 50, 90, .35);
  transform: translate(-50%, -50%);
  animation: zoomIn .4s ease;
}
@keyframes zoomIn { from { transform: translate(-50%, -50%) scale(.5); opacity: 0; } }

/* ---------- Quiz ---------- */
#quiz-options { display: flex; flex-direction: column; gap: 12px; }
.opt {
  font-family: inherit; font-size: 1rem; padding: 14px;
  border-radius: 14px; border: 2px solid var(--rosa2);
  background: #fff; color: var(--texto); cursor: pointer; transition: .2s;
}
.opt.ok { background: #6fcf8a; border-color: #6fcf8a; color: #fff; }
.opt.wrong { background: #ffd6d6; border-color: #ff6b6b; opacity: .6; animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
#quiz-feedback { min-height: 1.6em; font-weight: 600; color: var(--rosa); }

/* ---------- Sobre ---------- */
.envelope {
  position: relative; width: 280px; height: 180px; margin-top: 30px;
  cursor: pointer; perspective: 800px;
  animation: beat 2s infinite;
}
.envelope.open { animation: none; }
.envelope > div { position: absolute; }
.env-back { inset: 0; background: #e8577a; border-radius: 10px; }
.env-letter {
  left: 14px; right: 14px; top: 10px; bottom: 10px;
  background: var(--crema); border-radius: 6px; z-index: 2;
  transition: transform .8s ease .45s;
}
.env-front {
  inset: 0; z-index: 3; border-radius: 10px; background: #ff7a98;
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
}
.env-flap {
  top: 0; left: 0; right: 0; height: 60%; z-index: 4;
  background: #ff5c85; transform-origin: top;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .6s ease, z-index 0s .3s;
}
.env-seal {
  top: 46%; left: 50%; z-index: 5;
  width: 46px; height: 46px; margin-left: -23px;
  border-radius: 50%; background: #c9184a; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
  transition: opacity .3s;
}
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .env-letter { transform: translateY(-70%); }
.envelope.open .env-seal { opacity: 0; }

/* ---------- Carta ---------- */
.letter {
  background: var(--crema);
  max-width: 480px; width: 100%;
  padding: 34px 26px; border-radius: 8px;
  box-shadow: 0 15px 40px rgba(120, 30, 60, .3);
  text-align: left;
  font-family: 'Dancing Script', cursive; font-size: 1.45rem; line-height: 1.5;
  color: #6b2c3e;
  animation: fadeIn .8s ease;
}
#letter-text { white-space: pre-line; min-height: 220px; }
.letter .btn, .letter .skip-hint { font-family: 'Poppins', sans-serif; display: block; margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Fotos ---------- */
#s-photos { justify-content: flex-start; padding-top: 40px; }
.gallery {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
  max-width: 760px; width: 100%; margin: 20px 0;
}
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.polaroid {
  background: #fff; padding: 8px 8px 12px; border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .15);
  cursor: pointer; opacity: 0;
  transform: rotate(var(--r));
  animation: dropIn .6s ease forwards; animation-delay: var(--d);
}
.polaroid img, .polaroid .ph {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #ffe3ea;
}
.polaroid .ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: .7rem; padding: 8px; gap: 6px; color: #b05570;
}
.polaroid .ph b { font-size: 2rem; }
.polaroid p { font-family: 'Dancing Script', cursive; font-size: 1.15rem; margin: 6px 0 0; line-height: 1.2; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-30px) rotate(0); }
  to { opacity: 1; transform: rotate(var(--r)); }
}

#lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(40, 0, 15, .88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; text-align: center; animation: fadeIn .3s;
}
#lightbox img { max-width: 100%; max-height: 72vh; border: 8px solid #fff; border-radius: 4px; }
#lightbox p { color: #fff; font-family: 'Dancing Script', cursive; font-size: 1.7rem; }

/* ---------- Contador y razones ---------- */
.counter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.counter div { background: #fff0f4; border-radius: 14px; padding: 10px 4px; }
.counter b { display: block; font-size: 1.5rem; color: var(--rosa); }
.counter span { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; }
#reason {
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  font-family: 'Dancing Script', cursive; font-size: 1.55rem; line-height: 1.3;
}
.reason-anim { animation: fadeIn .5s ease; }

/* ---------- Pregunta final ---------- */
.choices { display: flex; gap: 16px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 6px; }
#btn-yes { transition: transform .3s; }
#btn-no { transition: left .25s ease, top .25s ease; }
#btn-no.runaway { position: fixed; z-index: 60; margin: 0; }

.burst {
  position: fixed; left: 50%; top: 50%; z-index: 150; pointer-events: none;
  animation: burst 1.8s ease-out forwards;
}
@keyframes burst {
  to { transform: translate(var(--x), var(--y)) scale(var(--s)) rotate(var(--rot)); opacity: 0; }
}
