/* ============================================
   Valentine's Day Website - Styles
   ============================================ */

:root {
  --rose-deep: #c41e3a;
  --rose-soft: #e84a6f;
  --pink-light: #f8b4c4;
  --pink-pale: #fce4ec;
  --cream: #fff5f7;
  --dark: #2d1b2e;
  --gold: #ffd700;
  --shadow: rgba(45, 27, 46, 0.2);
  --font-display: 'Dancing Script', cursive;
  --font-body: 'Poppins', sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

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

html {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: #faf5f3;
  color: var(--dark);
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#bg-music {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.music-toggle {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 160;
  border: none;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--dark);
  font-family: var(--font-body);
  font-weight: 600;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(248, 180, 196, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  user-select: none;
  display: none; /* Hidden as requested */
}

.music-toggle:hover {
  transform: translateX(-50%) scale(1.03);
  background: rgba(255, 255, 255, 0.98);
}

.music-toggle:active {
  transform: translateX(-50%) scale(0.98);
}

.music-toggle.hidden {
  opacity: 0;
  pointer-events: none;
}

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

.heart-float-wrapper {
  position: absolute;
  top: -10%;
  opacity: 0.4;
  animation: float-heart 20s linear infinite;
  pointer-events: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image elements */
.heart-float-wrapper img.heart-float {
  width: 60px;
  height: 60px;
  object-fit: contain;
  display: none; /* Hidden by default, shown when loaded */
  max-width: 100%;
  max-height: 100%;
}

.heart-float-wrapper .heart-float-emoji {
  font-size: 2rem;
  display: inline-block;
  line-height: 1;
}

.heart-float-wrapper:nth-child(odd) {
  animation-duration: 25s;
  animation-direction: reverse;
  opacity: 0.35;
}

.heart-float-wrapper:nth-child(odd) img.heart-float {
  width: 55px;
  height: 55px;
}

.heart-float-wrapper:nth-child(3n) {
  animation-duration: 18s;
  opacity: 0.3;
}

.heart-float-wrapper:nth-child(3n) img.heart-float {
  width: 50px;
  height: 50px;
}

.heart-float-wrapper:nth-child(4n) {
  opacity: 0.45;
}

.heart-float-wrapper:nth-child(4n) img.heart-float {
  width: 70px;
  height: 70px;
}

@keyframes float-heart {
  0% {
    transform: translateY(0) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 0.4;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(110vh) rotate(360deg) scale(1.2);
  opacity: 0;
  }
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----- Pages ----- */
.page {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity 0.28s ease-out, visibility 0.28s ease-out, transform 0.28s ease-out;
}

.page.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

.content {
  text-align: center;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  animation: fadeInUp 0.8s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

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

.heart-icon {
  margin-bottom: 1.5rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.heart-icon .loader {
  transform: scale(1) rotate(45deg);
}

/* Animated heart loader (CSS heart shape) */
.loader {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
  transform: rotate(45deg);
  transform-origin: 40px 40px;
}

.loader div {
  top: 32px;
  left: 32px;
  position: absolute;
  width: 32px;
  height: 32px;
  background: var(--rose-deep);
  animation: loader45 1.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.loader div:after,
.loader div:before {
  content: " ";
  position: absolute;
  display: block;
  width: 32px;
  height: 32px;
  background: var(--rose-deep);
}

.loader div:before {
  left: -24px;
  border-radius: 50% 0 0 50%;
}

.loader div:after {
  top: -24px;
  border-radius: 50% 50% 0 0;
}

@keyframes loader45 {
  0% {
    transform: scale(0.95);
  }
  5% {
    transform: scale(1.1);
  }
  39% {
    transform: scale(0.85);
  }
  45% {
    transform: scale(1);
  }
  60% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(0.9);
  }
}

.question-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  color: var(--rose-deep);
  margin-bottom: 3rem;
  text-shadow: 0 2px 20px rgba(196, 30, 58, 0.3);
  line-height: 1.2;
}

.button-container {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.valentine-btn {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--shadow);
  position: relative;
  overflow: hidden;
}

.yes-btn {
  background: linear-gradient(135deg, var(--rose-deep), var(--rose-soft));
  color: white;
  min-width: 150px;
}

.yes-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 30px rgba(196, 30, 58, 0.4);
}

.yes-btn:active {
  transform: translateY(-1px) scale(1.02);
}

.no-btn {
  background: white;
  color: var(--dark);
  border: 2px solid var(--pink-light);
  min-width: 150px;
  z-index: 10;
  pointer-events: auto;
}

.no-btn:hover {
  background: var(--pink-pale);
  cursor: not-allowed;
}

.button-container {
  position: relative;
  min-height: 80px;
}

.no-btn.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-10px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(10px);
  }
}

/* Make No button unclickable when shaking */
.no-btn.shake {
  pointer-events: none;
  cursor: not-allowed;
}

#celebration-page {
  background: linear-gradient(135deg, #ff6b9d 0%, #c41e3a 50%, #ff6b9d 100%);
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  position: relative;
  overflow: hidden;
}

.yes-media-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.yes-media-background {
  background-color: #ff6b9d;
}

.yes-background-item {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 2s ease-in-out;
  z-index: 0;
}

.yes-background-item.active {
  opacity: 1;
  z-index: 1;
}

#celebration-page .content {
  position: relative;
  z-index: 2;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
}
  50% {
    background-position: 100% 50%;
  }
}

