:root {
  --bg-deep: #150b18;
  --bg-mid: #281329;
  --bg-warm: #3f1c35;

  --paper-base: #fffcf8;
  --paper-warm: #fdf3e7;

  --env-front-1: #f8ede1;
  --env-front-2: #eedccb;
  --env-side: #f3e4d4;
  --env-flap: #fbf2e8;
  --env-lining: #681f3c;

  --ink-heading: #591732;
  --ink-body: #3b1e2b;
  --ink-muted: #7d5665;

  --gold-light: #fae4a7;
  --gold-mid: #d6a449;
  --gold-deep: #9e6d1c;
  --rose-accent: #c93b66;

  --font-display: "Mirza", "Vazirmatn", serif;
  --font-body: "Vazirmatn", system-ui, -apple-system, sans-serif;
}

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

html {
  min-height: 100%;
  background-color: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  background-color: var(--bg-deep);
  color: var(--ink-body);
  overflow-x: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Fixed velvet night backdrop */
.backdrop-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 24%, rgba(164, 54, 98, 0.34) 0%, transparent 58%),
    radial-gradient(circle at 18% 82%, rgba(214, 164, 73, 0.15) 0%, transparent 46%),
    linear-gradient(165deg, var(--bg-deep) 0%, var(--bg-mid) 52%, var(--bg-warm) 100%);
}

#sky-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* Floating Top Controls */
.top-controls {
  position: fixed;
  top: max(0.9rem, env(safe-area-inset-top));
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

body.is-opened .top-controls {
  opacity: 1;
  transform: translateY(0);
}

.glass-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(250, 228, 167, 0.34);
  background: rgba(31, 14, 29, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fcefd9;
  font-family: var(--font-body);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.glass-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(250, 228, 167, 0.65);
  background: rgba(54, 22, 46, 0.85);
}

.glass-pill:active {
  transform: scale(0.96);
}

.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 13px;
  width: 14px;
}

.eq-bars span {
  display: block;
  width: 2.5px;
  height: 4px;
  border-radius: 2px;
  background: var(--gold-light);
  transition: height 0.2s ease;
}

.glass-pill.is-playing .eq-bars span:nth-child(1) {
  animation: eqBounce 0.85s ease-in-out infinite;
}
.glass-pill.is-playing .eq-bars span:nth-child(2) {
  animation: eqBounce 0.65s ease-in-out 0.18s infinite;
}
.glass-pill.is-playing .eq-bars span:nth-child(3) {
  animation: eqBounce 0.95s ease-in-out 0.32s infinite;
}

@keyframes eqBounce {
  0%, 100% { height: 3px; }
  50% { height: 13px; }
}

/* =========================================================
   STAGE 1: HEIRLOOM SEALED ENVELOPE
   ========================================================= */
.envelope-stage {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.75s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.75s;
}

body.is-opened .envelope-stage {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.stage-pretitle {
  text-align: center;
  margin-bottom: 2rem;
  color: #faecd6;
  animation: gentleFloat 4.5s ease-in-out infinite;
}

.stage-star-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(250, 228, 167, 0.3);
  background: rgba(255, 245, 225, 0.07);
  color: var(--gold-light);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}

.stage-heading {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5.2vw, 2.35rem);
  font-weight: 700;
  line-height: 1.45;
  background: linear-gradient(180deg, #fffdf8 15%, #f5d896 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(214, 164, 73, 0.22);
}

.envelope-wrapper {
  position: relative;
  width: min(90vw, 420px);
  aspect-ratio: 1.46 / 1;
  perspective: 1300px;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.envelope-wrapper:hover {
  transform: translateY(-5px);
}

.envelope-aura {
  position: absolute;
  inset: -14%;
  background: radial-gradient(circle, rgba(226, 165, 92, 0.28) 0%, rgba(201, 59, 102, 0.16) 45%, transparent 72%);
  filter: blur(22px);
  z-index: 0;
  pointer-events: none;
  animation: auraPulse 3.8s ease-in-out infinite;
}

@keyframes auraPulse {
  0%, 100% { opacity: 0.75; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.04); }
}

.envelope-back {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #561630 0%, var(--env-lining) 100%);
  box-shadow:
    0 26px 55px rgba(7, 2, 10, 0.68),
    0 4px 16px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1.5px rgba(250, 228, 167, 0.35);
  z-index: 1;
  overflow: hidden;
}

