/* ============================================
   Couples T1: Love-themed multi-session template
   Loading + intro, flippable cards, scrapbook, quiz, song, love meter, letter
   ============================================ */

body {
  --cp-font: 'Nunito', sans-serif;
  --cp-font-cute: 'Quicksand', sans-serif;
  --cp-header: 'Fredoka', 'Quicksand', sans-serif;
  --cp-display: 'Pacifico', 'Cormorant Garamond', cursive;
  --cp-serif: 'Cormorant Garamond', Georgia, serif;
  --cp-pink: #e91e63;
  --cp-pink-soft: #f8b4d0;
  --cp-red: #c2185b;
  --cp-rose: #fce4ec;
  --cp-bg: #1a0a12;
  --cp-bg-soft: #2d1a28;
  --cp-text: #fff;
  --cp-overlay: rgba(26, 10, 18, 0.95);
  --cp-mx: 50%;
  --cp-my: 15%;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--cp-font);
  color: var(--cp-text);
  -webkit-tap-highlight-color: transparent;
  background: var(--cp-bg);
  background-image:
    radial-gradient(ellipse 120% 90% at var(--cp-mx) var(--cp-my), rgba(233, 30, 99, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 100% 70% at 80% 80%, rgba(248, 180, 208, 0.14) 0%, transparent 46%),
    radial-gradient(ellipse 90% 60% at 10% 90%, rgba(194, 24, 91, 0.10) 0%, transparent 40%);
  transition: background-image 0.18s ease;
}

/* ---- Interactive background layer ---- */
.cp-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.cp-bg-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  left: calc(var(--cp-mx) - 260px);
  top: calc(var(--cp-my) - 260px);
  background: radial-gradient(circle at center, rgba(233, 30, 99, 0.35) 0%, rgba(233, 30, 99, 0.12) 32%, transparent 65%);
  filter: blur(26px);
  opacity: 0.9;
  transform: translateZ(0);
}

.cp-bg-hearts {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cp-bg-heart {
  position: absolute;
  left: 50%;
  bottom: -8vh;
  font-size: var(--size, 24px);
  opacity: 0;
  animation: cpBgHeartUp var(--dur, 3.8s) ease-out forwards;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.25));
}

@keyframes cpBgHeartUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.75) rotate(0deg);
  }
  10% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(-50%, -130vh) translateX(var(--dx, 0px)) scale(0.55) rotate(18deg);
  }
}

/* ---- Page container ---- */
.cp-pages {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.cp-page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.cp-page.cp-page-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ---- Decorated card (wraps every section content) ---- */
.cp-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  padding: 2rem 1.75rem;
  border-radius: 24px;
  border: 2px solid rgba(233, 30, 99, 0.4);
  box-shadow: 0 0 0 1px rgba(248, 180, 208, 0.2),
    0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  background: linear-gradient(165deg, rgba(45, 26, 40, 0.95) 0%, rgba(26, 10, 18, 0.98) 50%, rgba(45, 26, 40, 0.95) 100%);
  overflow: visible;
}

/* Let polaroids "drop behind" this card without clipping issues */
.cp-card.cp-p3-wrap {
  z-index: 0;
}

.cp-card::before {
  content: '♥';
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 0.85rem;
  color: rgba(233, 30, 99, 0.5);
  pointer-events: none;
}

.cp-card::after {
  content: '♥';
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 0.85rem;
  color: rgba(233, 30, 99, 0.5);
  pointer-events: none;
}

.cp-card .cp-p1-greeting { margin-top: 0.5rem; }
.cp-card.cp-p1-intro {
  padding: 2.5rem 2rem;
  width: fit-content;
  max-width: 100%;
  min-width: 280px;
}

.cp-card.cp-p1-intro .cp-p1-greeting {
  /* Make the intro feel more "letter-like" and cute */
  font-family: var(--cp-serif);
  font-weight: 600;
}

.cp-card.cp-p1-intro .cp-btn {
  padding: 0.75rem 1.7rem;
  font-size: 0.98rem;
}

