@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Prata&display=swap');

:root {
  color-scheme: dark;
  --ink: #fff8fc;
  --muted: rgba(255, 245, 251, 0.72);
  --glass: rgba(255, 255, 255, 0.1);
  --glass-strong: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.2);
  --pink: #ff4f9d;
  --hot-pink: #ff2478;
  --orange: #ff8a3d;
  --violet: #a85cff;
  --deep: #210017;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 82, 155, 0.42), transparent 33%),
    linear-gradient(145deg, #5f0c43 0%, #2a0321 52%, #13000e 100%);
}

button { font: inherit; }

.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  display: block;
  border-radius: 999px;
  filter: blur(58px);
  opacity: 0.7;
  animation: drift 13s ease-in-out infinite alternate;
}

.orb-one { width: 48vw; height: 48vw; max-width: 540px; max-height: 540px; background: #ff2579; left: -14%; top: 2%; }
.orb-two { width: 42vw; height: 42vw; max-width: 480px; max-height: 480px; background: #7b36ff; right: -16%; top: 38%; animation-delay: -5s; }
.orb-three { width: 36vw; height: 36vw; max-width: 420px; max-height: 420px; background: #ff7c32; left: 26%; bottom: -17%; animation-delay: -8s; }

.app-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.app-bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}

.mini-brand {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mini-brand span { color: #ff8fc1; margin-right: 5px; }

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: var(--glass);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.sound-on { display: none; }
.icon-button[aria-pressed="true"] .sound-off { display: none; }
.icon-button[aria-pressed="true"] .sound-on { display: inline; }

.screen {
  position: relative;
  flex: 1 1 auto;
  min-height: calc(100svh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 28px 0 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: screenIn 0.72s cubic-bezier(.2,.8,.2,1) both;
}

.screen[hidden] { display: none; }

.welcome-copy { text-align: center; margin: auto 0 34px; }

.eyebrow {
  margin-bottom: 18px;
  color: rgba(255,255,255,.72);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.eyebrow span { color: #ffb8d5; }

.hero-heart {
  position: relative;
  width: 142px;
  height: 142px;
  margin: 0 auto 30px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(255,255,255,.22), rgba(255,255,255,.06));
  box-shadow: 0 22px 70px rgba(255, 36, 120, .35), inset 0 1px 0 rgba(255,255,255,.35);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: breathe 2.6s ease-in-out infinite;
}

.hero-heart::after {
  content: "";
  position: absolute;
  inset: -12px;
  border: 1px solid rgba(255, 131, 181, .22);
  border-radius: inherit;
}

.hero-heart span {
  color: #ff5ca4;
  font-size: 4.8rem;
  line-height: 1;
  text-shadow: 0 8px 28px rgba(255, 45, 128, .7);
}

h1, h2, h3, p { margin-top: 0; }

h1, h2, .salutation, .signature {
  font-family: "Prata", Georgia, serif;
  font-weight: 400;
}

h1 {
  max-width: 440px;
  margin: 0 auto 18px;
  font-size: clamp(2.35rem, 10vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.welcome-copy p,
.screen-heading p {
  max-width: 390px;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.primary-button, .secondary-button, .ghost-button {
  position: relative;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 20px;
  padding: 15px 20px;
  color: white;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.primary-button {
  background: linear-gradient(110deg, #ff2478, #ff7354 55%, #ff9c3a);
  box-shadow: 0 16px 40px rgba(255, 44, 117, .35), inset 0 1px 0 rgba(255,255,255,.4);
}

.primary-button span { float: right; font-size: 1.3rem; line-height: 1; }
.primary-button:active, .secondary-button:active, .catch-heart:active, .final-heart:active { transform: scale(.97); }

.secondary-button {
  min-height: 52px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.22);
}

.ghost-button {
  width: auto;
  min-height: 44px;
  margin: 22px auto 0;
  background: transparent;
  color: rgba(255,255,255,.7);
}

.screen-heading { text-align: center; }
.screen-heading h2 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.screen-heading.compact { margin-bottom: 16px; }
.screen-heading.compact h2 { font-size: 2.35rem; }

.game-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
}

.progress-text { min-width: 43px; font-size: .86rem; font-weight: 700; }
.progress-track {
  flex: 1;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.13);
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff4e9b, #ffa23f);
  transition: width .45s ease;
}

.heart-field {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.14), rgba(255,255,255,.05));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 24px 70px rgba(0,0,0,.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.heart-field::before {
  content: "✦";
  position: absolute;
  top: 30px;
  left: 32px;
  color: rgba(255,255,255,.25);
  font-size: 1.8rem;
}

.heart-field::after {
  content: "✦";
  position: absolute;
  right: 44px;
  bottom: 38px;
  color: rgba(255,185,218,.28);
  font-size: 1.2rem;
}

.catch-heart {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 50%;
  color: white;
  font-size: 3rem;
  line-height: 1;
  background: linear-gradient(145deg, #ff2b7e, #ff7a4e);
  box-shadow: 0 14px 38px rgba(255, 42, 122, .48), inset 0 1px 0 rgba(255,255,255,.4);
  transform: translate(-50%, -50%);
  transition: left .3s ease, top .3s ease, transform .16s ease;
  z-index: 2;
}

.catch-heart.pop { animation: pop .35s ease; }

.game-complete {
  position: absolute;
  inset: 0;
  padding: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(circle at 50% 35%, rgba(255, 80, 157, .36), transparent 48%);
  animation: screenIn .55s ease both;
}
.game-complete[hidden] { display: none; }
.complete-spark { color: #ffd06f; font-size: 3rem; }
.game-complete strong { margin: 10px 0; font-family: "Prata", Georgia, serif; font-size: 2rem; font-weight: 400; }
.game-complete p { color: var(--muted); line-height: 1.6; }
.game-complete .secondary-button { margin-top: 10px; }

.cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 84%;
  gap: 14px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
  margin: 12px -20px 24px;
  padding: 8px 20px 18px;
}
.cards::-webkit-scrollbar { display: none; }

.reason-card {
  position: relative;
  min-height: 330px;
  padding: 26px;
  overflow: hidden;
  border-radius: 30px;
  scroll-snap-align: center;
  box-shadow: 0 22px 52px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.28);
}
.reason-card.coral { background: linear-gradient(150deg, #ff4f75, #d82570); }
.reason-card.violet { background: linear-gradient(150deg, #9556ff, #5a23cb); }
.reason-card.orange { background: linear-gradient(150deg, #ff9d3d, #eb4c4f); }
.reason-card.pink { background: linear-gradient(150deg, #ff57b0, #b91d6a); }

.card-number {
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .16em;
  opacity: .72;
}
.card-icon {
  display: block;
  margin: 52px 0 22px;
  font-size: 3.4rem;
  line-height: 1;
}
.reason-card h3 { margin-bottom: 12px; font-family: "Prata", Georgia, serif; font-size: 2rem; font-weight: 400; }
.reason-card p { margin-bottom: 0; color: rgba(255,255,255,.84); font-size: .97rem; line-height: 1.62; }

.envelope {
  position: relative;
  width: min(86vw, 360px);
  height: 300px;
  margin: 10px auto 0;
  border: 0;
  padding: 0;
  color: white;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

.envelope-back, .envelope-front, .envelope-flap, .letter-preview { position: absolute; left: 0; right: 0; margin: auto; }
.envelope-back { bottom: 38px; width: 100%; height: 190px; border-radius: 20px; background: linear-gradient(145deg, #d92c76, #8c174c); box-shadow: 0 26px 60px rgba(0,0,0,.25); }
.letter-preview {
  bottom: 54px;
  width: 84%;
  height: 180px;
  padding-top: 46px;
  border-radius: 15px 15px 4px 4px;
  background: #fff5f8;
  color: #691438;
  font-family: "Prata", Georgia, serif;
  font-style: normal;
  font-size: 1.6rem;
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}
.letter-preview i { display: block; margin-top: 13px; color: #ff3d89; font-style: normal; }
.envelope-front { bottom: 38px; width: 100%; height: 190px; border-radius: 20px; background: linear-gradient(160deg, rgba(255,105,159,.96), #c22669); clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%); }
.envelope-flap { bottom: 126px; width: 100%; height: 105px; background: #f34f91; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .7s ease; }
.tap-hint { position: absolute; bottom: 0; left: 0; right: 0; color: var(--muted); font-size: .82rem; font-weight: 700; }
.envelope.open .envelope-flap { transform: rotateX(180deg); }
.envelope.open .letter-preview { transform: translateY(-76px); }

.love-letter {
  margin: 2px 0 0;
  padding: 28px 24px;
  border-radius: 28px;
  color: #4b1630;
  background: linear-gradient(180deg, #fff8fb, #ffeef5);
  box-shadow: 0 26px 75px rgba(0,0,0,.28);
  animation: letterIn .7s ease both;
}
.love-letter[hidden] { display: none; }
.love-letter p { font-family: Georgia, serif; font-size: 1.02rem; line-height: 1.7; }
.love-letter .salutation { margin-bottom: 14px; font-size: 2rem; color: #9e2858; }
.love-letter .letter-emphasis { margin: 22px 0; color: #a01f55; font-size: 1.15rem; font-weight: 700; text-align: center; }
.love-letter .primary-button { margin-top: 4px; }

.finale { text-align: center; }
.finale-content { position: relative; z-index: 2; margin: auto 0; }
.finale-glow { position: absolute; inset: 12% -20% auto; height: 52%; border-radius: 50%; background: radial-gradient(circle, rgba(255,59,137,.48), transparent 68%); filter: blur(16px); animation: breathe 3s ease-in-out infinite; }
.final-heart {
  width: 150px;
  height: 150px;
  margin-bottom: 28px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 50%;
  color: white;
  font-size: 5.3rem;
  line-height: 1;
  background: linear-gradient(145deg, #ff257a, #ff754c);
  box-shadow: 0 22px 70px rgba(255,40,121,.5), inset 0 1px 0 rgba(255,255,255,.45);
  animation: heartbeat 1.65s ease-in-out infinite;
}
.finale h2 { margin-bottom: 14px; font-size: clamp(2.45rem, 10vw, 4.25rem); line-height: 1.05; }
.finale-content > p { color: rgba(255,255,255,.82); font-size: 1.18rem; line-height: 1.6; }
.finale blockquote {
  max-width: 390px;
  margin: 26px auto;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: #ffd5e7;
  background: var(--glass);
  font-family: Georgia, serif;
  font-size: 1rem;
  line-height: 1.6;
}
.signature { margin-top: 24px; font-size: 1.38rem; }
.signature span { color: #ff86b9; }
.secret-message {
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  color: #ffd8e8;
  font-weight: 800;
  opacity: 0;
  transition: max-height .6s ease, margin .6s ease, opacity .6s ease;
}
.secret-message.show { max-height: 80px; margin-top: 18px; opacity: 1; }

.step-dots {
  position: fixed;
  z-index: 4;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  gap: 7px;
  transform: translateX(-50%);
}
.step-dots span { width: 6px; height: 6px; border-radius: 999px; background: rgba(255,255,255,.28); transition: width .3s ease, background .3s ease; }
.step-dots span.active { width: 24px; background: #ff8ebb; }

.floaters, .burst-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.burst-layer { z-index: 20; }
.floater { position: absolute; bottom: -60px; color: rgba(255,166,205,.22); font-size: 1.1rem; animation: floatUp linear forwards; }
.burst {
  position: absolute;
  left: var(--x);
  top: var(--y);
  color: var(--color);
  font-size: var(--size);
  animation: burstOut .95s cubic-bezier(.1,.7,.2,1) forwards;
  transform: translate(-50%, -50%);
}

@keyframes drift { to { transform: translate3d(7vw, 7vh, 0) scale(1.12); } }
@keyframes breathe { 50% { transform: scale(1.055); } }
@keyframes heartbeat { 0%, 30%, 100% { transform: scale(1); } 12% { transform: scale(1.08); } 20% { transform: scale(1.02); } }
@keyframes screenIn { from { opacity: 0; transform: translateY(24px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes letterIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop { 50% { transform: translate(-50%, -50%) scale(1.22); } }
@keyframes floatUp { to { transform: translateY(-115vh) rotate(36deg); opacity: 0; } }
@keyframes burstOut { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)); opacity: 0; } }

@media (min-width: 760px) {
  body { display: grid; place-items: center; padding: 28px; }
  .app-shell {
    min-height: min(900px, calc(100vh - 56px));
    max-height: 900px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 38px;
    overflow: hidden;
    background: rgba(22,0,17,.28);
    box-shadow: 0 35px 100px rgba(0,0,0,.45);
    backdrop-filter: blur(20px);
  }
  .screen { min-height: auto; overflow-y: auto; }
  .step-dots { position: absolute; }
}

@media (max-height: 720px) {
  .screen { justify-content: flex-start; }
  .hero-heart { width: 108px; height: 108px; margin-bottom: 20px; }
  .hero-heart span { font-size: 3.8rem; }
  .welcome-copy { margin-top: 12px; }
  .heart-field { min-height: 310px; }
  .card-icon { margin-top: 34px; }
  .reason-card { min-height: 290px; }
  .final-heart { width: 118px; height: 118px; font-size: 4.2rem; margin-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

:focus-visible { outline: 3px solid #ffd264; outline-offset: 3px; }