.envelope-back::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(250, 228, 167, 0.28);
  border-radius: 9px;
  background-image: radial-gradient(rgba(250, 228, 167, 0.32) 1px, transparent 1px);
  background-size: 18px 18px;
}

.envelope-letter-preview {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 9%;
  bottom: 8%;
  background: linear-gradient(180deg, #fffdf9 0%, #faefe2 100%);
  border-radius: 10px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(214, 164, 73, 0.55);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.15rem 1rem;
  text-align: center;
  opacity: 0;
  transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.envelope-letter-preview::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(214, 164, 73, 0.35);
  border-radius: 6px;
  pointer-events: none;
}

.preview-crest {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.preview-line {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.8vw, 1.42rem);
  color: var(--ink-heading);
  font-weight: 700;
}

body.is-opening .envelope-letter-preview {
  opacity: 1;
  transform: translateY(-56%);
}

.envelope-pocket {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
}

.pocket-left {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--env-side) 0%, #e7d3be 100%);
  clip-path: polygon(0 0, 53% 52%, 0 100%);
}

.pocket-right {
  position: absolute;
  inset: 0;
  background: linear-gradient(225deg, var(--env-side) 0%, #e4cfb8 100%);
  clip-path: polygon(100% 0, 47% 52%, 100% 100%);
}

.pocket-bottom {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--env-front-1) 0%, var(--env-front-2) 100%);
  clip-path: polygon(0 100%, 50% 46%, 100% 100%);
  filter: drop-shadow(0 -3px 8px rgba(68, 28, 42, 0.14));
}

.envelope-gold-trim {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 1.5px solid rgba(214, 164, 73, 0.55);
  z-index: 4;
  pointer-events: none;
}

.envelope-recipient {
  position: absolute;
  bottom: 11%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 3.4vw, 1.25rem);
  color: #65203b;
  white-space: nowrap;
  padding: 0.15rem 0.9rem;
  border-bottom: 1px solid rgba(180, 128, 42, 0.42);
  pointer-events: none;
}

.envelope-top-flap {
  position: absolute;
  inset: 0;
  z-index: 6;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.78s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.38s;
  pointer-events: none;
}

.flap-face {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, var(--env-flap) 0%, #ecd9c6 100%);
  filter: drop-shadow(0 6px 10px rgba(56, 20, 35, 0.18));
}