/* ---- Buttons ---- */
.cp-btn {
  padding: 0.85rem 2rem;
  font-family: var(--cp-serif);
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.cp-btn:hover {
  transform: scale(1.05);
}

.cp-btn:active {
  transform: scale(0.98);
}

.cp-btn:focus-visible {
  outline: 2px solid var(--cp-pink-soft);
  outline-offset: 3px;
}

.cp-btn-primary {
  background: linear-gradient(135deg, var(--cp-pink), var(--cp-red));
  color: #fff;
  box-shadow: 0 4px 20px rgba(233, 30, 99, 0.4);
}

.cp-btn-primary:hover {
  box-shadow: 0 6px 28px rgba(233, 30, 99, 0.5);
}

.cp-btn-large {
  font-size: 1.25rem;
  padding: 1rem 2.5rem;
}

/* ---- Session 1: Loading + Intro ---- */
.cp-p1-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.cp-p1-loading.cp-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cp-loading-hearts {
  display: flex;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.cp-loading-heart {
  font-size: 2rem;
  animation: cpBounce 0.8s ease-in-out infinite;
}

.cp-loading-heart:nth-child(1) { animation-delay: 0s; }
.cp-loading-heart:nth-child(2) { animation-delay: 0.15s; }
.cp-loading-heart:nth-child(3) { animation-delay: 0.3s; }

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

.cp-loading-text {
  font-family: var(--cp-serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--cp-pink-soft);
}

.cp-p1-intro {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 90vw;
  transition: opacity 0.6s ease 0.2s, visibility 0.6s ease 0.2s;
}

.cp-p1-intro.cp-p1-intro-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cp-p1-intro.cp-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cp-p1-greeting {
  font-family: var(--cp-serif);
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 2rem;
  color: var(--cp-text);
}

.cp-p1-greeting span {
  color: var(--cp-pink-soft);
}

/* ---- Session 2: Why I love you (flippable cards) ---- */
.cp-p2-wrap {
  max-width: 520px;
  width: 100%;
  text-align: center;
}

.cp-p2-title {
  font-family: var(--cp-header);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin-bottom: 0.35rem;
  color: var(--cp-text);
}

.cp-p2-sub {
  font-family: var(--cp-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cp-pink-soft);
  margin-bottom: 1.5rem;
}

.cp-flip-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 1.5rem;
}

.cp-flip {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  perspective: 1000px;
  -webkit-tap-highlight-color: transparent;
  /* Slow floating movement (parent translate only; flip uses inner rotation) */
  animation: cpFlipFloat 7.5s ease-in-out infinite;
  will-change: transform;
}

.cp-page-2 #cp-flip-list .cp-flip:nth-child(1) { animation-delay: 0s; }
.cp-page-2 #cp-flip-list .cp-flip:nth-child(2) { animation-delay: 0.4s; }
.cp-page-2 #cp-flip-list .cp-flip:nth-child(3) { animation-delay: 0.8s; }
.cp-page-2 #cp-flip-list .cp-flip:nth-child(4) { animation-delay: 1.2s; }

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

.cp-flip:focus-visible {
  outline: 2px solid var(--cp-pink-soft);
  outline-offset: 2px;
  border-radius: 16px;
}

.cp-flip-inner {
  position: relative;
  display: block;
  width: 100%;
  min-height: 120px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.cp-flip.is-flipped .cp-flip-inner {
  transform: rotateY(180deg);
}

.cp-flip-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 2px solid rgba(233, 30, 99, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

.cp-flip-front {
  background: linear-gradient(145deg, rgba(233, 30, 99, 0.25), rgba(194, 24, 91, 0.2));
}

.cp-flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, rgba(248, 180, 208, 0.15), rgba(233, 30, 99, 0.12));
}

.cp-flip-num {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--cp-pink-soft);
}

.cp-flip-orn {
  font-size: 1.5rem;
}

.cp-flip-reason {
  font-family: var(--cp-serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--cp-text);
}

/* ---- Session 3: Memory polaroids ---- */
.cp-p3-wrap {
  max-width: 560px;
  width: 100%;
  text-align: center;
}

.cp-p3-title {
  font-family: var(--cp-header);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin-bottom: 1.5rem;
  color: var(--cp-text);
}

