@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #332c46;
  --muted: #7c718f;
  --soft-muted: #a095b1;
  --paper: rgba(255, 253, 255, 0.8);
  --paper-solid: #fffaff;
  --lavender: #8670db;
  --lavender-dark: #6e5bc5;
  --rose: #e986a5;
  --rose-light: #ffd9e6;
  --peach: #ffcba9;
  --line: rgba(112, 91, 163, 0.14);
  --shadow: 0 24px 70px rgba(103, 80, 145, 0.17), 0 4px 14px rgba(120, 88, 140, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f7f1ff;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 211, 229, 0.72), transparent 31rem),
    radial-gradient(circle at 95% 85%, rgba(203, 194, 255, 0.76), transparent 34rem),
    linear-gradient(135deg, #fff9fe 0%, #f6f0ff 48%, #eef4ff 100%);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(134, 112, 219, 0.45);
  outline-offset: 4px;
}

.scene,
.scene::before,
.scene::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scene {
  z-index: 0;
  overflow: hidden;
}

.scene::before,
.scene::after {
  content: '';
  opacity: 0.28;
  background-image: radial-gradient(rgba(134, 112, 219, 0.22) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(135deg, black, transparent 53%);
}

.scene::after {
  opacity: 0.17;
  transform: rotate(180deg);
}

.orb {
  position: absolute;
  display: block;
  border-radius: 999px;
  filter: blur(1px);
  opacity: 0.68;
  animation: float 12s ease-in-out infinite;
}

.orb-one {
  top: 12%;
  left: 9%;
  width: 9px;
  height: 9px;
  background: var(--rose);
  box-shadow: 0 0 0 9px rgba(233, 134, 165, 0.08), 0 0 26px rgba(233, 134, 165, 0.6);
}

.orb-two {
  right: 12%;
  bottom: 17%;
  width: 12px;
  height: 12px;
  background: var(--lavender);
  box-shadow: 0 0 0 12px rgba(134, 112, 219, 0.08), 0 0 32px rgba(134, 112, 219, 0.42);
  animation-delay: -5s;
}

.sparkle {
  position: absolute;
  color: rgba(134, 112, 219, 0.46);
  font-family: Georgia, serif;
  font-size: 1.2rem;
  animation: twinkle 4s ease-in-out infinite;
}

.sparkle-one { top: 18%; left: 20%; }
.sparkle-two { right: 19%; top: 22%; font-size: 0.8rem; animation-delay: -1.2s; }
.sparkle-three { bottom: 24%; left: 17%; font-size: 2rem; animation-delay: -2.4s; }

.page-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 54px 22px 28px;
}

.note-card {
  position: relative;
  width: min(100%, 500px);
  padding: 33px 42px 29px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 32px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: card-enter 850ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card-glow {
  position: absolute;
  top: -170px;
  left: 50%;
  width: 430px;
  height: 310px;
  border-radius: 50%;
  background: rgba(255, 220, 233, 0.56);
  filter: blur(42px);
  transform: translateX(-50%);
  pointer-events: none;
}

.eyebrow,
.copy-block,
.note-panel,
.actions,
.success-panel {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--soft-muted);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #77caa6;
  box-shadow: 0 0 0 4px rgba(119, 202, 166, 0.13);
}

.illustration-wrap {
  position: relative;
  display: grid;
  height: 180px;
  place-items: center;
  margin: 22px auto 7px;
}

.halo {
  position: absolute;
  border: 1px solid rgba(233, 134, 165, 0.2);
  border-radius: 50%;
}

.halo-back {
  width: 174px;
  height: 174px;
  background: rgba(255, 219, 231, 0.38);
  animation: pulse 4s ease-in-out infinite;
}

.halo-front {
  width: 138px;
  height: 138px;
  border-color: rgba(134, 112, 219, 0.12);
  transform: rotate(25deg);
  animation: pulse 4s ease-in-out infinite -1.4s;
}