.flap-lining {
  position: absolute;
  inset: 0;
  clip-path: polygon(2% 0, 98% 0, 50% 55%);
  background: linear-gradient(180deg, #7c2448 0%, #561630 100%);
  opacity: 0;
  transition: opacity 0.15s ease 0.32s;
}

body.is-opening .envelope-top-flap {
  transform: rotateX(180deg);
  z-index: 1;
}

body.is-opening .flap-lining {
  opacity: 1;
}

.wax-seal-btn {
  position: absolute;
  top: 53%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  width: 84px;
  height: 84px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
  filter: drop-shadow(0 8px 14px rgba(45, 8, 22, 0.42));
}

.wax-seal-btn:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.wax-seal-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.wax-seal-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.seal-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(250, 228, 167, 0.6);
  animation: sealRing 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes sealRing {
  0% { transform: scale(0.9); opacity: 0.85; }
  100% { transform: scale(1.38); opacity: 0; }
}

body.is-opening .wax-seal-btn {
  transform: translate(-50%, -50%) scale(1.25) rotate(10deg);
  opacity: 0;
  pointer-events: none;
}

.open-prompt {
  margin-top: 2rem;
  color: rgba(252, 239, 217, 0.85);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: softBlink 2.6s ease-in-out infinite;
}

@keyframes softBlink {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

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

/* =========================================================
   STAGE 2: LUSH BOTANICAL BIRTHDAY POSTCARD
   ========================================================= */
.card-stage {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.8rem 1rem 2.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.85s ease, visibility 0.85s;
}

body.is-opened .card-stage {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.postcard {
  position: relative;
  width: 100%;
  max-width: 620px;
  background:
    radial-gradient(circle at 50% 13%, var(--candle-glow, rgba(255, 202, 112, 0.28)) 0%, transparent 48%),
    radial-gradient(circle at 92% 8%, rgba(244, 174, 198, 0.34) 0%, transparent 42%),
    radial-gradient(circle at 8% 12%, rgba(250, 214, 168, 0.28) 0%, transparent 40%),
    radial-gradient(circle at 12% 92%, rgba(244, 174, 198, 0.3) 0%, transparent 44%),
    radial-gradient(circle at 90% 90%, rgba(248, 216, 172, 0.26) 0%, transparent 44%),
    linear-gradient(180deg, var(--paper-base) 0%, var(--paper-warm) 100%);
  border-radius: 28px;
  padding: clamp(1.85rem, 4.5vw, 2.75rem) clamp(1.25rem, 4.5vw, 2.75rem);
  box-shadow:
    0 32px 85px rgba(8, 2, 12, 0.72),
    0 0 55px rgba(214, 164, 73, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.92);
  transform: translateY(34px) scale(0.96);
  transition:
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.8s ease;
  overflow: hidden;
  user-select: text;
}

.postcard.candle-out {
  --candle-glow: rgba(214, 164, 73, 0.11);
}

body.is-opened .postcard {
  transform: translateY(0) scale(1);
}

/* Cotton Paper Fiber Grain & Star Constellation Watermark */
.paper-grain {
  position: absolute;
  inset: 0;
  opacity: 0.3;
  pointer-events: none;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
}

.constellation-watermark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Double Gold Foil Hairline Frame */
.gold-frame-outer {
  position: absolute;
  inset: 12px;
  border: 1.5px solid rgba(202, 149, 59, 0.55);
  border-radius: 20px;
  pointer-events: none;
  z-index: 2;
}

.gold-frame-inner {
  position: absolute;
  inset: 17px;
  border: 1px solid rgba(202, 149, 59, 0.28);
  border-radius: 16px;
  pointer-events: none;
  z-index: 2;
}

/* Lush Watercolor Floral Corner Bouquets */
.floral-corner {
  position: absolute;
  width: 112px;
  height: 112px;
  pointer-events: none;
  z-index: 2;
}
.corner-tr { top: 6px; right: 6px; }
.corner-tl { top: 6px; left: 6px; transform: scaleX(-1); }
.corner-br { bottom: 6px; right: 6px; transform: scaleY(-1); }
.corner-bl { bottom: 6px; left: 6px; transform: scale(-1, -1); }

/* =========================================================
   COLLECTIBLE POSTAL STAMP & GOLD POSTMARK SEAL
   ========================================================= */
.postal-stamp-group {
  position: absolute;
  top: 40px;
  left: 40px;
  z-index: 4;
  transform: rotate(-5deg);
  pointer-events: none;
}

.postage-stamp {
  width: 66px;
  height: 78px;
  padding: 5px;
  background:
    radial-gradient(circle, transparent 3.2px, #fff9ef 3.6px) -5px -5px / 10px 10px;
  filter: drop-shadow(0 4px 10px rgba(72, 22, 42, 0.16));
}

.stamp-inner {
  width: 100%;
  height: 100%;
  background: #fff9ef;
  padding: 2px;
  border: 1px solid rgba(180, 128, 42, 0.4);
}

.stamp-art {
  width: 100%;
  height: 100%;
  display: block;
}

.postmark-seal {
  position: absolute;
  bottom: -14px;
  right: -38px;
  width: 96px;
  height: 60px;
  transform: rotate(9deg);
}

/* Postcard Inner Content */
.postcard-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.tara-crest {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold-deep);
  background: rgba(255, 250, 240, 0.82);
  border: 1px solid rgba(214, 164, 73, 0.42);
  padding: 0.26rem 0.95rem;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(180, 128, 42, 0.08);
  margin-bottom: 0.35rem;
}

/* =========================================================
   ILLUSTRATED CAKE, SWAYING BALLOONS & CANDLE
   ========================================================= */
.cake-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0.05rem 0 0.75rem;
}

.cake-illustration-btn {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  width: 228px;
  height: 162px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.cake-illustration-btn:hover {
  transform: scale(1.03);
}

.cake-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.balloon-cluster-left {
  transform-origin: 55px 130px;
  animation: balloonSway 4.2s ease-in-out infinite alternate;
}

.balloon-cluster-right {
  transform-origin: 205px 130px;
  animation: balloonSway 4.6s ease-in-out 0.6s infinite alternate-reverse;
}

.butterfly-accent {
  animation: butterflyFlutter 3.4s ease-in-out infinite;
}

@keyframes balloonSway {
  0% { transform: rotate(-2.5deg) translateY(0); }
  100% { transform: rotate(2.5deg) translateY(-4px); }
}

@keyframes butterflyFlutter {
  0%, 100% { transform: translate(174px, 28px) rotate(14deg) scale(1); }
  50% { transform: translate(171px, 23px) rotate(8deg) scale(0.92, 1.06); }
}

/* Animated Candle Flame */
.flame-group {
  transform-origin: 100px 41px;
  animation: flameFlicker 1.6s ease-in-out infinite alternate;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.flame-halo {
  animation: haloBreath 2.1s ease-in-out infinite;
  transform-origin: 100px 30px;
}

@keyframes flameFlicker {
  0%   { transform: rotate(-2.5deg) scale(0.97, 1.03); }
  33%  { transform: rotate(2deg) scale(1.03, 0.97); }
  66%  { transform: rotate(-1.5deg) scale(0.99, 1.05); }
  100% { transform: rotate(2.8deg) scale(1.02, 0.96); }
}

@keyframes haloBreath {
  0%, 100% { opacity: 0.55; transform: scale(0.94); }
  50% { opacity: 0.92; transform: scale(1.1); }
}

.postcard.candle-out .flame-group,
.postcard.candle-out .flame-halo {
  opacity: 0;
  transform: scale(0.2) translateY(8px);
  pointer-events: none;
}

.smoke-wisp {
  opacity: 0;
  stroke-dasharray: 44;
  stroke-dashoffset: 44;
}

.postcard.candle-out .smoke-wisp-1 {
  animation: smokeRise 2.4s ease-out forwards;
}

.postcard.candle-out .smoke-wisp-2 {
  animation: smokeRise 2.6s ease-out 0.22s forwards;
}

@keyframes smokeRise {
  0% { opacity: 0; stroke-dashoffset: 44; transform: translateY(4px); }
  25% { opacity: 0.65; }
  100% { opacity: 0; stroke-dashoffset: 0; transform: translateY(-24px) scaleX(1.2); }
}

/* Wish / Blow Button */
.wish-controls {
  min-height: 2.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}

.blow-candle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 59, 102, 0.38);
  background: linear-gradient(135deg, #fff6f9 0%, #fde4ee 100%);
  color: #8c2046;
  font-family: var(--font-body);
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(168, 45, 88, 0.13);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.blow-candle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(168, 45, 88, 0.22);
}

.blow-candle-btn:active {
  transform: scale(0.96);
}

.wish-granted-box {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
  animation: fadeSlideUp 0.55s ease forwards;
}

.postcard.candle-out .blow-candle-btn {
  display: none;
}

.postcard.candle-out .wish-granted-box {
  display: flex;
}

.wish-granted-text {
  font-size: 0.86rem;
  font-weight: 600;
  color: #8c2046;
  background: rgba(214, 164, 73, 0.17);
  border: 1px solid rgba(214, 164, 73, 0.45);
  padding: 0.35rem 1rem;
  border-radius: 999px;
}

.relight-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 0.77rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  opacity: 0.85;
}

.relight-btn:hover {
  opacity: 1;
  color: var(--ink-heading);
}

/* =========================================================
   CALLIGRAPHIC GREETING & FRAMED LETTER SCROLL
   ========================================================= */
.card-title {
  font-family: var(--font-display);
  font-size: clamp(1.72rem, 5.2vw, 2.38rem);
  font-weight: 700;
  line-height: 1.48;
  color: var(--ink-heading);
  margin-top: 0.15rem;
  margin-bottom: 0.85rem;
  text-wrap: balance;
}

.card-title .title-subline {
  display: block;
  color: #9e2348;
  font-size: 1.05em;
}

.letter-scroll-box {
  position: relative;
  width: 100%;
  max-width: 49ch;
  padding: 1.35rem clamp(1.05rem, 3.6vw, 1.85rem);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 252, 249, 0.92) 0%, rgba(253, 238, 243, 0.68) 100%);
  border: 1px solid rgba(214, 164, 73, 0.45);
  box-shadow:
    0 10px 28px rgba(138, 42, 78, 0.06),
    inset 0 0 0 3px rgba(255, 255, 255, 0.68);
}

