@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Poppins:wght@300;400;600;800&display=swap');

:root {
  --pink: #ff2f98;
  --pink2: #ff8ac7;
  --dark: #080004;
  --card: rgba(24, 0, 13, .68);
  --white: #fff3f9;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Poppins, sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at top, #52002c 0%, #18000c 48%, #030002 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,47,152,.22), transparent 26%),
    radial-gradient(circle at 80% 70%, rgba(255,138,199,.16), transparent 30%);
  pointer-events: none;
}

#sparkles, #confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#sparkles { z-index: 0; }
#confetti { z-index: 5; }

#hearts {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.float-heart {
  position: absolute;
  color: rgba(255, 78, 165, .7);
  text-shadow: 0 0 15px var(--pink);
  animation: floatUp linear forwards;
}

@keyframes floatUp {
  from { transform: translateY(110vh) rotate(0deg); opacity: 0; }
  12%, 85% { opacity: .9; }
  to { transform: translateY(-15vh) rotate(360deg); opacity: 0; }
}

.screen {
  display: none;
  position: relative;
  z-index: 2;
  min-height: 100svh;
  padding: 18px;
}

.screen.active {
  display: flex;
  animation: fade .55s ease both;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* INTRO */
#intro {
  align-items: center;
  justify-content: center;
}

.intro-card {
  width: min(960px, 100%);
  max-height: none;
  padding: clamp(18px, 4vw, 34px);
  border-radius: 30px;
  background: var(--card);
  border: 1px solid rgba(255,138,199,.32);
  box-shadow: 0 0 42px rgba(255,47,152,.28), inset 0 0 28px rgba(255,255,255,.04);
  backdrop-filter: blur(14px);
  text-align: center;
}

.mini-gallery {
  width: min(620px, 100%);
  margin: 0 auto 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 2vw, 18px);
  align-items: end;
}

.mini-gallery img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 4px solid #fff;
  border-radius: 14px;
  box-shadow: 0 0 22px rgba(255,47,152,.65);
}

.mini-gallery img:nth-child(1) { transform: rotate(-4deg); }
.mini-gallery img:nth-child(2) { transform: translateY(8px) rotate(2deg); }
.mini-gallery img:nth-child(3) { transform: rotate(4deg); }

.script {
  font-family: "Great Vibes", cursive;
  font-size: clamp(38px, 8vw, 72px);
  line-height: .95;
  margin: 12px 0 0;
  text-shadow: 0 0 18px var(--pink);
}

h1 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(66px, 15vw, 145px);
  line-height: .86;
  margin: 4px 0 12px;
  text-shadow: 0 0 20px var(--pink), 0 0 48px var(--pink);
}

h2 {
  margin: 0 0 14px;
  color: var(--pink2);
  font-size: clamp(22px, 5vw, 34px);
}

.intro-text {
  width: min(560px, 100%);
  margin: 0 auto 22px;
  line-height: 1.65;
  font-size: clamp(15px, 3.8vw, 19px);
}

button {
  border: 2px solid var(--pink2);
  background: rgba(255,47,152,.14);
  color: #fff;
  border-radius: 18px;
  padding: 15px 24px;
  font-size: clamp(16px, 4vw, 19px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(255,47,152,.65);
}

button:active { transform: scale(.97); }

/* GAME */
#game {
  flex-direction: column;
  align-items: center;
}

.game-header {
  width: min(1050px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.game-header h2 {
  color: #fff;
  text-shadow: 0 0 18px var(--pink);
  margin: 0;
  font-size: clamp(28px, 7vw, 46px);
}

.game-header p {
  margin: 0;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 800;
  padding: 8px 15px;
  border-radius: 16px;
  border: 1px solid rgba(255,138,199,.35);
  background: rgba(255,47,152,.14);
}

#field {
  position: relative;
  width: min(1050px, 100%);
  min-height: 68svh;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255,138,199,.28);
  background: rgba(10,0,6,.30);
  box-shadow: inset 0 0 35px rgba(255,47,152,.10);
}