.celebration-heart {
  margin-bottom: 2rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.celebration-heart .loader {
  transform: scale(1.2) rotate(45deg);
  filter: drop-shadow(0 4px 20px rgba(196, 30, 58, 0.4));
}

.celebration-heart .loader div,
.celebration-heart .loader div:before,
.celebration-heart .loader div:after {
  background: var(--rose-soft);
}

.celebration-text-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
}


.celebration-text {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 700;
  color: white;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.8s ease-out, rainbow 3s ease-in-out infinite;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transform-origin: center;
  position: relative;
  left: 0;
  right: 0;
  margin: 0;
}

@keyframes scaleIn {
  from {
    transform: scale(0.5) translateX(0);
    opacity: 0;
  }
  to {
    transform: scale(1) translateX(0);
    opacity: 1;
  }
}

@keyframes rainbow {
  0%, 100% {
    text-shadow: 0 4px 30px rgba(255, 255, 255, 0.5);
  }
  25% {
    text-shadow: 0 4px 30px rgba(255, 215, 0, 0.5);
  }
  50% {
    text-shadow: 0 4px 30px rgba(255, 192, 203, 0.5);
}
  75% {
    text-shadow: 0 4px 30px rgba(255, 20, 147, 0.5);
  }
}


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
}
  to {
    opacity: 0.95;
    transform: translateY(0);
  }
}

/* ----- Confetti ----- */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--gold);
  animation: confettiFall 3s linear forwards;
}

.confetti:nth-child(2n) {
  background: var(--rose-soft);
}

.confetti:nth-child(3n) {
  background: var(--pink-light);
}

.confetti:nth-child(4n) {
  background: white;
}