.quote-mark {
  position: absolute;
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1;
  color: rgba(208, 150, 58, 0.42);
  pointer-events: none;
}

.quote-open {
  top: 6px;
  right: 12px;
}

.quote-close {
  bottom: 2px;
  left: 12px;
}

.letter-paragraph {
  font-size: clamp(1.03rem, 2.6vw, 1.15rem);
  font-weight: 400;
  line-height: 2.1;
  color: var(--ink-body);
  text-align: center;
  text-wrap: pretty;
}

.letter-closing {
  display: block;
  margin-top: 0.7rem;
  text-wrap: balance;
}

.letter-highlight {
  display: inline;
  font-weight: 600;
  color: #741a3d;
  background: linear-gradient(180deg, transparent 64%, rgba(246, 194, 212, 0.6) 64%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0.04rem 0.35rem;
  border-radius: 4px;
}

/* Ornamental Gold Filigree Divider */
.filigree-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: min(86%, 340px);
  margin: 1.25rem auto 1.05rem;
}

.filigree-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(196, 143, 52, 0.75) 50%, transparent 100%);
}

.filigree-floral {
  color: var(--gold-mid);
  font-size: 0.88rem;
  letter-spacing: 0.15em;
}

/* =========================================================
   3 INTERACTIVE STAR-WISH KEEPSAKE CARDS
   ========================================================= */
