:root {
  /* EDIT HERE: Theme colors */
  --bg-cream: #fff9f4;
  --bg-pink: #fbe4ea;
  --bg-lavender: #eee5ff;
  --rose: #d65b84;
  --rose-deep: #934565;
  --gold: #d3a14e;
  --text-main: #402433;
  --text-soft: #755463;
  --surface: rgba(255, 252, 250, 0.7);
  --surface-strong: rgba(255, 248, 246, 0.9);
  --border-soft: rgba(150, 93, 120, 0.14);
  --shadow-soft: 0 20px 60px rgba(132, 77, 104, 0.18);
  --shadow-button: 0 14px 30px rgba(209, 92, 132, 0.26);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --font-display: "Playfair Display", "Times New Roman", serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 223, 0.95), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(240, 225, 255, 0.9), transparent 28%),
    linear-gradient(180deg, #fff7f8 0%, #fff7f0 52%, #fffdf9 100%);
  overflow-x: hidden;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px 16px 56px;
  overflow: hidden;
}

.ambient {
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
  opacity: 0.7;
  pointer-events: none;
}

.ambient-left {
  top: 100px;
  left: -90px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(244, 187, 204, 0.6), transparent 70%);
}

.ambient-right {
  top: 320px;
  right: -80px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(224, 199, 255, 0.55), transparent 72%);
}

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

.floating-heart,
.celebration-piece,
.sparkle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.hero,
.main-content {
  position: relative;
  z-index: 1;
}

.hero {
  max-width: 680px;
  margin: 0 auto 18px;
  text-align: center;
  padding-top: 18px;
}

.eyebrow,
.card-kicker,
.memory-kicker,
.modal-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--rose-deep);
}

.hero-title {
  margin: 12px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 9vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero-title span {
  display: inline-block;
  transform: translateY(-1px);
}

.hero-subtitle {
  max-width: 36ch;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.main-content {
  max-width: 900px;
  margin: 0 auto;
}

.love-card,
.memory-section,
.modal-card {
  position: relative;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: linear-gradient(180deg, var(--surface-strong) 0%, rgba(255, 252, 249, 0.82) 100%);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
}

.love-card {
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 22px 18px 24px;
  transition: transform 280ms ease, box-shadow 280ms ease;
}

.love-card.is-glowing {
  transform: translateY(-2px) scale(1.002);
  box-shadow: 0 24px 70px rgba(146, 86, 118, 0.24);
}

.card-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(255, 209, 219, 0.45), transparent 32%),
    radial-gradient(circle at left center, rgba(234, 220, 255, 0.4), transparent 36%);
  pointer-events: none;
}

.card-topline {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.music-toggle {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(146, 86, 118, 0.15);
  border-radius: 999px;
  background: rgba(255, 251, 248, 0.82);
  color: var(--rose-deep);
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.music-toggle:hover,
.music-toggle:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(141, 84, 110, 0.12);
}

.message-panel {
  position: relative;
  z-index: 1;
  border-radius: 26px;
  padding: 24px 18px;
  background: rgba(255, 252, 250, 0.78);
  border: 1px solid rgba(147, 69, 101, 0.1);
}

.message-intro {
  margin: 0 0 10px;
  color: var(--rose);
  font-weight: 700;
}

.message-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5vw, 2.25rem);
  line-height: 1.28;
}

.progress-wrap {
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.progress-label,
.progress-hint {
  margin: 0;
}

.progress-label {
  font-weight: 700;
}

.progress-hint {
  max-width: 18ch;
  text-align: right;
  font-size: 0.86rem;
  color: var(--text-soft);
}

.progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(226, 201, 210, 0.42);
  overflow: hidden;
  border: 1px solid rgba(139, 77, 105, 0.08);
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(232, 131, 164, 0.95) 0%, rgba(215, 161, 84, 0.95) 100%);
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.action-area {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  text-align: center;
}

.surprise-button,
.restart-button,
.modal-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #fffaf7;
  font-weight: 700;
  letter-spacing: 0.01em;
  background:
    linear-gradient(135deg, #ea719c 0%, #c85d84 55%, #b75176 100%);
  box-shadow: var(--shadow-button);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    filter 220ms ease;
}

