:root {
  color-scheme: light;
  --ink: #4b3038;
  --ink-soft: #765861;
  --rose: #d4748b;
  --rose-dark: #a94f68;
  --rose-light: #f8dce3;
  --rose-pale: #fff0f3;
  --cream: #fff9f1;
  --paper: rgba(255, 253, 251, 0.88);
  --paper-solid: #fffdfb;
  --line: rgba(201, 106, 129, 0.24);
  --shadow: 0 28px 80px rgba(112, 53, 69, 0.16), 0 8px 24px rgba(112, 53, 69, 0.08);
  --ease-out: cubic-bezier(0.2, 0.75, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 10%, rgba(250, 213, 222, 0.86), transparent 30%),
    radial-gradient(circle at 95% 88%, rgba(252, 232, 196, 0.82), transparent 30%),
    linear-gradient(145deg, #fff4f6 0%, var(--cream) 48%, #fffdf8 100%);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(1.25rem, 5vw, 4.5rem) 1.25rem;
  overflow: hidden;
}

.page-shell::before {
  position: fixed;
  z-index: 1;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: radial-gradient(rgba(169, 79, 104, 0.12) 0.7px, transparent 0.7px);
  background-size: 19px 19px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 75%);
  opacity: 0.42;
}

.background-glow {
  position: fixed;
  z-index: 0;
  width: min(44vw, 31rem);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.55;
  pointer-events: none;
  animation: glow-float 10s ease-in-out infinite alternate;
}

.background-glow--one {
  top: -14rem;
  left: -10rem;
  background: rgba(247, 190, 206, 0.5);
}

.background-glow--two {
  right: -9rem;
  bottom: -15rem;
  background: rgba(255, 224, 177, 0.55);
  animation-delay: -5s;
}

.music-player {
  position: fixed;
  z-index: 0;
  top: -10px;
  left: -10px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.music-player iframe {
  width: 1px;
  height: 1px;
  border: 0;
}

.music-control {
  position: fixed;
  z-index: 4;
  right: 1.2rem;
  bottom: 1.2rem;
}

.music-control[hidden] {
  display: none;
}

.music-control.is-visible {
  animation: content-in 500ms var(--ease-out) both;
}

.music-button {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  min-height: 2.55rem;
  padding: 0.42rem 0.78rem 0.42rem 0.45rem;
  color: var(--rose-dark);
  background: rgba(255, 253, 251, 0.87);
  border: 1px solid rgba(212, 116, 139, 0.25);
  border-radius: 999px;
  box-shadow: 0 9px 22px rgba(112, 53, 69, 0.13);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  transition: transform 180ms var(--ease-out), background-color 180ms ease, box-shadow 180ms ease;
}

.music-button:hover {
  background: #fff;
  box-shadow: 0 12px 25px rgba(112, 53, 69, 0.17);
  transform: translateY(-2px);
}

.music-button:focus-visible {
  outline: 3px solid rgba(200, 116, 134, 0.32);
  outline-offset: 3px;
}

.music-button__icon {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  color: #fff;
  background: linear-gradient(135deg, #d4778e, var(--rose-dark));
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 1rem;
  line-height: 1;
  place-items: center;
}

.letter {
  position: relative;
  z-index: 2;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, 45rem);
  padding: clamp(2.3rem, 6vw, 4.5rem) clamp(1.3rem, 7vw, 5.2rem) clamp(2rem, 5vw, 3.2rem);
  text-align: center;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 249, 247, 0.84)),
    var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.98);
  border-radius: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(120%);
  transition: box-shadow 700ms ease, transform 700ms var(--ease-out);
  animation: card-in 900ms var(--ease-out) both;
}

.letter > * {
  position: relative;
  z-index: 1;
}

.letter::before {
  position: absolute;
  z-index: 0;
  inset: 0.6rem;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(212, 116, 139, 0.15);
  border-radius: 1.55rem;
}

.letter::after {
  position: absolute;
  z-index: 0;
  top: -11rem;
  left: 50%;
  width: 25rem;
  height: 18rem;
  content: "";
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(248, 220, 227, 0.75), transparent 70%);
  transform: translateX(-50%);
}