.wishes-keepsake {
  width: 100%;
  margin-bottom: 0.35rem;
}

.keepsake-heading {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: #6f2140;
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.keepsake-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-muted);
}

.wish-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 0.65rem;
  width: 100%;
}

.wish-token {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 0.8rem 0.65rem;
  border-radius: 16px;
  border: 1px solid rgba(214, 164, 73, 0.48);
  background: linear-gradient(165deg, #fffdf9 0%, #fdf0f4 100%);
  box-shadow: 0 5px 15px rgba(120, 38, 68, 0.07);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink-body);
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    background 0.3s ease,
    box-shadow 0.25s ease;
}

.wish-token:hover {
  transform: translateY(-3px);
  border-color: rgba(201, 59, 102, 0.55);
  box-shadow: 0 9px 22px rgba(158, 42, 84, 0.13);
}

.wish-token:active {
  transform: scale(0.97);
}

.token-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  width: 100%;
}

.token-icon {
  font-size: 1.35rem;
  line-height: 1.1;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wish-token:hover .token-icon,
.wish-token.is-revealed .token-icon {
  transform: scale(1.18) rotate(-4deg);
}

.token-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #6a1b3a;
}

.token-tap-badge {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gold-deep);
  background: rgba(214, 164, 73, 0.15);
  border: 1px solid rgba(214, 164, 73, 0.35);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  transition: opacity 0.25s ease, background 0.25s ease;
}

.token-reveal {
  display: none;
  margin-top: 0.5rem;
  padding-top: 0.48rem;
  border-top: 1px dashed rgba(201, 59, 102, 0.28);
  font-size: 0.8rem;
  line-height: 1.75;
  color: #4d2234;
  animation: fadeSlideUp 0.4s ease forwards;
}

.wish-token.is-revealed {
  background: linear-gradient(165deg, #fff9fb 0%, #fbe3ec 100%);
  border-color: rgba(201, 59, 102, 0.55);
  box-shadow: 0 8px 22px rgba(176, 48, 92, 0.14);
}

.wish-token.is-revealed .token-tap-badge {
  display: none;
}

.wish-token.is-revealed .token-reveal {
  display: block;
}

/* =========================================================
   SIGNATURE RIBBON & INTERACTIVE HEART WHISPERS
   ========================================================= */
.card-footer-signoff {
  margin-top: 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.signature-ribbon {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 600;
  color: #7d2347;
  padding: 0.18rem 1.15rem;
  margin-bottom: 0.75rem;
}

.signature-ribbon::before,
.signature-ribbon::after {
  content: "❦";
  color: var(--gold-mid);
  font-size: 0.95rem;
}

.heart-medallion-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.38rem;
}

.heart-medallion-btn {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1.5px solid rgba(214, 164, 73, 0.65);
  background: radial-gradient(circle at 35% 30%, #fff8fa 0%, #fce0ea 65%, #f5c6d7 100%);
  box-shadow:
    0 8px 22px rgba(180, 48, 92, 0.22),
    inset 0 2px 6px rgba(255, 255, 255, 0.92);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
  animation: heartBeat 2.8s ease-in-out infinite;
}

.heart-medallion-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 28px rgba(180, 48, 92, 0.32);
}

.heart-medallion-btn:active {
  transform: scale(0.93);
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.07); }
  28% { transform: scale(1); }
  42% { transform: scale(1.05); }
  58% { transform: scale(1); }
}