.confetti:nth-child(5n) {
  background: var(--rose-deep);
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.no-popup {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.no-popup.active {
  display: flex;
  opacity: 1;
}

.no-popup-content {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: popupAppear 0.4s ease-out;
}

@keyframes popupAppear {
  from {
    transform: scale(0.8);
  opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.no-popup-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--pink-pale);
  color: var(--dark);
  font-size: 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
}

.no-popup-close:hover {
  background: var(--pink-light);
  transform: scale(1.1);
}

.no-popup-scene {
  position: relative;
  width: 100%;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 15px;
  overflow: hidden;
}

.dog-horse-image {
  width: 100%;
  height: 100%;
  min-height: 400px;
  object-fit: cover;
  display: block;
  z-index: 2;
}

.bat-container {
  position: absolute;
  top: 20%;
  right: 90%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: right 0.5s ease-out;
}

.bat {
  font-size: 3rem;
  animation: batFlap 0.3s ease-in-out infinite;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes batFlap {
  0%, 100% {
    transform: rotate(-5deg);
}
  50% {
    transform: rotate(5deg);
  }
}

.bat-text {
  background: rgba(255, 255, 255, 0.95);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  border: 2px solid var(--rose-soft);
}

.bat-container.bat-close .bat {
  animation: batFlap 0.15s ease-in-out infinite, batShake 0.3s ease-in-out infinite;
}

.bat-container.bat-close .bat-text {
  animation: textPulse 0.5s ease-in-out infinite;
  background: rgba(255, 200, 200, 0.95);
  border-color: var(--rose-deep);
}

@keyframes batShake {
  0%, 100% {
    transform: translateX(0) rotate(-5deg);
  }
  25% {
    transform: translateX(-3px) rotate(5deg);
  }
  75% {
    transform: translateX(3px) rotate(-5deg);
  }
}

@keyframes textPulse {
  0%, 100% {
    transform: scale(1);
}
  50% {
    transform: scale(1.05);
  }
}

@media (max-width: 768px) {
  .question-title {
    font-size: clamp(2rem, 10vw, 3rem);
    margin-bottom: 2rem;
  }

  .celebration-text-wrapper {
    width: 100%;
  overflow: hidden;
  }
  
  .celebration-text {
    font-size: clamp(2rem, 12vw, 3.5rem);
    white-space: normal;
  }

  .button-container {
    flex-direction: column;
    align-items: center;
}

  .valentine-btn {
  width: 100%;
    max-width: 250px;
  }

  .heart-icon .loader {
    transform: scale(0.9) rotate(45deg);
  }

  .celebration-heart .loader {
    transform: scale(1.1) rotate(45deg);
  }

  .music-toggle {
    bottom: 0.75rem;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 1rem;
}

  .question-title {
    font-size: 2rem;
}

  .celebration-text {
    font-size: 2rem;
}

  .valentine-btn {
  font-size: 1.1rem;
    padding: 0.875rem 2rem;
}

  .no-popup-content {
    padding: 1.5rem;
    margin: 1rem;
}

  .no-popup-scene {
    min-height: 300px;
  }
  
  .dog-horse-image {
    max-height: 300px;
  }
  
  .bat {
    font-size: 2rem;
}

  .bat-text {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
}

.gallery-header {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  width: 100%;
  padding: 0 2rem;
}

.gallery-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--rose-deep);
  margin-bottom: 1rem;
  text-shadow: 0 2px 20px rgba(196, 30, 58, 0.3);
}

.back-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem 1.5rem;
  border: 2px solid var(--pink-light);
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--dark);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  background: white;
  border-color: var(--rose-soft);
  transform: translateX(-3px);
}

.flipbook-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  min-height: 400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.flipbook-viewer {
  position: relative;
  width: 100%;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
}

.flipbook-page {
  position: absolute;
  width: auto;
  max-width: 90%;
  height: auto;
  opacity: 0;
  transform: rotateY(90deg) scale(0.8);
  transition: all 0.6s cubic-bezier(0.33, 1, 0.68, 1);
  pointer-events: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.flipbook-page.active {
  opacity: 1;
  transform: rotateY(0deg) scale(1);
  pointer-events: auto;
  z-index: 2;
  position: relative;
}

.flipbook-image-container {
  position: relative;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flipbook-page img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.flipbook-message {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: white;
  padding: 2rem 1.5rem 1.5rem;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  line-height: 1.6;
  text-align: center;
  z-index: 3;
  min-height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.flipbook-message::after {
  content: '|';
  animation: blink 1s infinite;
  margin-left: 2px;
  color: var(--pink-light);
}

.flipbook-message.complete::after {
  display: none;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

.image-fallback {
  font-size: 5rem;
  color: var(--pink-light);
}

.flipbook-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--rose-deep);
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.flipbook-nav:hover:not(:disabled) {
  background: white;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 30px rgba(196, 30, 58, 0.3);
}

.flipbook-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.flipbook-prev {
  left: 1rem;
}

.flipbook-next {
  right: 1rem;
}

.gallery-counter {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--dark);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.5rem 1.5rem;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#current-image {
  color: var(--rose-deep);
  font-weight: 700;
  font-size: 1.3rem;
}

@media (max-width: 768px) {
  .flipbook-container {
    height: 60vh;
    padding: 1rem;
  }
  
  .gallery-title {
    font-size: 1.5rem;
  }
  
  .flipbook-nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
}

  .flipbook-prev {
    left: 0.5rem;
  }
  
  .flipbook-next {
    right: 0.5rem;
  }
}

/* ----- Gallery Navigation Buttons ----- */
.gallery-nav-buttons {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  z-index: 10;
}

.random-memory-popup {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.random-memory-popup.active {
  opacity: 1;
}

.random-memory-content {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: popupAppear 0.4s ease-out;
}

.random-memory-content img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.random-memory-message {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--dark);
}

.random-memory-message .memory-text {
  font-style: italic;
  margin-top: 0.5rem;
  color: var(--rose-deep);
}

.random-memory-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--pink-pale);
  color: var(--dark);
  font-size: 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.random-memory-close:hover {
  background: var(--pink-light);
}

