* { box-sizing: border-box; }

:root {
  --pink-1: #ffd0e4;
  --pink-2: #f36aa9;
  --pink-3: #c93f85;
  --cream: #fff4d8;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #0d0924;
  color: #fff;
  overflow-x: hidden;
}

#skyCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  background:
    radial-gradient(circle at 22% 12%, rgba(255, 230, 247, 0.18), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.12), transparent 22%),
    linear-gradient(135deg, #0d0924, #271544 45%, #673058);
}

.scene {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.terminal {
  width: min(640px, 94vw);
  background: rgba(0, 0, 0, 0.64);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 26px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.9;
  box-shadow: 0 28px 90px rgba(0,0,0,0.42);
}

.line { opacity: 0; animation: typeLine 0.65s forwards; }
.line:nth-child(1) { animation-delay: 0.2s; }
.line:nth-child(2) { animation-delay: 0.85s; }
.line:nth-child(3) { animation-delay: 1.5s; }
.line:nth-child(4) { animation-delay: 2.15s; }
.line:nth-child(5) { animation-delay: 2.8s; }
.line:nth-child(6) { animation-delay: 3.5s; }

@keyframes typeLine {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

.card {
  position: relative;
  overflow: hidden;
  width: min(890px, 95vw);
  min-height: 750px;
  text-align: center;
  padding: 34px 24px 34px;
  border-radius: 34px;
  background: rgba(255,255,255,0.135);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(15px);
  box-shadow: 0 28px 110px rgba(0,0,0,0.38);
  animation: fadeIn 1.2s ease both;
}

.glow {
  position: absolute;
  inset: auto -80px -130px -80px;
  height: 260px;
  background: radial-gradient(ellipse, rgba(255, 190, 224, .22), transparent 68%);
  pointer-events: none;
}

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

.intro {
  min-height: 680px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
}

.small { margin: 0; opacity: .84; letter-spacing: .4px; }

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 4.5rem);
  letter-spacing: -1px;
  text-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.subtitle {
  margin: 0 auto;
  max-width: 650px;
  font-size: clamp(1rem, 2.5vw, 1.22rem);
  line-height: 1.55;
  opacity: 0.92;
}

.start-btn, .play-btn {
  border: 0;
  padding: 14px 24px;
  border-radius: 999px;
  background: rgba(255,255,255,0.94);
  color: #432047;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(0,0,0,0.22);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background .25s ease;
}

.start-btn:hover, .play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(0,0,0,0.28);
}

.garden { animation: fadeIn 1s ease both; }

.rain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity .8s ease;
}
.rain.active { opacity: 1; }

.drop {
  position: absolute;
  top: -40px;
  width: 2px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,0.42);
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translateY(860px); opacity: 0; }
}

.birds {
  position: absolute;
  top: 74px;
  right: 78px;
  font-size: 28px;
  opacity: .72;
  letter-spacing: 14px;
  animation: birdsMove 4s ease-in-out infinite;
}

@keyframes birdsMove {
  0%, 100% { transform: translateY(0); opacity: .45; }
  50% { transform: translateY(-12px); opacity: .9; }
}

.message-box {
  margin: 6px auto 18px;
  width: min(660px, 91%);
  min-height: 74px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 1.03rem;
  line-height: 1.45;
  display: grid;
  place-items: center;
  transition: 0.35s ease;
}

.message-box.pop {
  transform: scale(1.035);
  background: rgba(255,255,255,0.27);
}

.plant-stage {
  position: relative;
  min-height: 465px;
  display: grid;
  place-items: center;
}

.soil {
  position: absolute;
  bottom: 40px;
  width: 310px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(104,61,40,.95), rgba(55,31,26,.72), transparent 72%);
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
  opacity: 0;
}
.soil.show { animation: soilIn 1.2s ease both; }

@keyframes soilIn {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: scale(1); }
}