.cp-p3-polaroid-zone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 360px;
  margin-bottom: 1.25rem;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.cp-p3-polaroid {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: var(--cp-pol-top, 60px);
  width: var(--cp-pol-w, 250px);
  height: var(--cp-pol-h, 170px);
  z-index: var(--cp-z, 1);
  padding: 3px;
  border: 2px solid rgba(233, 30, 99, 0.25);
  background: linear-gradient(145deg, #fff7fb 0%, #fce4ec 70%, #f8b4d0 100%);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(233, 30, 99, 0.18);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  /* Only the front polaroid gets pointer-events (see .cp-p3-front) so taps never hit layers below */
  pointer-events: none;
  touch-action: manipulation;
  /* Swing the whole frame so the border + image match angles */
  animation: cpPolSwingBtn var(--cp-swing-dur, 7.5s) ease-in-out infinite;
  animation-delay: var(--cp-swing-delay, 0s);
}

/* Thread line (approx) */
.cp-p3-polaroid::before {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(-1 * var(--cp-thread-len, 170px));
  width: 2px;
  height: var(--cp-thread-len, 170px);
  transform: translateX(-50%);
  transform-origin: bottom center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(233, 30, 99, 0.25));
  box-shadow: 0 0 18px rgba(233, 30, 99, 0.18);
}

.cp-p3-polaroid::after {
  content: '♥';
  position: absolute;
  left: 50%;
  top: calc(-1 * var(--cp-thread-len, 170px) - 16px);
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: rgba(233, 30, 99, 0.45);
}

.cp-p3-polaroid.cp-p3-front {
  pointer-events: auto;
  cursor: pointer;
}

.cp-p3-polaroid:focus-visible {
  outline: 2px solid var(--cp-pink-soft);
  outline-offset: 4px;
}

.cp-pol-rot {
  display: block;
  width: 100%;
  height: 100%;
  /* Rotation is handled on the frame button */
  transform: none;
  transform-origin: center center;
}

.cp-pol-swing {
  display: block;
  width: 100%;
  height: 100%;
  animation: none;
}

.cp-p3-polaroid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  filter: saturate(1.06) contrast(1.02);
}

/* Keep title + buttons above the absolute polaroid layer */
.cp-p3-title {
  position: relative;
  z-index: 2;
}

.cp-p3-wrap #cp-p3-btn-next {
  position: relative;
  z-index: 2;
  /* Polaroid layer is absolutely positioned, so we need spacing in normal flow. */
  margin-top: 330px;
}

@keyframes cpPolSwingBtn {
  0%, 100% {
    transform: translateX(-50%) translateX(var(--cp-swing-left, -6px)) rotate(var(--cp-pol-rot, -6deg));
  }
  50% {
    transform: translateX(-50%) translateX(var(--cp-swing-right, 6px)) rotate(var(--cp-pol-rot, -6deg));
  }
}

/* Same-size polaroid stack: front-to-back z-index, alternating tilt */
.cp-pol-1 { --cp-pol-top: 150px; --cp-pol-w: 250px; --cp-pol-h: 170px; --cp-pol-rot: -8deg; --cp-thread-rot: -5deg; --cp-thread-len: 150px; --cp-swing-left: -8px; --cp-swing-right: 8px; --cp-swing-dur: 8.2s; --cp-swing-delay: 0s; --cp-z: 5; }
.cp-pol-2 { --cp-pol-top: 165px; --cp-pol-w: 250px; --cp-pol-h: 170px; --cp-pol-rot: 8deg; --cp-thread-rot: 5deg; --cp-thread-len: 165px; --cp-swing-left: -6px; --cp-swing-right: 6px; --cp-swing-dur: 7.6s; --cp-swing-delay: 0.25s; --cp-z: 4; }
.cp-pol-3 { --cp-pol-top: 180px; --cp-pol-w: 250px; --cp-pol-h: 170px; --cp-pol-rot: -8deg; --cp-thread-rot: -5deg; --cp-thread-len: 180px; --cp-swing-left: -7px; --cp-swing-right: 7px; --cp-swing-dur: 9s; --cp-swing-delay: 0.45s; --cp-z: 3; }
.cp-pol-4 { --cp-pol-top: 195px; --cp-pol-w: 250px; --cp-pol-h: 170px; --cp-pol-rot: 8deg; --cp-thread-rot: 5deg; --cp-thread-len: 195px; --cp-swing-left: -5px; --cp-swing-right: 5px; --cp-swing-dur: 7.9s; --cp-swing-delay: 0.15s; --cp-z: 2; }
.cp-pol-5 { --cp-pol-top: 210px; --cp-pol-w: 250px; --cp-pol-h: 170px; --cp-pol-rot: -8deg; --cp-thread-rot: -5deg; --cp-thread-len: 210px; --cp-swing-left: -6px; --cp-swing-right: 6px; --cp-swing-dur: 8.6s; --cp-swing-delay: 0.35s; --cp-z: 1; }

/* Fall down slowly and disappear */
.cp-p3-polaroid.cp-pol-fall {
  pointer-events: none;
  z-index: 10;
  animation: cpPolFall 1.5s ease-in forwards;
}