#reasons-page {
  background: linear-gradient(180deg, #fff9fb 0%, #fef5f7 100%);
}

.reasons-content {
  max-width: 560px;
  width: 100%;
  padding: 1.25rem 1.5rem 1.5rem;
}

/* ----- Why I Love You: flower (pick a petal) ----- */
#reasons-page .section-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: #5c3a42;
}

.reasons-flower-hint {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: #8b6b72;
  font-weight: 500;
  margin: 0 0 0.75rem;
}

.reasons-flower-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0 1.25rem;
  min-height: 380px;
  width: 100%;
}

.reasons-flower-glow {
  position: absolute;
  inset: -40px;
  background: radial-gradient(ellipse at center, rgba(248, 180, 196, 0.25) 0%, rgba(232, 74, 111, 0.08) 40%, transparent 70%);
  pointer-events: none;
}

.reasons-center-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease-in-out, visibility 0.35s ease-in-out;
}
.reasons-center-backdrop.reasons-center-backdrop-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.reasons-flower-wrap.reasons-flower-wrap-active {
  position: relative;
  z-index: 101;
}
.reasons-flower {
  position: relative;
  width: 380px;
  height: 380px;
  margin: 0 auto;
  animation: flowerFloat 8s ease-in-out infinite;
}

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

.flower-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4b8, #e8b923 40%, #c99a0f 100%);
  box-shadow: inset 0 -3px 10px rgba(0,0,0,0.15), 0 3px 12px rgba(0,0,0,0.2);
  z-index: 10;
  pointer-events: none;
  transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.flower-center.flower-center-clickable {
  pointer-events: auto;
  cursor: pointer;
  animation: flowerCenterGrowPulse 2.5s ease-in-out infinite;
}

.flower-center.flower-center-clickable:hover {
  animation: flowerCenterGrowPulse 2s ease-in-out infinite;
}

@keyframes flowerCenterGrowPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: inset 0 -3px 10px rgba(0,0,0,0.15), 0 3px 12px rgba(0,0,0,0.2), 0 0 18px rgba(232, 185, 35, 0.4);
  }
  50% {
    transform: scale(1.12);
    box-shadow: inset 0 -3px 10px rgba(0,0,0,0.15), 0 0 24px rgba(232, 185, 35, 0.55), 0 0 36px rgba(232, 185, 35, 0.35), 0 4px 14px rgba(0,0,0,0.2);
  }
}

.flower-petals {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.flower-petal {
  position: absolute;
  left: 50%;
  top: calc(50% - 108px);
  width: 38px;
  height: 108px;
  margin: 0 0 0 -19px;
  border: none;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: linear-gradient(180deg, #ffc8d6 0%, #f5a0b5 25%, #e86a82 60%, #d44d68 100%);
  cursor: pointer;
  transform-origin: 50% 100%;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.28s ease-in-out, opacity 0.3s ease-in-out, filter 0.28s ease-in-out, box-shadow 0.28s ease-in-out;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.flower-petal:hover:not(.petal-picked):not(.petal-pop) {
  filter: brightness(1.08);
  transform: rotate(calc(var(--rot, 0deg) + 3deg)) scale(1.08);
  box-shadow: 0 6px 20px rgba(232, 74, 111, 0.25);
}

.flower-petal:focus {
  outline: 2px solid var(--rose-deep);
  outline-offset: 2px;
}

.flower-petal.petal-pop {
  animation: petalPop 0.4s ease-out forwards;
}

@keyframes petalPop {
  0% { transform: rotate(var(--rot, 0deg)) scale(1.1); }
  40% { transform: rotate(var(--rot, 0deg)) scale(1.25); }
  70% { transform: rotate(var(--rot, 0deg)) scale(0.95); }
  100% { transform: rotate(var(--rot, 0deg)) scale(1); }
}

.flower-petal.petal-picked {
  opacity: 0;
  pointer-events: none;
  transform: rotate(var(--rot, 0deg)) scale(0.3) translateY(-50px);
  transition: transform 0.35s ease-in-out, opacity 0.35s ease-in-out;
}

.reasons-sparkle-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.reasons-sparkle {
  position: absolute;
  font-size: 1.1rem;
  left: 0;
  top: 0;
  opacity: 0;
  animation: sparkleFloat 1.2s ease-out forwards;
  color: rgba(232, 74, 111, 0.85);
}

@keyframes sparkleFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) translateY(-40px);
  }
}