.seed {
  position: absolute;
  top: 42px;
  width: 28px;
  height: 38px;
  border-radius: 52% 48% 55% 45%;
  background: radial-gradient(circle at 35% 25%, #d6b47c, #8b5a32 72%);
  box-shadow: inset 4px 3px 8px rgba(255,255,255,.18), 0 12px 24px rgba(0,0,0,.25);
  opacity: 0;
  z-index: 5;
}
.seed.drop-seed { animation: seedFall 4.5s cubic-bezier(.28,.84,.42,1) both; }

@keyframes seedFall {
  0% { opacity: 0; transform: translateY(-70px) rotate(-18deg) scale(.7); }
  18% { opacity: 1; transform: translateY(0) rotate(18deg) scale(1); }
  48% { transform: translateY(150px) rotate(-12deg) scale(1); }
  70% { transform: translateY(300px) rotate(10deg) scale(.96); }
  82% { transform: translateY(274px) rotate(-6deg) scale(1); }
  100% { opacity: 1; transform: translateY(315px) rotate(0deg) scale(.78); }
}

.sprout {
  position: absolute;
  bottom: 67px;
  width: 90px;
  height: 130px;
  opacity: 0;
  z-index: 2;
}
.sprout.grow-sprout { animation: sproutFade 1s ease both; }

.sprout-stem {
  position: absolute;
  left: 39px;
  bottom: 0;
  width: 10px;
  height: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #38a45a, #7add86);
}
.grow-sprout .sprout-stem { animation: sproutStem 2.7s ease forwards; }

.sprout-leaf {
  position: absolute;
  bottom: 54px;
  width: 46px;
  height: 24px;
  opacity: 0;
  background: linear-gradient(90deg, #57c76d, #9dea99);
  border-radius: 100% 0 100% 0;
}
.sprout-leaf.left { left: 4px; transform: rotate(26deg) scale(.4); }
.sprout-leaf.right { right: 4px; transform: scaleX(-1) rotate(26deg) scale(.4); }
.grow-sprout .sprout-leaf.left { animation: sproutLeafLeft 1.4s 1.5s ease forwards; }
.grow-sprout .sprout-leaf.right { animation: sproutLeafRight 1.4s 1.8s ease forwards; }

@keyframes sproutFade { to { opacity: 1; } }
@keyframes sproutStem { from { height: 0; } to { height: 112px; } }
@keyframes sproutLeafLeft { to { opacity: 1; transform: rotate(26deg) scale(1); } }
@keyframes sproutLeafRight { to { opacity: 1; transform: scaleX(-1) rotate(26deg) scale(1); } }

.flower {
  position: relative;
  width: 260px;
  height: 330px;
  margin-top: 28px;
  opacity: 0;
  transform: scale(.3) translateY(100px);
  z-index: 3;
}
.flower.grow { animation: grow 3.5s cubic-bezier(.19,1,.22,1) both; }
.flower.sway { animation: sway 3.2s ease-in-out infinite; opacity: 1; transform: scale(1); }

@keyframes grow {
  0% { opacity: 0; transform: scale(.20) translateY(120px); }
  35% { opacity: 1; transform: scale(.48) translateY(84px); }
  68% { opacity: 1; transform: scale(.82) translateY(34px); }
  86% { opacity: 1; transform: scale(1.05) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1.2deg); }
}

.petal {
  position: absolute;
  width: 108px;
  height: 150px;
  left: 76px;
  top: 24px;
  border: 0;
  border-radius: 58% 58% 45% 45%;
  background: linear-gradient(180deg, var(--pink-1), var(--pink-2) 68%, var(--pink-3));
  box-shadow: inset 0 10px 20px rgba(255,255,255,0.25), 0 12px 28px rgba(0,0,0,0.18);
  transform-origin: 50% 118px;
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}
.petal:hover { filter: brightness(1.18); }
.petal:focus { outline: 3px solid rgba(255,255,255,0.7); }
.petal.visited { background: linear-gradient(180deg, #ffe2ee, #ff82bc 70%, #df4b95); }

.p1 { transform: rotate(0deg) translateY(-38px); }
.p2 { transform: rotate(60deg) translateY(-38px); }
.p3 { transform: rotate(120deg) translateY(-38px); }
.p4 { transform: rotate(180deg) translateY(-38px); }
.p5 { transform: rotate(240deg) translateY(-38px); }
.p6 { transform: rotate(300deg) translateY(-38px); }

.p1:hover { transform: rotate(0deg) translateY(-50px); }
.p2:hover { transform: rotate(60deg) translateY(-50px); }
.p3:hover { transform: rotate(120deg) translateY(-50px); }
.p4:hover { transform: rotate(180deg) translateY(-50px); }
.p5:hover { transform: rotate(240deg) translateY(-50px); }
.p6:hover { transform: rotate(300deg) translateY(-50px); }

.center {
  position: absolute;
  width: 76px;
  height: 76px;
  left: 92px;
  top: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff0a8, #f0ad2f 72%);
  box-shadow: inset 0 6px 12px rgba(255,255,255,0.35), 0 10px 24px rgba(0,0,0,0.22);
  z-index: 3;
}

.stem {
  position: absolute;
  width: 16px;
  height: 190px;
  left: 122px;
  top: 176px;
  background: linear-gradient(90deg, #238045, #61c777);
  border-radius: 20px;
  z-index: -1;
}
.leaf {
  position: absolute;
  width: 82px;
  height: 40px;
  background: linear-gradient(90deg, #55b96d, #85dc8e);
  border-radius: 100% 0 100% 0;
  top: 250px;
  z-index: 0;
}
.left-leaf { left: 52px; transform: rotate(24deg); }
.right-leaf { right: 52px; transform: scaleX(-1) rotate(24deg); }

.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff6c8;
  box-shadow: 0 0 18px #fff3a0;
  opacity: 0;
}
.spark1 { top: 50px; left: 50px; animation: spark 2.2s infinite; }
.spark2 { top: 80px; right: 42px; animation: spark 2.6s .5s infinite; }
.spark3 { top: 160px; left: 36px; animation: spark 2.4s 1s infinite; }

@keyframes spark {
  0%, 100% { opacity: 0; transform: scale(.4) translateY(6px); }
  50% { opacity: .85; transform: scale(1) translateY(-6px); }
}

.play-btn { margin-top: 0; }
.play-btn.playing { background: rgba(255, 226, 242, 0.95); }

.caption {
  max-width: 720px;
  min-height: 54px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.14);
  line-height: 1.45;
  opacity: .95;
  animation: fadeIn .5s ease both;
}

.note {
  max-width: 690px;
  margin: 18px auto 8px;
  font-size: clamp(1rem, 2.45vw, 1.2rem);
  line-height: 1.65;
}
.signature { margin: 16px 0 0; opacity: 0.86; font-size: 1.05rem; }

.final {
  margin: 22px auto 0;
  max-width: 660px;
  padding: 22px;
  border-radius: 24px;
  background: rgba(255,255,255,0.17);
  border: 1px solid rgba(255,255,255,0.22);
  animation: fadeIn 1.2s ease both;
}
.final .cap {
  font-size: 56px;
  animation: capFloat 2.4s ease-in-out infinite;
}
@keyframes capFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}
.final p { margin: 8px 0; }
.final strong { display: block; margin-top: 12px; font-size: 1.25rem; }

.confetti {
  pointer-events: none;
  position: fixed;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 3.4s linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(760deg); opacity: 0; }
}

@media (max-width: 520px) {
  .scene { padding: 14px; }
  .card { min-height: 735px; padding-inline: 16px; }
  .plant-stage { min-height: 445px; }
  .seed { top: 36px; }
  .birds { right: 26px; top: 78px; font-size: 22px; }
}


/* Mobile safety patch */
@media (max-width: 600px) {
  .card {
    backdrop-filter: none;
    min-height: 680px;
  }
  .intro {
    min-height: 610px;
  }
  .terminal {
    line-height: 1.65;
    padding: 20px;
  }
  .drop {
    height: 18px;
  }
}
