:root {
  --bg: #fff;
  --text: #1f1f1f;
  --muted: #8e8e8e;
  --pink: #ff6fa8;
  --pink-soft: #ffd9e9;
  --pink-deep: #ff4f97;
  --shadow: 0 12px 35px rgba(255, 111, 168, 0.16);
  --radius: 20px;
  --transition: 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  overflow-x: hidden;
}

.bg-hearts {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-hearts span {
  position: absolute;
  bottom: -40px;
  opacity: 0;
  will-change: transform, opacity;
  animation: floatHeart linear infinite;
  filter: drop-shadow(0 3px 4px rgba(255, 111, 168, 0.16));
}

@keyframes floatHeart {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0;
  }
  15% {
    opacity: 0.35;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    transform: translate3d(var(--drift), -120vh, 0) scale(var(--scale-end));
    opacity: 0;
  }
}

main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.screen {
  display: none;
  width: min(940px, 100%);
  animation: fadeIn 650ms ease both;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
}

.hero {
  text-align: center;
  max-width: 620px;
  margin: 0 auto;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: 0.2px;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  color: var(--pink-deep);
  margin-bottom: 14px;
  font-weight: 800;
}

h2 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin-bottom: 18px;
  color: var(--pink-deep);
  text-align: center;
}

p {
  font-size: clamp(1rem, 2.7vw, 1.08rem);
  line-height: 1.7;
}

.lead {
  margin-bottom: 8px;
}

.sub {
  color: #3b3b3b;
  margin-bottom: 24px;
}

.btn {
  border: 0;
  background: var(--pink);
  color: #fff;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(255, 111, 168, 0.34);
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition), opacity var(--transition);
  user-select: none;
}

.btn:hover {
  background: var(--pink-deep);
  transform: translateY(-2px);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.actions {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.reasons {
  max-width: 760px;
  margin: 0 auto;
}

.accordion {
  margin-top: 10px;
  display: grid;
  gap: 12px;
}

.accordion-item {
  background: #fff;
  border: 1px solid #f2f2f2;
  border-radius: 14px;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.accordion-item.open {
  border-color: var(--pink-soft);
  box-shadow: 0 10px 28px rgba(255, 111, 168, 0.17);
}

.acc-trigger {
  width: 100%;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px 16px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: #d5d5d5;
  color: transparent;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.accordion-item.open .dot {
  background: var(--pink-soft);
  color: var(--pink-deep);
  transform: scale(1.06);
}

.acc-title {
  font-weight: 700;
  font-size: 1.03rem;
}

.acc-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 420ms cubic-bezier(0.2, 0.8, 0.2, 1), padding 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 0 16px;
}

.accordion-item.open .acc-content {
  max-height: 180px;
  padding: 0 16px 16px;
}

.acc-content p {
  color: #434343;
  font-size: 0.98rem;
}

#nextFromReasons {
  display: none;
}

.memory-wrapper {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.memory-intro {
  margin-bottom: 18px;
  color: #333;
}

.memory-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 12px;
  perspective: 900px;
}

.memory-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

.memory-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 500ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow var(--transition);
  border-radius: 16px;
}

.memory-card.flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
}

.memory-face.front {
  background: linear-gradient(145deg, #fff 0%, #fff4f8 100%);
  color: #ffa1c8;
  border: 1px solid #ffe4ef;
}

.memory-face.back {
  background: #fff;
  transform: rotateY(180deg);
  border: 1px solid #f7d4e4;
}

.memory-card.matched .memory-card-inner {
  box-shadow: 0 0 0 2px #ffc9df, 0 12px 28px rgba(255, 111, 168, 0.22);
}

.memory-status {
  margin-top: 14px;
  color: #555;
  font-size: 0.95rem;
  min-height: 22px;
}

#openSurprise {
  display: none;
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.burst-heart {
  position: absolute;
  font-size: 14px;
  animation: burst 900ms ease-out forwards;
  opacity: 0;
  will-change: transform, opacity;
}

@keyframes burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.4);
  }
  30% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(1.1);
  }
}

.gallery {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.gallery-frame {
  margin: 8px auto 14px;
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(130deg, #ffeaf2, #ffd7e8);
  box-shadow: var(--shadow);
}

.gallery-inner {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 3px solid #fff;
  min-height: 260px;
  display: grid;
  place-items: center;
}

.gallery-inner img {
  width: 100%;
  height: min(62vh, 430px);
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 420ms ease;
}

.gallery-inner img.ready {
  opacity: 1;
}

.gallery-caption {
  margin-top: 12px;
  color: #555;
  min-height: 24px;
}

.letter {
  max-width: 760px;
  margin: 0 auto;
}

.letter p + p {
  margin-top: 12px;
}

.certificate-wrap {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

.gift-certificate {
  margin-bottom: 18px;
}

.gift-note {
  color: #474747;
  margin-bottom: 12px;
}

.gift-image-frame {
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #ffe0ec;
  box-shadow: 0 12px 30px rgba(255, 111, 168, 0.16);
  background: #fff;
}

.gift-image-frame img {
  width: 100%;
  display: block;
  height: auto;
}

.certificate {
  position: relative;
  background: #fff;
  border: 2px solid #ffd6e8;
  border-radius: 22px;
  padding: clamp(24px, 5vw, 40px);
  box-shadow: 0 15px 35px rgba(255, 111, 168, 0.2);
  overflow: hidden;
  isolation: isolate;
}

.certificate::before,
.certificate::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 179, 212, 0.45) 0%, rgba(255, 179, 212, 0) 70%);
  z-index: -1;
}

.certificate::before {
  top: -70px;
  left: -50px;
}

.certificate::after {
  bottom: -80px;
  right: -50px;
}

.cert-title {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  color: var(--pink-deep);
  letter-spacing: 2px;
  font-weight: 900;
  margin-bottom: 18px;
}

.cert-block {
  margin: 12px 0;
  font-size: 1.05rem;
}

.cert-label {
  display: block;
  color: #808080;
  font-size: 0.9rem;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
}

.cert-value {
  font-size: 1.24rem;
  font-weight: 700;
  color: #2a2a2a;
}

.cert-sign {
  margin-top: 16px;
  font-style: italic;
  color: #4b4b4b;
}

.cert-footer {
  margin-top: 18px;
  color: var(--pink-deep);
  font-weight: 800;
  font-size: clamp(1rem, 2.5vw, 1.16rem);
}

.tiny-hearts {
  font-size: 1.2rem;
  margin-bottom: 10px;
  letter-spacing: 5px;
  color: var(--pink);
  opacity: 0.8;
}

@media (min-width: 700px) {
  .memory-grid {
    grid-template-columns: repeat(4, minmax(90px, 1fr));
  }
}