.cp-pol-fall .cp-pol-swing {
  animation: none !important;
}

@keyframes cpPolFall {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) rotate(var(--cp-pol-rot, -6deg));
  }
  75% {
    opacity: 0.35;
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(260px) rotate(var(--cp-pol-rot, -6deg));
  }
}

@media (max-width: 480px) {
  .cp-p3-polaroid-zone {
    height: 330px;
  }

  .cp-pol-1 { --cp-pol-w: 235px; --cp-pol-h: 160px; --cp-pol-top: 120px; --cp-thread-len: 120px; --cp-z: 5; --cp-pol-rot: -8deg; --cp-thread-rot: -5deg; }
  .cp-pol-2 { --cp-pol-w: 235px; --cp-pol-h: 160px; --cp-pol-top: 135px; --cp-thread-len: 135px; --cp-z: 4; --cp-pol-rot: 8deg; --cp-thread-rot: 5deg; }
  .cp-pol-3 { --cp-pol-w: 235px; --cp-pol-h: 160px; --cp-pol-top: 150px; --cp-thread-len: 150px; --cp-z: 3; --cp-pol-rot: -8deg; --cp-thread-rot: -5deg; }
  .cp-pol-4 { --cp-pol-w: 235px; --cp-pol-h: 160px; --cp-pol-top: 165px; --cp-thread-len: 165px; --cp-z: 2; --cp-pol-rot: 8deg; --cp-thread-rot: 5deg; }
  .cp-pol-5 { --cp-pol-w: 235px; --cp-pol-h: 160px; --cp-pol-top: 180px; --cp-thread-len: 180px; --cp-z: 1; --cp-pol-rot: -8deg; --cp-thread-rot: -5deg; }
}

/* ---- Session 4: Quiz ---- */
.cp-p4-wrap {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

/* Session 3: make decorated card taller for polaroids layer */
.cp-page-3 .cp-card.cp-p3-wrap {
  min-height: 560px;
}

/* Session 3: Next button + typewriter caption */
.cp-p3-next-hidden {
  display: none;
}

.cp-p3-next-hidden.cp-visible {
  display: inline-block;
}

.cp-p3-caption {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  margin: 0;
  width: calc(100% - 2rem);
  text-align: center;
  font-family: var(--cp-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cp-pink-soft);
  min-height: 2.2rem;
  white-space: pre-wrap;
  z-index: 5;
}

.cp-p3-caption.cp-p3-caption-hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.98);
  pointer-events: none;
}

.cp-p3-caption.cp-p3-caption-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.cp-p3-caption .cp-typewriter-caret {
  display: inline-block;
  margin-left: 2px;
  animation: cpTypewriterBlink 0.9s step-end infinite;
}

@keyframes cpTypewriterBlink {
  50% { opacity: 0; }
}

.cp-p4-title {
  font-family: var(--cp-header);
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  margin-bottom: 1rem;
  color: var(--cp-text);
}

.cp-p4-hearts {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.cp-p4-heart {
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.3s ease, transform 0.3s ease;
}

.cp-p4-heart.cp-p4-heart-filled {
  color: var(--cp-pink);
}

.cp-p4-question {
  font-family: var(--cp-serif);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--cp-text);
  min-height: 2.5rem;
}

.cp-p4-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
}

.cp-p4-option {
  padding: 0.9rem 1.25rem;
  font-family: var(--cp-serif);
  font-size: 1rem;
  text-align: left;
  border: 2px solid rgba(233, 30, 99, 0.4);
  border-radius: 12px;
  background: rgba(233, 30, 99, 0.1);
  color: var(--cp-text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.cp-p4-option:hover {
  background: rgba(233, 30, 99, 0.2);
  border-color: var(--cp-pink);
}

.cp-p4-option:focus-visible {
  outline: 2px solid var(--cp-pink-soft);
  outline-offset: 2px;
}

.cp-p4-option.cp-p4-option-locked {
  cursor: default;
  transform: none;
}

.cp-p4-option.cp-p4-option-correct {
  border-color: #35c26b;
  background: rgba(53, 194, 107, 0.2);
  color: #eafff0;
  box-shadow: 0 0 0 1px rgba(53, 194, 107, 0.45);
}

.cp-p4-option.cp-p4-option-wrong {
  border-color: #ff4f6d;
  background: rgba(255, 79, 109, 0.22);
  color: #ffeef2;
  box-shadow: 0 0 0 1px rgba(255, 79, 109, 0.45);
}

.cp-p4-feedback {
  font-family: var(--cp-serif);
  min-height: 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cp-pink-soft);
  margin-bottom: 1rem;
  transition: opacity 0.3s ease;
}

.cp-p4-feedback.cp-p4-feedback-hidden {
  opacity: 0;
}

.cp-p4-next-hidden {
  display: none;
}

.cp-p4-next-hidden.cp-visible {
  display: inline-block;
}

/* Session 2: Next appears after all 4 cards are flipped */
.cp-p2-next-hidden {
  display: none;
}

.cp-p2-next-hidden.cp-visible {
  display: inline-block;
}

.cp-p4-float-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.cp-float-heart {
  position: absolute;
  font-size: 1.75rem;
  animation: cpFloatUp 4s ease-in forwards;
  pointer-events: none;
}

@keyframes cpFloatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-100vh) scale(0.6);
  }
}