.letter--open {
  box-shadow: 0 32px 90px rgba(112, 53, 69, 0.2), 0 10px 28px rgba(112, 53, 69, 0.1);
}

.letter__ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: clamp(1.7rem, 4vw, 2.9rem);
}

.letter__ornament > span:not(.letter__ornament-heart) {
  width: clamp(2.8rem, 12vw, 5.5rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line));
}

.letter__ornament > span:last-child {
  background: linear-gradient(90deg, var(--line), transparent);
}

.letter__ornament-heart {
  display: grid;
  width: 2rem;
  height: 2rem;
  color: #fff;
  background: linear-gradient(135deg, #df8297, var(--rose-dark));
  border-radius: 50%;
  box-shadow: 0 6px 15px rgba(169, 79, 104, 0.2);
  font-size: 0.78rem;
  line-height: 2rem;
  place-items: center;
  animation: heartbeat 2.8s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--rose-dark);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
}

h1 {
  color: var(--rose-dark);
  background: linear-gradient(110deg, #733b4b 12%, var(--rose-dark) 56%, #d47a8e 100%);
  background-clip: text;
  -webkit-background-clip: text;
  font-size: clamp(2.35rem, 8vw, 4.25rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  -webkit-text-fill-color: transparent;
}

.opening__lead {
  margin: 1rem 0 2rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
}

.opening__actions {
  display: grid;
  min-height: 3.1rem;
  place-items: center;
}

.button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.1rem;
  padding: 0.78rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 220ms var(--ease-out), box-shadow 220ms ease, background-color 220ms ease, border-color 220ms ease;
}

.button > span {
  position: relative;
  z-index: 1;
}

.button__arrow {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 180ms var(--ease-out);
}

.button:not(:disabled):hover .button__arrow,
.button:not(:disabled):focus-visible .button__arrow {
  transform: translateX(4px);
}

.button::after {
  position: absolute;
  z-index: 0;
  top: -60%;
  left: -35%;
  width: 24%;
  height: 220%;
  content: "";
  pointer-events: none;
  background: rgba(255, 255, 255, 0.35);
  filter: blur(1px);
  transform: rotate(20deg) translateX(-220%);
  transition: transform 650ms var(--ease-out);
}

.button:hover {
  transform: translateY(-3px) scale(1.015);
}

.button:hover::after {
  transform: rotate(20deg) translateX(650%);
}

.button:focus-visible {
  outline: 3px solid rgba(200, 116, 134, 0.32);
  outline-offset: 4px;
}

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

.button:disabled {
  cursor: default;
  opacity: 0.72;
}

.button:disabled:hover {
  transform: none;
}

.button:disabled::after {
  display: none;
}

.button--primary {
  color: #fff;
  background: linear-gradient(135deg, #c7647c, #a94f68);
  box-shadow: 0 10px 24px rgba(169, 79, 104, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.button--primary:hover {
  background: linear-gradient(135deg, #d06d84, #9f465f);
  box-shadow: 0 14px 28px rgba(169, 79, 104, 0.31), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.button--secondary {
  color: var(--rose-dark);
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(200, 116, 134, 0.35);
  box-shadow: 0 7px 18px rgba(125, 68, 82, 0.08);
}

.button--secondary:hover {
  background: #fff5f7;
  border-color: rgba(200, 116, 134, 0.55);
}

.button--back {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(118, 88, 97, 0.2);
  box-shadow: 0 7px 18px rgba(112, 53, 69, 0.06);
}

.button--back:hover {
  color: var(--rose-dark);
  background: #fff;
  border-color: rgba(212, 116, 139, 0.42);
  box-shadow: 0 10px 20px rgba(112, 53, 69, 0.1);
}

.button--back.is-visible {
  animation: content-in 500ms var(--ease-out) both;
}

.button--opened {
  opacity: 0.62;
  box-shadow: none;
}

.message-panel,
.closing-panel {
  position: relative;
  margin-top: clamp(2.3rem, 7vw, 3.8rem);
  padding-top: clamp(1.8rem, 5vw, 2.7rem);
  border-top: 1px solid var(--line);
}

.message-panel[hidden],
.closing-panel[hidden] {
  display: none;
}

.message-panel.is-visible,
.closing-panel.is-visible {
  animation: content-in 750ms var(--ease-out) both;
}

.message-panel__rule {
  position: absolute;
  top: -0.72rem;
  left: 50%;
  display: grid;
  width: 2.5rem;
  height: 1.4rem;
  color: var(--rose);
  background: var(--paper-solid);
  transform: translateX(-50%);
  place-items: center;
}

.message-panel__rule::before {
  content: "♥";
  font-size: 0.68rem;
}

.message-panel h2,
.closing-panel h2 {
  margin-bottom: 1.6rem;
  color: var(--rose-dark);
  font-size: clamp(1.5rem, 5vw, 2rem);
}

.message-copy {
  margin: 0 auto 2rem;
  max-width: 33rem;
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 2.2vw, 1.05rem);
  line-height: 1.9;
  text-wrap: pretty;
}

.message-copy p {
  margin: 0 0 1.3rem;
}

.message-copy p:last-child {
  margin-bottom: 0;
}

.message-copy__highlight {
  width: fit-content;
  margin-right: auto !important;
  margin-left: auto !important;
  padding: 0.55rem 1.25rem 0.65rem;
  color: var(--rose-dark);
  background: linear-gradient(135deg, rgba(248, 220, 227, 0.62), rgba(255, 246, 239, 0.9));
  border: 1px solid rgba(212, 116, 139, 0.16);
  border-radius: 999px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  font-style: italic;
  line-height: 1.35;
}

.closing-panel {
  margin-top: 2rem;
  padding: clamp(1.7rem, 5vw, 2.35rem) clamp(1rem, 4vw, 2rem);
  background: linear-gradient(145deg, rgba(255, 240, 244, 0.75), rgba(255, 251, 244, 0.88));
  border: 1px solid rgba(212, 116, 139, 0.17);
  border-radius: 1.4rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.closing-panel__sparkle {
  margin-bottom: 0.8rem;
  color: var(--rose);
  font-size: 1.2rem;
}

.closing-panel p {
  max-width: 29rem;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 2.2vw, 1.05rem);
  line-height: 1.8;
}

.closing-panel .signature {
  margin-top: 1.2rem;
  color: var(--rose-dark);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.2rem;
  font-style: italic;
}

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

.rain-heart {
  position: absolute;
  top: -12vh;
  left: var(--left);
  color: var(--heart-color);
  font-size: var(--size);
  line-height: 1;
  opacity: 0;
  text-shadow: 0 4px 10px rgba(169, 79, 104, 0.15);
  will-change: transform;
  animation: heart-fall var(--duration) linear var(--delay) infinite;
}

.burst-heart {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  color: var(--burst-color);
  pointer-events: none;
  font-size: var(--burst-size);
  line-height: 1;
  text-shadow: 0 3px 8px rgba(169, 79, 104, 0.16);
  animation: heart-burst 900ms var(--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;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes content-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glow-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(1.8rem, -1.2rem, 0) scale(1.08); }
}

@keyframes heart-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -10vh, 0) rotate(0deg);
  }
  10% { opacity: var(--heart-opacity); }
  52% {
    opacity: var(--heart-opacity);
    transform: translate3d(var(--sway), 52vh, 0) rotate(190deg);
  }
  92% { opacity: var(--heart-opacity); }
  100% {
    opacity: 0;
    transform: translate3d(var(--sway-end), 116vh, 0) rotate(380deg);
  }
}

@keyframes heart-burst {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.35) rotate(0deg);
  }
  16% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y)), 0) scale(1.15) rotate(var(--burst-rotate));
  }
}

@keyframes heartbeat {
  0%, 35%, 100% { transform: scale(1); }
  18% { transform: scale(1.18); }
  26% { transform: scale(1); }
}

@media (max-width: 520px) {
  .page-shell {
    padding: 1rem 0.7rem;
  }

  .letter {
    padding-top: 2.2rem;
    padding-bottom: 2rem;
    border-radius: 1.45rem;
  }

  .letter::before {
    inset: 0.4rem;
    border-radius: 1.1rem;
  }

  .button {
    width: 100%;
    max-width: 18rem;
  }

  .message-copy {
    line-height: 1.82;
  }

  .background-glow {
    width: 20rem;
  }

  .music-control {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}

@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;
  }
}