.heart-caption {
  font-size: 0.77rem;
  color: var(--ink-muted);
  max-width: 215px;
  line-height: 1.6;
  margin-bottom: 0.3rem;
}

/* Floating Persian Love-Note Bubbles */
.love-whisper {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  padding: 0.36rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(122, 24, 62, 0.92) 0%, rgba(168, 42, 88, 0.92) 100%);
  border: 1px solid rgba(250, 228, 167, 0.65);
  color: #fff8ee;
  font-family: var(--font-body);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(40, 8, 22, 0.32);
  animation: whisperFloatUp 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes whisperFloatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.82);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -12px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift-x, 0px)), -92px) scale(0.96);
  }
}

/* Staggered Reveal on Card Open */
.reveal-item {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.75s ease, transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

body.is-opened .reveal-1 { opacity: 1; transform: translateY(0); transition-delay: 0.12s; }
body.is-opened .reveal-2 { opacity: 1; transform: translateY(0); transition-delay: 0.24s; }
body.is-opened .reveal-3 { opacity: 1; transform: translateY(0); transition-delay: 0.38s; }
body.is-opened .reveal-4 { opacity: 1; transform: translateY(0); transition-delay: 0.52s; }
body.is-opened .reveal-5 { opacity: 1; transform: translateY(0); transition-delay: 0.66s; }

body.is-opened .postal-stamp-group.reveal-1 {
  transform: rotate(-5deg);
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Refinements */
@media (max-width: 560px) {
  .card-stage {
    padding: 4.55rem 0.8rem 2.4rem;
  }

  .postcard {
    border-radius: 24px;
    padding: 1.75rem 1.05rem 2rem;
  }

  .gold-frame-outer { inset: 9px; border-radius: 17px; }
  .gold-frame-inner { inset: 13px; border-radius: 14px; }

  .floral-corner {
    width: 78px;
    height: 78px;
  }

  .postal-stamp-group {
    top: 48px;
    left: 18px;
    transform: scale(0.66) rotate(-6deg);
    transform-origin: top left;
  }

  body.is-opened .postal-stamp-group.reveal-1 {
    transform: scale(0.66) rotate(-6deg);
  }

  .tara-crest {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    padding: 0.22rem 0.78rem;
  }

  .wish-cards-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .wish-token {
    padding: 0.68rem 0.9rem;
  }

  .token-front {
    flex-direction: row;
    justify-content: space-between;
  }

  .token-title {
    margin-left: auto;
    margin-right: 0.5rem;
  }

  .token-tap-badge {
    margin-top: 0;
  }

  .token-reveal {
    text-align: right;
    width: 100%;
  }

  .wax-seal-btn {
    width: 74px;
    height: 74px;
  }
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
  }
}

/* Print Friendly Mode */
@media print {
  body {
    background: #ffffff !important;
  }
  .backdrop-layer,
  #sky-canvas,
  #fx-canvas,
  .top-controls,
  .envelope-stage,
  .wish-controls,
  .heart-caption {
    display: none !important;
  }
  .card-stage {
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0 !important;
  }
  .postcard {
    transform: none !important;
    box-shadow: none !important;
    border: 2px solid #d6a449 !important;
    margin: 0 auto !important;
  }
  .reveal-item {
    opacity: 1 !important;
    transform: none !important;
  }
  .token-reveal {
    display: block !important;
  }
  .token-tap-badge {
    display: none !important;
  }
}