/* ---- Session 5: Play our song ---- */
.cp-p5-wrap {
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.cp-p5-title {
  font-family: var(--cp-header);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin-bottom: 0.35rem;
  color: var(--cp-text);
}

.cp-p5-sub {
  font-family: var(--cp-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--cp-pink-soft);
  margin-bottom: 1.5rem;
}

.cp-p5-visual {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cp-p5-wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  width: 220px;
  height: 90px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.cp-p5-wave-bar {
  width: 12px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd5e6, var(--cp-pink));
  opacity: 0.85;
  transform-origin: bottom center;
}

.cp-p5-wave.cp-playing .cp-p5-wave-bar {
  animation: cpWavePulse 900ms ease-in-out infinite;
}

.cp-p5-wave.cp-playing .cp-p5-wave-bar:nth-child(1) { animation-delay: 0ms; }
.cp-p5-wave.cp-playing .cp-p5-wave-bar:nth-child(2) { animation-delay: 120ms; }
.cp-p5-wave.cp-playing .cp-p5-wave-bar:nth-child(3) { animation-delay: 220ms; }
.cp-p5-wave.cp-playing .cp-p5-wave-bar:nth-child(4) { animation-delay: 80ms; }
.cp-p5-wave.cp-playing .cp-p5-wave-bar:nth-child(5) { animation-delay: 180ms; }
.cp-p5-wave.cp-playing .cp-p5-wave-bar:nth-child(6) { animation-delay: 260ms; }
.cp-p5-wave.cp-playing .cp-p5-wave-bar:nth-child(7) { animation-delay: 140ms; }

@keyframes cpWavePulse {
  0%, 100% {
    height: 18px;
    opacity: 0.8;
  }
  50% {
    height: 70px;
    opacity: 1;
  }
}

.cp-p5-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
}

.cp-p5-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(233, 30, 99, 0.5);
  background: rgba(233, 30, 99, 0.2);
  color: var(--cp-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.cp-p5-btn:hover {
  background: rgba(233, 30, 99, 0.35);
  transform: scale(1.05);
}

.cp-p5-btn .cp-p5-icon-pause,
.cp-p5-btn .cp-p5-icon-muted {
  display: none;
}

.cp-p5-btn.playing .cp-p5-icon-play {
  display: none;
}

.cp-p5-btn.playing .cp-p5-icon-pause {
  display: block;
}

.cp-p5-btn.muted .cp-p5-icon-unmuted {
  display: none;
}

.cp-p5-btn.muted .cp-p5-icon-muted {
  display: block;
}

/* ---- Session 6: Love meter ---- */
.cp-p6-wrap {
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.cp-p6-title {
  font-family: var(--cp-header);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  line-height: 1.4;
  margin-bottom: 2rem;
  color: var(--cp-text);
}

/* Floating motion for section titles */
.cp-p2-title,
.cp-p3-title,
.cp-p4-title,
.cp-p5-title,
.cp-p6-title {
  animation: cpTitleFloat 4.2s ease-in-out infinite;
}

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

.cp-p6-meter-area {
  margin-bottom: 1.5rem;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.cp-p6-meter-area.cp-p6-meter-shake {
  animation: cpP6Shake var(--cp-shake-dur, 0.16s) linear infinite;
}

@keyframes cpP6Shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(calc(var(--cp-shake-x, 1.2px) * -1)); }
  50% { transform: translateX(var(--cp-shake-x, 1.2px)); }
  75% { transform: translateX(calc(var(--cp-shake-x, 1.2px) * -0.65)); }
  100% { transform: translateX(0); }
}

.cp-p6-heart-wrap {
  position: relative;
  width: 164px;
  height: 164px;
  margin: 0 auto 1rem;
}

.cp-p6-ring {
  width: 164px;
  height: 164px;
  transform: rotate(-90deg);
}

.cp-p6-ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 8;
}