.reasons-message {
  min-height: 3rem;
  margin: 1rem 0 0.75rem;
  padding: 1.25rem 1.75rem;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: 1.65;
  letter-spacing: 0.02em;
  color: #5c3a42;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease-in-out, transform 0.35s ease-in-out;
}

.reasons-message.reasons-message-visible {
  opacity: 1;
  transform: translateY(0);
}

.reasons-message.reasons-message-visible:not(:empty) {
  background: #fffbfc;
  border: 1px solid rgba(248, 180, 196, 0.6);
  border-radius: 16px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem 2rem;
  box-shadow: 0 8px 32px rgba(196, 30, 58, 0.08);
}

.reasons-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.75rem;
}

/* ----- Inside Jokes Page ----- */
#jokes-page {
  background: linear-gradient(180deg, #fff9fb 0%, #fef5f7 50%, #fdf2f5 100%);
}

#jokes-page .content {
  max-width: 920px;
  width: 100%;
  padding: 1.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#jokes-page .section-title {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark);
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.jokes-intro {
  text-align: center;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  color: var(--dark);
  letter-spacing: 0.01em;
  line-height: 1.4;
  margin: 0.5rem 0 2rem;
}

.jokes-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin: 0 auto 2rem;
  width: 100%;
  max-width: 900px;
}

.joke-card {
  flex: 1 1 200px;
  max-width: calc((100% - 2 * 1.5rem) / 3);
  min-width: 200px;
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--dark);
  border: 1px solid rgba(196, 30, 58, 0.2);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: transform 0.25s ease-in-out, border-color 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
  opacity: 0;
  animation: jokeCardFadeIn 0.5s ease-out forwards;
}

.joke-card:nth-child(1) { animation-delay: 0ms; }
.joke-card:nth-child(2) { animation-delay: 50ms; }
.joke-card:nth-child(3) { animation-delay: 100ms; }
.joke-card:nth-child(4) { animation-delay: 150ms; }
.joke-card:nth-child(5) { animation-delay: 200ms; }
.joke-card:nth-child(6) { animation-delay: 250ms; }
.joke-card:nth-child(7) { animation-delay: 300ms; }
.joke-card:nth-child(8) { animation-delay: 350ms; }
.joke-card:nth-child(n+9) { animation-delay: 400ms; }

@keyframes jokeCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.joke-card:hover {
  transform: scale(1.03);
  border-color: var(--rose-soft);
  box-shadow: 0 8px 28px rgba(196, 30, 58, 0.14);
}

.joke-card-has-image {
  cursor: pointer;
}

.joke-card:focus {
  outline: 2px solid var(--rose-deep);
  outline-offset: 2px;
}

@media (min-width: 601px) and (max-width: 900px) {
  .joke-card {
    max-width: calc((100% - 1.5rem) / 2);
  }
}

@media (max-width: 600px) {
  #jokes-page .content {
    padding: 1.25rem 1rem 1.5rem;
  }
  #jokes-page .section-title {
    font-size: 1.2rem;
  }
  .jokes-container {
    gap: 1.5rem;
    margin: 0 auto 1.5rem;
    max-width: 100%;
  }
  .joke-card {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
    padding: 1.5rem;
  }
}

#jokes-page .back-btn {
  margin-top: 1.5rem;
}

.joke-image-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
}

.joke-image-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.joke-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(92, 58, 66, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateZ(0);
}