.surprise-button {
  position: relative;
  min-width: min(100%, 320px);
  padding: 18px 26px;
  font-size: 1rem;
}

.surprise-button:hover,
.surprise-button:focus-visible,
.restart-button:hover,
.restart-button:focus-visible,
.modal-button:hover,
.modal-button:focus-visible {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 20px 32px rgba(193, 76, 121, 0.28);
  filter: saturate(1.03);
}

.surprise-button:active,
.restart-button:active,
.modal-button:active {
  transform: translateY(0) scale(0.985);
}

.surprise-button.is-wiggle {
  animation: wiggle 620ms ease;
}

.surprise-button.is-dodge {
  animation: tinyDodge 440ms ease;
}

.helper-text {
  min-height: 1.8em;
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.memory-section {
  margin-top: 22px;
  border-radius: var(--radius-xl);
  padding: 24px 18px 28px;
}

.memory-heading {
  margin-bottom: 20px;
  text-align: center;
}

.memory-heading h2 {
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 2.8rem);
}

.memory-heading p:last-child {
  margin: 0 auto;
  max-width: 32ch;
  color: var(--text-soft);
}

.memory-grid {
  display: grid;
  gap: 14px;
}

.memory-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 248, 0.84);
  border: 1px solid rgba(145, 90, 114, 0.12);
  box-shadow: 0 16px 35px rgba(145, 90, 114, 0.1);
  transform: translateY(16px);
  opacity: 0;
  transition: transform 480ms ease, opacity 480ms ease;
}

.memory-card.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.memory-photo {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(251, 230, 236, 0.8), rgba(237, 229, 255, 0.8));
}

.memory-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-copy {
  padding: 14px 14px 16px;
}

.memory-copy h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.memory-copy p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.restart-button {
  display: block;
  width: fit-content;
  margin: 22px auto 0;
  padding: 14px 22px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(50, 26, 40, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-card {
  width: min(100%, 420px);
  border-radius: 28px;
  padding: 22px 22px 24px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 248, 245, 0.92);
  color: var(--rose-deep);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-card h2 {
  margin: 10px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 2.7rem);
}

.modal-card p {
  margin: 0 0 18px;
  color: var(--text-soft);
}

.modal-button {
  padding: 14px 20px;
}

.floating-heart {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  animation: floatUp linear forwards;
}

.floating-heart.is-bouncy {
  opacity: 0.8;
  animation: bounceHeart 2.2s ease-in-out infinite;
}

.celebration-piece {
  animation: celebrate 1800ms ease-out forwards;
}

.sparkle {
  width: 14px;
  height: 14px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 211, 112, 0.7) 55%, transparent 72%);
  border-radius: 50%;
  animation: sparkleBurst 620ms ease-out forwards;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid rgba(211, 161, 78, 0.75);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

@keyframes wiggle {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px) rotate(-1.5deg);
  }
  45% {
    transform: translateX(5px) rotate(1.4deg);
  }
  70% {
    transform: translateX(-3px) rotate(-0.8deg);
  }
}

@keyframes tinyDodge {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(10px);
  }
}

@keyframes sparkleBurst {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0.95;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.6);
    opacity: 0;
  }
}

@keyframes floatUp {
  0% {
    transform: translate3d(0, 0, 0) scale(0.9) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  100% {
    transform: translate3d(var(--drift, 0px), -120vh, 0) scale(1.1) rotate(22deg);
    opacity: 0;
  }
}

@keyframes celebrate {
  0% {
    transform: translate3d(0, 0, 0) scale(0.8) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--x, 0px), var(--y, 140px), 0) scale(1.2) rotate(var(--spin, 180deg));
    opacity: 0;
  }
}

@keyframes bounceHeart {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.08);
  }
}

@media (min-width: 700px) {
  .page-shell {
    padding: 36px 24px 72px;
  }

  .love-card {
    padding: 28px 26px 30px;
  }

  .message-panel {
    padding: 30px 26px;
  }

  .memory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-hint {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .floating-hearts,
  .ambient {
    display: none;
  }
}