.envelope {
  position: relative;
  z-index: 2;
  width: 118px;
  height: 87px;
  border-radius: 10px;
  background: linear-gradient(145deg, #f9b9c9, #e985a5);
  box-shadow: 0 17px 23px rgba(189, 103, 137, 0.22), inset 0 1px rgba(255, 255, 255, 0.65);
  transform: rotate(-4deg);
  animation: envelope-float 5s ease-in-out infinite;
}

.envelope-flap {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-right: 59px solid transparent;
  border-bottom: 47px solid rgba(255, 224, 233, 0.76);
  border-left: 59px solid transparent;
  transform-origin: 50% 0;
}

.envelope-paper {
  position: absolute;
  z-index: 2;
  top: 11px;
  left: 20px;
  display: grid;
  width: 78px;
  height: 54px;
  place-items: center;
  border-radius: 4px 4px 7px 7px;
  background: #fffafa;
  box-shadow: 0 3px 6px rgba(147, 88, 116, 0.1);
  color: var(--rose);
  font-size: 1.7rem;
}

.envelope-front {
  position: absolute;
  z-index: 4;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-right: 59px solid rgba(221, 112, 148, 0.76);
  border-top: 49px solid transparent;
  border-left: 59px solid rgba(232, 132, 164, 0.88);
}

.tiny-heart {
  position: absolute;
  z-index: 4;
  color: var(--rose);
  font-size: 0.82rem;
  text-shadow: 0 4px 12px rgba(214, 102, 137, 0.28);
  animation: heart-drift 3.8s ease-in-out infinite;
}

.heart-left { left: calc(50% - 91px); top: 42px; transform: rotate(-17deg); }
.heart-right { right: calc(50% - 91px); top: 95px; font-size: 0.64rem; animation-delay: -1.6s; }

.copy-block {
  text-align: center;
}

.overline {
  margin: 0 0 8px;
  color: var(--lavender);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #352e49;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(3.25rem, 10vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.98;
}

.title-dot {
  color: var(--rose);
}

.lede {
  max-width: 340px;
  margin: 16px auto 24px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.note-panel {
  padding: 16px 18px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.53);
  box-shadow: 0 5px 18px rgba(121, 91, 146, 0.04);
  transition: border-color 250ms ease, background 250ms ease, transform 250ms ease;
}

.note-panel.revealed {
  border-color: rgba(233, 134, 165, 0.35);
  background: rgba(255, 247, 250, 0.86);
  transform: translateY(-2px);
}

.note-panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.note-label {
  color: var(--rose);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.04rem;
  font-weight: 700;
}

.note-date {
  color: var(--soft-muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.note-panel p {
  min-height: 2.9em;
  margin: 0;
  color: #5e536c;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.01rem;
  line-height: 1.48;
}

.text-button,
.reset-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lavender-dark);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
}

.text-button {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
}

.button-arrow {
  display: inline-block;
  font-size: 0.95rem;
  transition: transform 180ms ease;
}

.text-button:hover .button-arrow {
  transform: translate(2px, -2px);
}

.actions {
  margin-top: 21px;
  text-align: center;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 49px;
  width: 100%;
  padding: 12px 18px;
  border: 1px solid rgba(110, 91, 197, 0.12);
  border-radius: 13px;
  background: linear-gradient(135deg, #8d78dd, #6f5ac7);
  box-shadow: 0 9px 20px rgba(110, 91, 197, 0.22), inset 0 1px rgba(255, 255, 255, 0.25);
  color: white;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  transition: box-shadow 180ms ease, transform 180ms ease, filter 180ms ease;
}

.primary-button:hover {
  filter: saturate(1.08) brightness(1.04);
  box-shadow: 0 12px 25px rgba(110, 91, 197, 0.29), inset 0 1px rgba(255, 255, 255, 0.28);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(0);
}

.button-icon {
  font-size: 1.05rem;
}

.safety-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 12px 0 0;
  color: var(--soft-muted);
  font-size: 0.68rem;
}

.safety-note span {
  color: #77b99c;
  font-size: 0.98rem;
}

.success-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 15px;
  border: 1px solid rgba(119, 202, 166, 0.32);
  border-radius: 15px;
  background: rgba(233, 251, 243, 0.72);
  animation: success-enter 450ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.success-panel[hidden] {
  display: none;
}

.success-icon {
  display: grid;
  flex: 0 0 31px;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: #72c39e;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.success-kicker {
  margin: 0 0 2px;
  color: #3f876b;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.success-copy {
  margin: 0;
  color: #4f7769;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.35;
}

.reset-button {
  flex: 0 0 auto;
  margin-left: auto;
  color: #4c9b79;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 21px;
  color: rgba(124, 113, 143, 0.75);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.footer-heart {
  color: rgba(233, 134, 165, 0.78);
  font-size: 0.78rem;
}

body.is-complete .note-card {
  animation: card-settle 700ms ease both;
}

body.is-complete .illustration-wrap {
  opacity: 0.48;
  filter: saturate(0.66);
  transition: opacity 400ms ease, filter 400ms ease;
}

body.is-complete .primary-button {
  pointer-events: none;
  background: linear-gradient(135deg, #a9b6bc, #82959c);
  box-shadow: none;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card-settle {
  0% { transform: scale(1); }
  45% { transform: scale(0.99); }
  100% { transform: scale(1); }
}

@keyframes envelope-float {
  0%, 100% { transform: translateY(1px) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes heart-drift {
  0%, 100% { opacity: 0.66; transform: translateY(2px) rotate(-17deg) scale(1); }
  50% { opacity: 1; transform: translateY(-7px) rotate(-7deg) scale(1.1); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.82) rotate(0deg); }
  50% { opacity: 0.85; transform: scale(1.14) rotate(18deg); }
}

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

@media (max-width: 520px) {
  .page-shell {
    padding: 28px 15px 22px;
  }

  .note-card {
    padding: 26px 22px 23px;
    border-radius: 25px;
  }

  .illustration-wrap {
    height: 165px;
    margin-top: 18px;
  }

  .lede {
    margin-bottom: 21px;
  }

  .success-panel {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .reset-button {
    width: 100%;
    margin: 2px 0 0 43px;
    text-align: left;
  }
}

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