.joke-image-modal-content {
  position: relative;
  max-width: min(92vw, 640px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fffbfc;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 24px 64px rgba(92, 58, 66, 0.2);
  transform: scale(0.94);
  opacity: 0;
  transition: transform 0.28s ease-in-out, opacity 0.28s ease-in-out;
}

.joke-image-modal.active .joke-image-modal-content {
  transform: scale(1);
  opacity: 1;
}

.joke-image-modal.closing .joke-image-modal-content {
  transform: scale(0.94);
  opacity: 0;
}

.joke-image-modal-img {
  max-width: 100%;
  max-height: 65vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.joke-image-modal-combo {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.joke-image-modal-video-wrap {
  flex: 0 1 auto;
  max-width: min(380px, 48vw);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.joke-image-modal-iframe-container {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
}

.joke-image-modal-video {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  object-fit: contain;
}

.joke-image-modal-iframe {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 14px;
}

.joke-image-modal-watch-link {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: #6b4a52;
  background: rgba(248, 180, 196, 0.4);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease-in-out;
}

.joke-image-modal-watch-link:hover {
  background: rgba(248, 180, 196, 0.6);
}

.joke-image-modal-combo-img {
  width: min(260px, 40vw);
  height: auto;
  max-height: min(340px, 52vh);
  object-fit: contain;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

@media (max-width: 700px) {
  .joke-image-modal {
    padding: 1rem;
  }
  .joke-image-modal-content {
    padding: 1.5rem;
    max-width: 96vw;
  }
  .joke-image-modal-img {
    max-height: 58vh;
  }
  .joke-image-modal-combo {
    flex-direction: column;
    gap: 1rem;
  }
  .joke-image-modal-video-wrap {
    max-width: min(320px, 92vw);
  }
  .joke-image-modal-combo-img {
    width: min(260px, 90vw);
    max-height: min(300px, 45vh);
  }
}

.joke-image-modal-caption {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  color: #6b4a52;
  text-align: center;
  margin: 1.25rem 0 0;
  padding: 0 0.5rem;
  max-width: 100%;
  line-height: 1.5;
  display: none;
}

.joke-image-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #6b4a52;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s ease-in-out, transform 0.2s ease-in-out;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.joke-image-modal-close:hover {
  background: #fff0f4;
  transform: scale(1.08);
}

.joke-image-modal-close:active {
  transform: scale(0.95);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#letter-page .content {
  padding: 1rem 2rem;
}

.letter-container {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

#letter-page .section-title {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.letter-content {
  position: relative;
  background: #faf6f0;
  padding: 1.75rem 2rem 2rem 2.25rem;
  border-radius: 2px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(180, 160, 140, 0.3);
  color: #2c2520;
  margin-top: 0.75rem;
  animation: fadeInUp 0.8s ease-out;
}

.letter-content::before {
  content: '';
  position: absolute;
  left: 0.6rem;
  top: 1.25rem;
  bottom: 1.25rem;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--rose-soft) 10%, var(--rose-soft) 90%, transparent);
  opacity: 0.4;
  border-radius: 1px;
}

.letter-greeting {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--rose-deep);
  margin-bottom: 0.25rem;
}

.letter-hello {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--rose-deep);
  margin-bottom: 1rem;
}

.letter-body {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.85;
  letter-spacing: 0.01em;
  margin-bottom: 0.85rem;
  color: #2c2520;
}

.letter-closing {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  font-style: italic;
  color: #2c2520;
  margin-top: 1.25rem;
  text-align: center;
}

#letter-page .reasons-nav,
#letter-page .back-btn {
  margin-top: 1rem;
}

/* ----- Hub Page (simple, like example) ----- */
#hub-page {
  background: linear-gradient(180deg, #fdf8f6 0%, #faf5f3 50%, #f9f2f0 100%);
}

.hub-content {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1rem 0;
}

.hub-title {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #8b4a52;
  text-align: center;
  margin: 0 0 1rem;
}

.hub-intro {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--dark);
  margin: 0 0 3rem;
  opacity: 0.72;
}

.hub-buttons {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.35rem;
  width: 100%;
  margin: 0 auto 1.5rem;
}

.hub-buttons::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(232, 74, 111, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hub-btn {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 182px;
  padding: 2rem 1.75rem;
  border: 1px solid rgba(248, 180, 196, 0.7);
  border-radius: 20px;
  background: #fff8fa;
  cursor: pointer;
  overflow: visible;
  box-shadow: 0 4px 16px rgba(196, 30, 58, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hub-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.6rem;
  color: rgba(139, 107, 114, 0.55);
}

.hub-btn-icon svg {
  width: 22px;
  height: 22px;
}

#hub-page.active .hub-btn {
  animation: hubCardFadeIn 0.3s ease-out forwards;
}

#hub-page.active .hub-btn:nth-child(1) { animation-delay: 0ms; }
#hub-page.active .hub-btn:nth-child(2) { animation-delay: 60ms; }
#hub-page.active .hub-btn:nth-child(3) { animation-delay: 120ms; }
#hub-page.active .hub-btn:nth-child(4) { animation-delay: 180ms; }

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

.hub-btn:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 28px rgba(196, 30, 58, 0.1);
}