.balloon {
  position: absolute;
  width: clamp(64px, 16vw, 96px);
  height: clamp(70px, 17vw, 105px);
  border: 0;
  padding: 0;
  border-radius: 55% 55% 48% 48%;
  background:
    radial-gradient(circle at 32% 23%, #fff 0 8%, transparent 13%),
    radial-gradient(circle at 58% 78%, #a0004a 0%, #ff2f98 57%, #ffa0d1 100%);
  color: white;
  font-weight: 800;
  font-size: clamp(22px, 5vw, 34px);
  text-shadow: 0 0 8px #580028;
  box-shadow: inset -9px -14px 24px rgba(40,0,18,.42), 0 0 24px rgba(255,47,152,.80);
  animation: drift 3s ease-in-out infinite;
}

.balloon::before {
  content: "";
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 15px solid #d60068;
}

.balloon::after {
  content: "";
  position: absolute;
  bottom: -45px;
  left: 50%;
  width: 2px;
  height: 36px;
  background: linear-gradient(var(--pink2), transparent);
}

@keyframes drift {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-13px) rotate(2deg); }
}

.balloon.pop {
  animation: pop .35s ease forwards;
  pointer-events: none;
}

@keyframes pop {
  to { opacity: 0; transform: scale(2.15) rotate(20deg); filter: blur(5px); }
}

.particle {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink2);
  pointer-events: none;
  animation: part .65s ease-out forwards;
}

@keyframes part {
  to { transform: translate(var(--x), var(--y)); opacity: 0; }
}

#toast {
  width: min(620px, 100%);
  min-height: 48px;
  margin-top: 12px;
  padding: 12px 16px;
  text-align: center;
  border-radius: 16px;
  border: 1px solid rgba(255,138,199,.35);
  background: rgba(255,47,152,.14);
  box-shadow: 0 0 18px rgba(255,47,152,.25);
}

/* ENDING */
#ending {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.ending-card {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 26px;
  align-items: center;
}

.ending-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.ending-gallery img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border: 4px solid #fff;
  border-radius: 14px;
  box-shadow: 0 0 26px rgba(255,47,152,.70);
  animation: photoIn .7s ease both;
}

.ending-gallery img:nth-child(1) { transform: rotate(-4deg); }
.ending-gallery img:nth-child(2) { transform: translateY(18px) rotate(2deg); animation-delay: .16s; }
.ending-gallery img:nth-child(3) { transform: rotate(4deg); animation-delay: .32s; }

@keyframes photoIn {
  from { opacity: 0; translate: 0 28px; }
  to { opacity: 1; translate: 0 0; }
}

.letter {
  padding: clamp(18px, 4vw, 32px);
  border-radius: 28px;
  background: var(--card);
  border: 1px solid rgba(255,138,199,.32);
  box-shadow: 0 0 42px rgba(255,47,152,.28), inset 0 0 28px rgba(255,255,255,.04);
  backdrop-filter: blur(14px);
}

.script.small {
  font-size: clamp(34px, 7vw, 54px);
}

.letter h2 {
  color: #fff;
  font-family: "Great Vibes", cursive;
  font-size: clamp(38px, 8vw, 62px);
  line-height: 1;
  text-shadow: 0 0 18px var(--pink);
}

#typed {
  white-space: pre-line;
  line-height: 1.85;
  font-size: clamp(15px, 3.7vw, 18px);
  min-height: 250px;
}

/* PHONE FIXES */
@media (max-width: 720px) {
  body { overflow-y: auto; }
  .screen { padding: 14px; }

  .intro-card {
    min-height: auto;
    padding: 18px 14px 22px;
    border-radius: 26px;
  }

  .mini-gallery {
    max-width: 330px;
    gap: 8px;
    margin-bottom: 10px;
  }

  .mini-gallery img {
    border-width: 3px;
    border-radius: 12px;
    box-shadow: 0 0 16px rgba(255,47,152,.65);
  }

  .mini-gallery img:nth-child(2) {
    transform: translateY(10px) scale(1.04) rotate(2deg);
  }

  .script { margin-top: 18px; }
  h1 { margin-bottom: 10px; }

  .game-header {
    display: block;
    text-align: center;
    margin-top: 4px;
  }

  .game-header p {
    display: inline-block;
    margin-top: 6px;
  }

  #field {
    min-height: 64svh;
    border-radius: 22px;
  }

  .ending-card {
    display: block;
  }

  .ending-gallery {
    max-width: 360px;
    margin: 0 auto 28px;
    gap: 8px;
  }

  .ending-gallery img {
    border-width: 3px;
  }

  #typed {
    min-height: 360px;
  }
}