.cp-p6-ring-progress {
  fill: none;
  stroke: var(--cp-pink);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  transition: stroke-dashoffset 0.08s linear;
  filter: drop-shadow(0 0 10px rgba(233, 30, 99, 0.45));
}

.cp-p6-heart-center {
  position: absolute;
  inset: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.1rem;
  color: rgba(255, 112, 161, 0.92);
  text-shadow: 0 0 14px rgba(233, 30, 99, 0.45);
  z-index: 2;
  animation: cpP6HeartBeat 1.05s ease-in-out infinite;
}

@keyframes cpP6HeartBeat {
  0%, 100% { transform: scale(1); }
  18% { transform: scale(1.08); }
  36% { transform: scale(1.02); }
  58% { transform: scale(1.13); }
  78% { transform: scale(1.03); }
}

.cp-p6-value {
  font-family: var(--cp-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cp-pink-soft);
}

.cp-p6-value.cp-p6-value-infinity {
  font-size: 2.1rem;
  line-height: 1;
  color: var(--cp-pink);
  text-shadow: 0 0 12px rgba(233, 30, 99, 0.5);
}

.cp-p6-next-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.cp-p6-next-hidden.cp-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ---- Session 7: One last thing ---- */
.cp-p7-wrap {
  text-align: center;
}

/* ---- Session 8: Letter + Lottie (letter panel fits inside the decorated card) ---- */
.cp-p8-wrap {
  position: relative;
  max-width: 520px;
  width: 100%;
  padding: 2rem 1rem;
  min-height: 280px;
}

.cp-p8-envelope-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cp-p8-envelope {
  position: relative;
  width: 320px;
  max-width: 100%;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.cp-p8-envelope:hover {
  filter: brightness(1.08);
}

.cp-page-8 .cp-p8-envelope {
  animation: cpP8EnvelopeFloat 3.2s ease-in-out infinite;
}

.cp-page-8 .cp-p8-envelope.cp-p8-envelope-opened {
  animation: none;
}

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

.cp-p8-love-lottie {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
}

.cp-p8-tap-hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--cp-serif);
}

.cp-p8-letter {
  position: absolute;
  inset: 0.75rem;
  z-index: 5;
  margin: 0;
  background: linear-gradient(145deg, #fdf8f5 0%, #fce4ec 50%, #f8b4d0 100%);
  color: #2c2224;
  border-radius: 20px;
  padding: 2.25rem 1.15rem 1.75rem;
  overflow: hidden auto;
  box-shadow: inset 0 0 0 1px rgba(233, 30, 99, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 0;
}

.cp-p8-letter.cp-p8-letter-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

.cp-p8-letter-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(194, 24, 91, 0.12);
  font-size: 1.5rem;
  color: var(--cp-red);
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-p8-letter-close:hover {
  background: rgba(233, 30, 99, 0.22);
}

.cp-p8-letter-content {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--cp-serif);
  font-size: 1.1rem;
  line-height: 1.7;
}

.cp-p8-letter-content p {
  margin: 0 0 1rem;
}

.cp-p8-letter-content p:last-child {
  margin-bottom: 0;
}

.cp-p8-greeting {
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--cp-red);
  margin-bottom: 1rem;
}

.cp-p8-signature {
  margin-top: 1.5rem;
  font-style: italic;
  color: var(--cp-red);
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .cp-card {
    padding: 1.5rem 1.25rem;
    border-radius: 20px;
  }

  .cp-flip-list {
    grid-template-columns: 1fr;
  }

  .cp-p3-scrapbook {
    grid-template-columns: 1fr 1fr;
  }

  .cp-scrap-3 { grid-column: 1; }
  .cp-scrap-5 { grid-column: 1; }
}

@media (max-width: 360px) {
  .cp-page {
    padding: 1rem;
  }

  .cp-card {
    padding: 1.25rem 1rem;
    border-radius: 16px;
  }

  .cp-card::before,
  .cp-card::after {
    font-size: 0.75rem;
    top: 10px;
  }

  .cp-p1-greeting {
    font-size: 1.35rem;
  }
}