.hub-btn:focus {
  outline: 2px solid var(--rose-deep);
  outline-offset: 2px;
}

.hub-btn-title {
  font-family: var(--font-serif);
  font-size: 1.52rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #5c3a42;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.hub-btn-subtext {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: #8b6b72;
  opacity: 0.88;
  letter-spacing: 0.01em;
}

.hub-gallery-btn {
  position: relative;
  display: none;
  min-height: 182px;
  padding: 2rem 1.75rem;
  border: 1px solid rgba(248, 180, 196, 0.7);
  border-radius: 20px;
  background: #fff8fa;
  cursor: pointer;
  overflow: visible;
  box-shadow: 0 4px 16px rgba(196, 30, 58, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hub-gallery-btn:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 28px rgba(196, 30, 58, 0.1);
}

.hub-gallery-btn.hub-gallery-btn-visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ----- Mystery box (only appears when all three sections opened) ----- */
.mystery-box-backdrop {
  position: fixed;
  inset: 0;
  z-index: 275;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.mystery-box-backdrop.mystery-box-backdrop-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto; /* block all buttons/links behind – only the mystery box (above) is clickable */
}

.mystery-box {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 280;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--rose-deep);
  background: white;
  color: var(--rose-deep);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.3);
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.mystery-box.mystery-box-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mystery-box.mystery-box-pop {
  animation: mysteryBoxPop 0.5s ease-out forwards;
}

.mystery-box.mystery-box-unlocked {
  bottom: auto;
  right: auto;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%) scale(1);
  box-shadow: 0 8px 32px rgba(196, 30, 58, 0.25);
  animation: mysteryBoxPopCenter 0.5s ease-out forwards, mysteryBoxHeartbeat 1.4s ease-in-out 0.5s infinite;
}

@keyframes mysteryBoxPop {
  0% { transform: scale(0.3); }
  100% { transform: scale(1); }
}

@keyframes mysteryBoxPopCenter {
  0% { transform: translate(-50%, -50%) scale(0.3); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes mysteryBoxHeartbeat {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  14%, 86% { transform: translate(-50%, -50%) scale(1.1); }
  28%, 72% { transform: translate(-50%, -50%) scale(1.02); }
  42%, 58% { transform: translate(-50%, -50%) scale(1.06); }
}

.mystery-box:hover {
  background: var(--pink-pale);
  box-shadow: 0 6px 20px rgba(196, 30, 58, 0.15);
}

.mystery-box.mystery-box-unlocked:hover {
  animation: mysteryBoxPopCenter 0.5s ease-out forwards, mysteryBoxHeartbeat 1.4s ease-in-out 0.5s infinite;
}

.mystery-box-icon {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  font-family: var(--font-body);
}

.mystery-box.mystery-box-unlocked .mystery-box-icon {
  font-size: 1.75rem;
}

.mystery-box-label {
  display: none;
}

#open-when-page {
  background: linear-gradient(180deg, #fff9fb 0%, #fef5f7 50%, #fdf2f5 100%);
}

#open-when-page .content {
  max-width: 920px;
  padding: 1.5rem 2rem 2rem;
}

#open-when-page .back-btn {
  margin-top: 1.5rem;
}

#open-when-page .section-title {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark);
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.open-when-intro {
  text-align: center;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  color: var(--dark);
  letter-spacing: 0.01em;
  line-height: 1.4;
  margin: 0.5rem 0 1.25rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.open-when-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  max-width: 900px;
  width: 100%;
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
}

.open-when-envelope {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 200px;
  max-width: calc((100% - 2 * 1.5rem) / 3);
  min-width: 200px;
  min-height: 100px;
  padding: 1.5rem;
  background: white;
  border: 1px solid rgba(196, 30, 58, 0.2);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.25s ease-in-out, border-color 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
  font-family: var(--font-body);
  text-align: center;
  overflow: hidden;
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
}

.open-when-envelope:hover {
  transform: scale(1.03);
  border-color: var(--rose-soft);
  box-shadow: 0 8px 28px rgba(196, 30, 58, 0.14);
}

.open-when-envelope:focus {
  outline: 2px solid var(--rose-deep);
  outline-offset: 2px;
}

.open-when-envelope-flap {
  display: none;
}

.open-when-envelope-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  letter-spacing: 0.01em;
  line-height: 1.35;
}

@media (min-width: 601px) and (max-width: 900px) {
  .open-when-envelope {
    max-width: calc((100% - 1.5rem) / 2);
  }
}

.letter-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.letter-modal.active {
  opacity: 1;
  visibility: visible;
}

.letter-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.letter-modal-paper {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: #faf6f0;
  padding: 2.5rem 2.25rem 3rem 2.75rem;
  border-radius: 2px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 6px 16px rgba(0, 0, 0, 0.12),
    0 20px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(180, 160, 140, 0.4);
  font-family: var(--font-display);
  animation: popupAppear 0.35s ease-out;
}

.letter-modal-paper::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 1.5rem;
  bottom: 1.5rem;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--rose-soft) 10%, var(--rose-soft) 90%, transparent);
  opacity: 0.5;
  border-radius: 1px;
}

.letter-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(248, 180, 196, 0.4);
  color: var(--dark);
  font-size: 1.35rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.letter-modal-close:hover {
  background: var(--pink-light);
  color: var(--rose-deep);
}

.letter-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--rose-deep);
  margin-bottom: 1.25rem;
  padding-right: 2.25rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-body);
  border-bottom: 1px solid rgba(196, 30, 58, 0.2);
  padding-bottom: 0.5rem;
}

.letter-modal-body {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.85;
  letter-spacing: 0.01em;
  color: #2c2520;
  white-space: pre-line;
}

.flower-audio-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.flower-audio-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.flower-audio-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.flower-audio-modal-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flower-audio-play-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--rose-deep), var(--rose-soft));
  color: white;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(196, 30, 58, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flower-audio-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(196, 30, 58, 0.5);
}

.flower-audio-play-btn:active {
  transform: scale(0.98);
}

.hidden-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem 3rem;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--rose-deep);
  text-align: center;
  z-index: 400;
  opacity: 0;
  transition: all 0.3s ease;
  border: 3px solid var(--pink-light);
  backdrop-filter: blur(10px);
}

.hidden-message.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.hidden-message.hidden-message-reasons {
  font-family: system-ui, -apple-system, sans-serif;
  color: #000;
  font-weight: bold;
  font-size: 1.35rem;
  line-height: 1.5;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .reasons-content {
    padding: 1rem 1rem 1.25rem;
  }
  .reasons-flower-wrap {
    min-height: 320px;
    margin: 0.75rem 0 1rem;
  }

  .reasons-flower {
    width: 320px;
    height: 320px;
  }

  .flower-center {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
  }

  .flower-petal {
    width: 32px;
    height: 90px;
    top: calc(50% - 90px);
    margin: 0 0 0 -16px;
    transform: rotate(var(--rot, 0deg));
  }

  .flower-petal:hover:not(.petal-picked):not(.petal-pop) {
    transform: rotate(calc(var(--rot, 0deg) + 3deg)) scale(1.08);
  }

  .flower-petal.petal-picked {
    transform: rotate(var(--rot, 0deg)) scale(0.3) translateY(-50px);
  }

  .reasons-message.reasons-message-visible:not(:empty) {
    padding: 1.25rem 1.5rem;
    max-width: 100%;
  }

  .reasons-message {
    font-size: 1.1rem;
  }

  .reasons-nav {
    margin-top: 1.5rem;
  }


  #open-when-page .section-title {
    font-size: 1.2rem;
  }

  .open-when-intro {
    margin: 0.5rem 0 1rem;
  }

  .open-when-grid {
    gap: 1.5rem;
    margin: 0 auto 1.25rem;
  }

  .open-when-envelope {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
    padding: 1.5rem;
  }

  .hub-buttons {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .mystery-box {
    width: 48px;
    height: 48px;
    bottom: 1rem;
    right: 1rem;
  }

  .mystery-box-icon {
    font-size: 1.25rem;
  }

  .letter-modal-paper {
    padding: 2rem 1.5rem 2.5rem;
  }
  
  .gallery-nav-buttons {
    flex-direction: column;
    bottom: 4rem;
  }

  .letter-content {
    padding: 1.25rem 1.5rem 1.5rem 1.75rem;
  }
  .letter-body {
    font-size: 1rem;
    line-height: 1.8;
  }

  .reasons-nav {
    flex-direction: column;
    align-items: center;
  }
}
