/**
 * ============================================================================
 * EXTRAS & SURPRISES STYLESHEET (extras.css)
 * ============================================================================
 * Premium romantic gold-gradient aesthetic (#f0db4a -> #f7b733 -> #ff6f61)
 * Tailored exclusively for Debasmita (Bilei)'s birthday palace upgrade.
 *
 * Rules:
 * - Standalone styles with zero impact on existing components.
 * - Hardware-accelerated CSS (transform & opacity only).
 * - Fully responsive (375px, 768px, 1024px, 1440px).
 * - Comprehensive prefers-reduced-motion fallbacks.
 * ============================================================================
 */

/* ----------------------------------------------------------------------------
 * 1. SECTION WRAPPER & LITTLE SURPRISES HUB (HOME)
 * ---------------------------------------------------------------------------- */
.extras-section {
  padding: 80px 0;
  position: relative;
  z-index: 2;
}

.extras-section.alternate-bg {
  background: linear-gradient(180deg, rgba(255, 247, 220, 0.45) 0%, rgba(255, 250, 240, 0.8) 100%);
}

.surprises-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 40px;
}

.surprise-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(240, 219, 74, 0.45);
  border-radius: 24px;
  padding: 34px 28px;
  text-decoration: none !important;
  color: var(--color-text-main, #3a2e1f) !important;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.35s ease;
  box-shadow: 0 10px 30px rgba(247, 183, 51, 0.08);
}

.surprise-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f0db4a, #f7b733, #ff6f61);
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.surprise-card:hover,
.surprise-card:focus-visible {
  transform: translateY(-8px);
  box-shadow: 0 20px 45px rgba(240, 219, 74, 0.22);
  border-color: rgba(247, 183, 51, 0.8);
}

.surprise-card:hover::before {
  opacity: 1;
}

.surprise-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(240, 219, 74, 0.2);
  border: 1px solid rgba(240, 219, 74, 0.5);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a06e12;
  margin-bottom: 20px;
}

.surprise-card-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  display: inline-block;
  transition: transform 0.3s ease;
}

.surprise-card:hover .surprise-card-icon {
  transform: scale(1.15) rotate(4deg);
}

.surprise-card-title {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.45rem;
  color: #3a2e1f;
  margin-bottom: 12px;
  line-height: 1.35;
}

.surprise-card-desc {
  font-size: 0.95rem;
  color: var(--color-text-muted, #6b5b45);
  line-height: 1.65;
  margin-bottom: 26px;
  flex-grow: 1;
}

.surprise-card-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-coral, #ff6f61);
  padding-top: 14px;
  border-top: 1px dashed rgba(240, 219, 74, 0.4);
}

.surprise-card-cta .arrow {
  transition: transform 0.25s ease;
}

.surprise-card:hover .surprise-card-cta .arrow {
  transform: translateX(6px);
}

/* ----------------------------------------------------------------------------
 * 2. SONGS THAT SOUND LIKE YOU (FEATURE 7 - LETTER PAGE)
 * ---------------------------------------------------------------------------- */
.songs-section {
  margin-top: 65px;
  padding-top: 45px;
  border-top: 1px dashed rgba(240, 219, 74, 0.5);
}

.songs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 32px;
}

.song-vinyl-card {
  background: #ffffff;
  border: 1.5px solid rgba(240, 219, 74, 0.45);
  border-radius: 20px;
  padding: 24px 22px;
  display: flex;
  gap: 18px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(247, 183, 51, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.song-vinyl-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(240, 219, 74, 0.18);
  border-color: rgba(247, 183, 51, 0.7);
}

.song-vinyl-graphic {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #2a221b 20%, #15110e 65%, #3a2e1f 100%);
  border: 3px solid rgba(240, 219, 74, 0.6);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.song-vinyl-graphic::before {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0db4a, #ff6f61);
  border: 2px solid #ffffff;
}

.song-vinyl-graphic::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a221b;
}

.song-vinyl-details {
  flex-grow: 1;
  min-width: 0;
}

.song-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ff6f61;
  background: rgba(255, 111, 97, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.song-title {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.15rem;
  color: #3a2e1f;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: 0.85rem;
  color: #8c765a;
  margin-bottom: 8px;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.song-reason {
  font-size: 0.86rem;
  font-style: italic;
  color: #554432;
  line-height: 1.45;
  border-left: 2px solid #f0db4a;
  padding-left: 10px;
}

/* ----------------------------------------------------------------------------
 * 3. FLOATING WORD COLLAGE (FEATURE 1 - LETTER PAGE)
 * Continuous weightless poetry floating in warm golden-hour light.
 * GPU-accelerated (transform/opacity only), silky smooth, staggered animations.
 * ---------------------------------------------------------------------------- */
.word-collage-section {
  position: relative;
  margin-top: 65px;
  padding-top: 50px;
  padding-bottom: 50px;
  border-top: 1px dashed rgba(240, 219, 74, 0.5);
  text-align: center;
  overflow: visible;
}

.word-collage-section .section-head {
  margin-bottom: 24px;
}

/* Wide Stage Canvas Wrapper */
.collage-stage-wrapper {
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  min-height: 640px;
  overflow: visible;
}

/* Background Atmosphere Accents Layer (Floating sparkles & hearts) */
.collage-accents-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  will-change: transform;
}

.collage-accent {
  position: absolute;
  top: var(--top, 50%);
  left: var(--left, 50%);
  transform: translate(-50%, -50%);
  font-size: var(--acc-size, 1.15rem);
  opacity: var(--acc-opacity, 0.45);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  will-change: transform, opacity;
  animation: floatAtmosphere var(--drift-dur, 12s) ease-in-out infinite var(--drift-del, 0s);
  filter: drop-shadow(0 2px 8px rgba(247, 183, 51, 0.25));
}

/* Foreground Phrases Canvas */
.collage-canvas.collage-text-layer {
  position: relative;
  width: 100%;
  height: 660px;
  margin: 0 auto;
  z-index: 2;
  will-change: transform;
}

/* Phrase Item Outer: Handles position, entrance reveal & desktop scattering */
.collage-item {
  position: absolute;
  top: var(--top, 50%);
  left: var(--left, 50%);
  transform: translate(-50%, -50%) translateY(28px) scale(0.95);
  opacity: 0;
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--item-index, 0) * 70ms);
  pointer-events: none;
  will-change: transform, opacity;
}

/* Entrance Triggered via IntersectionObserver */
.word-collage-section.is-in-view .collage-item {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0) scale(1);
}

/* Floating Inner Phrase: Runs continuous infinite bob & rotate wobble */
.collage-word-float {
  display: inline-block;
  position: relative;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  will-change: transform;
  transform: rotate(var(--base-rot, 0deg));
}

.collage-text {
  position: relative;
  z-index: 2;
  display: inline-block;
}

/* Hierarchy: Size Tiers (Desktop) */
.collage-word-float.size-xl {
  font-size: clamp(2.3rem, 3.4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  z-index: 5;
}

.collage-word-float.size-lg {
  font-size: clamp(1.7rem, 2.3vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.005em;
  z-index: 4;
}

.collage-word-float.size-md {
  font-size: clamp(1.25rem, 1.7vw, 1.6rem);
  font-weight: 600;
  z-index: 3;
}

.collage-word-float.size-sm {
  font-size: clamp(1.02rem, 1.25vw, 1.22rem);
  font-weight: 600;
  opacity: 0.92;
  z-index: 2;
}

/* Font Variations */
.collage-word-float.font-script {
  font-family: var(--font-script, 'Dancing Script', cursive);
  font-weight: 700;
  line-height: 1.15;
}

.collage-word-float.font-serif {
  font-family: var(--font-heading, 'Playfair Display', Georgia, serif);
  font-weight: 700;
  font-style: italic;
  line-height: 1.25;
}

.collage-word-float.font-sans {
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

/* Cohesive Sunset Palette Colors */
.collage-word-float.color-gradient {
  background: var(--grad-sunset, linear-gradient(135deg, #f0db4a 0%, #f7b733 50%, #ff6f61 100%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(247, 183, 51, 0.3));
}

.collage-word-float.color-coral {
  color: #ff6f61;
  text-shadow: 0 2px 10px rgba(255, 111, 97, 0.22);
}

.collage-word-float.color-plum {
  color: #3a2e1f;
  text-shadow: 0 1px 4px rgba(58, 46, 31, 0.1);
}

.collage-word-float.color-gold {
  color: #d89600;
  text-shadow: 0 2px 10px rgba(240, 219, 74, 0.28);
}

.collage-word-float.color-amber {
  color: #e68a00;
  text-shadow: 0 2px 9px rgba(247, 183, 51, 0.25);
}

.collage-word-float.color-rose {
  color: #f94144;
  text-shadow: 0 2px 10px rgba(249, 65, 68, 0.22);
}

/* Anchor Glow: Soft atmospheric candlelight pulse behind prominent phrases */
.collage-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 170%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(247, 183, 51, 0.38) 0%, rgba(255, 111, 97, 0.18) 45%, rgba(240, 219, 74, 0) 74%);
  filter: blur(16px);
  -webkit-filter: blur(16px);
  border-radius: 999px;
  pointer-events: none;
  z-index: 1;
  will-change: transform, opacity;
  animation: anchorGlowPulse 4.5s ease-in-out infinite alternate;
}

@keyframes anchorGlowPulse {
  0% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.92);
  }
  100% {
    opacity: 0.96;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

/* Continuous Floating Animations (Distinct Keyframes per Size Tier) */
.float-anchor {
  animation: floatAnchor var(--float-duration, 7.5s) ease-in-out infinite var(--float-delay, 0s);
}

.float-medium {
  animation: floatMedium var(--float-duration, 6.2s) ease-in-out infinite var(--float-delay, 0s);
}

.float-playful {
  animation: floatPlayful var(--float-duration, 4.8s) ease-in-out infinite var(--float-delay, 0s);
}

/* Desktop Float Loops: Subtle, gentle drifting */
@keyframes floatAnchor {
  0% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }
  25% {
    transform: translate3d(3px, -6px, 0) rotate(calc(var(--base-rot, 0deg) + 0.6deg));
  }
  50% {
    transform: translate3d(-3px, 5px, 0) rotate(calc(var(--base-rot, 0deg) - 0.5deg));
  }
  75% {
    transform: translate3d(2px, -4px, 0) rotate(calc(var(--base-rot, 0deg) + 0.4deg));
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }
}

@keyframes floatMedium {
  0% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }
  28% {
    transform: translate3d(5px, -9px, 0) rotate(calc(var(--base-rot, 0deg) + 1.2deg));
  }
  55% {
    transform: translate3d(-4px, 7px, 0) rotate(calc(var(--base-rot, 0deg) - 1deg));
  }
  82% {
    transform: translate3d(3px, -5px, 0) rotate(calc(var(--base-rot, 0deg) + 0.8deg));
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }
}

@keyframes floatPlayful {
  0% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }
  24% {
    transform: translate3d(-6px, -11px, 0) rotate(calc(var(--base-rot, 0deg) - 1.8deg));
  }
  52% {
    transform: translate3d(7px, 9px, 0) rotate(calc(var(--base-rot, 0deg) + 1.6deg));
  }
  78% {
    transform: translate3d(-4px, -6px, 0) rotate(calc(var(--base-rot, 0deg) - 1deg));
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }
}

@keyframes floatAtmosphere {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.4;
  }
  35% {
    transform: translate3d(7px, -13px, 0) scale(1.08);
    opacity: 0.72;
  }
  70% {
    transform: translate3d(-6px, 10px, 0) scale(0.93);
    opacity: 0.38;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.4;
  }
}

/* Performance Guard: Pause all floating when tab hidden or scrolled out of view */
.word-collage-section.is-paused .collage-word-float,
.word-collage-section.is-paused .collage-accent,
.word-collage-section.is-paused .collage-glow {
  animation-play-state: paused !important;
}

/* ============================================================================
 * MOBILE ADAPTATION (375px, 390px, 430px)
 * Switch to vertical flowing single column with tiny float amplitude.
 * Zero horizontal overflow, no drifting outside rows, crystal clear readability.
 * ============================================================================ */
@media (max-width: 768px) {
  .word-collage-section {
    margin-top: 48px;
    padding-top: 36px;
    padding-bottom: 36px;
  }

  .collage-stage-wrapper {
    min-height: auto;
    padding: 0 10px;
    overflow: hidden;
  }

  .collage-canvas.collage-text-layer {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 16px 4px !important;
    transform: none !important;
  }

  .collage-item {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: translateY(18px) scale(0.97) !important;
    width: 100% !important;
    max-width: 360px !important;
    text-align: center !important;
    margin: 4px 0 !important;
  }

  .word-collage-section.is-in-view .collage-item {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
  }

  .collage-word-float {
    white-space: normal !important;
    display: inline-block !important;
    max-width: 95% !important;
    word-break: break-word !important;
    transform: rotate(calc(var(--base-rot, 0deg) * 0.35)) !important;
  }

  /* Scaled Mobile Font Sizes */
  .collage-word-float.size-xl {
    font-size: 1.95rem !important;
    line-height: 1.2 !important;
  }

  .collage-word-float.size-lg {
    font-size: 1.5rem !important;
    line-height: 1.25 !important;
  }

  .collage-word-float.size-md {
    font-size: 1.22rem !important;
    line-height: 1.3 !important;
  }

  .collage-word-float.size-sm {
    font-size: 1.02rem !important;
    line-height: 1.35 !important;
  }

  /* Reduced Float Amplitude for Mobile (Safe from row collision or overflow) */
  .float-anchor {
    animation-name: floatMobileAnchor !important;
  }

  .float-medium {
    animation-name: floatMobileMed !important;
  }

  .float-playful {
    animation-name: floatMobilePlayful !important;
  }

  .collage-accents-layer {
    opacity: 0.35;
  }
}

@keyframes floatMobileAnchor {
  0%   { transform: translate3d(0, 0, 0) rotate(calc(var(--base-rot, 0deg) * 0.35)); }
  50%  { transform: translate3d(2px, -3px, 0) rotate(calc(var(--base-rot, 0deg) * 0.35 + 0.4deg)); }
  100% { transform: translate3d(0, 0, 0) rotate(calc(var(--base-rot, 0deg) * 0.35)); }
}

@keyframes floatMobileMed {
  0%   { transform: translate3d(0, 0, 0) rotate(calc(var(--base-rot, 0deg) * 0.35)); }
  50%  { transform: translate3d(-2px, -4px, 0) rotate(calc(var(--base-rot, 0deg) * 0.35 - 0.5deg)); }
  100% { transform: translate3d(0, 0, 0) rotate(calc(var(--base-rot, 0deg) * 0.35)); }
}

@keyframes floatMobilePlayful {
  0%   { transform: translate3d(0, 0, 0) rotate(calc(var(--base-rot, 0deg) * 0.35)); }
  50%  { transform: translate3d(2px, -5px, 0) rotate(calc(var(--base-rot, 0deg) * 0.35 + 0.6deg)); }
  100% { transform: translate3d(0, 0, 0) rotate(calc(var(--base-rot, 0deg) * 0.35)); }
}

/* Accessibility: Prefers-Reduced-Motion */
@media (prefers-reduced-motion: reduce) {
  .collage-item {
    opacity: 1 !important;
    transform: translate(-50%, -50%) !important;
    transition: none !important;
  }

  @media (max-width: 768px) {
    .collage-item {
      transform: none !important;
    }
  }

  .collage-word-float,
  .collage-accent,
  .collage-glow {
    animation: none !important;
    transform: rotate(var(--base-rot, 0deg)) !important;
  }

  .collage-glow {
    opacity: 0.7 !important;
  }
}

/* ----------------------------------------------------------------------------
 * 4. SCRATCH CARDS (FEATURE 2 - WISH PAGE)
 * ---------------------------------------------------------------------------- */
.scratch-section {
  margin-top: 65px;
  padding-top: 45px;
  border-top: 1px dashed rgba(240, 219, 74, 0.5);
}

.scratch-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
  margin-top: 36px;
}

.scratch-card-item {
  position: relative;
  background: #ffffff;
  border-radius: 22px;
  border: 2px solid rgba(240, 219, 74, 0.55);
  box-shadow: 0 12px 32px rgba(247, 183, 51, 0.12);
  overflow: hidden;
  height: 300px;
  display: flex;
  flex-direction: column;
}

/* Content hidden underneath foil */
.scratch-prize-content {
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 100%;
  box-sizing: border-box;
  background: linear-gradient(180deg, #ffffff 0%, #fffdf5 100%);
}

.scratch-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a06e12;
  background: rgba(240, 219, 74, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.scratch-prize-title {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.25rem;
  color: #3a2e1f;
  margin-bottom: 8px;
  line-height: 1.35;
}

.scratch-prize-sub {
  font-size: 0.85rem;
  color: #ff6f61;
  font-weight: 600;
  margin-bottom: 10px;
}

.scratch-prize-desc {
  font-size: 0.86rem;
  color: #6b5b45;
  line-height: 1.5;
  margin-bottom: 14px;
}

.scratch-code-pill {
  font-family: monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #fff3c9;
  border: 1px dashed #d19a17;
  color: #6b4d08;
  padding: 4px 12px;
  border-radius: 8px;
}

/* Foil Canvas layered directly on top */
.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  z-index: 3;
  transition: opacity 0.5s ease;
}

.scratch-canvas:active {
  cursor: grabbing;
}

.scratch-canvas.revealed {
  opacity: 0;
  pointer-events: none;
}

.scratch-helper-hint {
  text-align: center;
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--color-text-muted, #6b5b45);
}

/* ----------------------------------------------------------------------------
 * 5. WRITE BACK TO ME (FEATURE 6 - WISH PAGE)
 * ---------------------------------------------------------------------------- */
.write-back-section {
  margin-top: 65px;
  padding-top: 45px;
  border-top: 1px dashed rgba(240, 219, 74, 0.5);
}

.write-back-card {
  max-width: 680px;
  margin: 32px auto 0;
  background: #ffffff;
  border: 2px solid rgba(240, 219, 74, 0.65);
  border-radius: 28px;
  padding: 40px 34px;
  box-shadow: 0 16px 45px rgba(247, 183, 51, 0.12);
  position: relative;
}

.write-back-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.write-back-textarea {
  width: 100%;
  min-height: 160px;
  border: 1.5px solid rgba(240, 219, 74, 0.5);
  border-radius: 18px;
  padding: 18px;
  font-family: inherit;
  font-size: 1rem;
  color: #3a2e1f;
  background: #fffdfa;
  resize: vertical;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  box-sizing: border-box;
}

.write-back-textarea:focus {
  border-color: #f7b733;
  box-shadow: 0 0 0 4px rgba(240, 219, 74, 0.25);
}

.write-back-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.write-back-char-count {
  font-size: 0.85rem;
  color: #8c765a;
}

.btn-write-back-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f0db4a 0%, #f7b733 50%, #ff6f61 100%);
  color: #3a2e1f;
  font-weight: 700;
  font-size: 1rem;
  padding: 13px 30px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(247, 183, 51, 0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-write-back-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(247, 183, 51, 0.35);
}

.btn-write-back-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.write-back-toast {
  display: none;
  padding: 18px;
  border-radius: 16px;
  background: rgba(240, 219, 74, 0.2);
  border: 1.5px solid #f7b733;
  color: #3a2e1f;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  margin-top: 18px;
}

/* ----------------------------------------------------------------------------
 * 6. CHAT-BUBBLE STORY (FEATURE 8 - GALLERY PAGE)
 * ---------------------------------------------------------------------------- */
.chat-story-section {
  margin-top: 65px;
  padding-top: 45px;
  border-top: 1px dashed rgba(240, 219, 74, 0.5);
}

.chat-device-frame {
  max-width: 580px;
  margin: 36px auto 0;
  background: #ffffff;
  border: 2px solid rgba(240, 219, 74, 0.65);
  border-radius: 32px;
  box-shadow: 0 18px 50px rgba(247, 183, 51, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-device-header {
  background: linear-gradient(135deg, rgba(255, 247, 220, 0.9) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-bottom: 1px solid rgba(240, 219, 74, 0.4);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0db4a, #ff6f61);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.chat-header-info {
  flex-grow: 1;
}

.chat-header-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #3a2e1f;
  margin: 0;
}

.chat-header-status {
  font-size: 0.8rem;
  color: #0b9e58;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0b9e58;
}

.chat-stream-container {
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 420px;
  background: #fffdfa;
}

.chat-bubble-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.chat-bubble-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.chat-bubble-row.sender-anurag {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-bubble-row.sender-debasmita {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  padding: 13px 18px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.chat-bubble-row.sender-anurag .chat-bubble {
  background: linear-gradient(135deg, #f0db4a 0%, #f7b733 100%);
  color: #2b2014;
  border-bottom-right-radius: 4px;
}

.chat-bubble-row.sender-debasmita .chat-bubble {
  background: #ffffff;
  color: #3a2e1f;
  border: 1px solid rgba(240, 219, 74, 0.4);
  border-bottom-left-radius: 4px;
}

.chat-bubble-meta {
  font-size: 0.72rem;
  color: #8c765a;
  margin-top: 4px;
  padding: 0 6px;
}

/* Typing Indicator Animation */
.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  will-change: transform, opacity;
}

.chat-typing-dots.visible {
  opacity: 1;
  transform: translateY(0);
}

.chat-typing-dots.sender-debasmita {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid rgba(240, 219, 74, 0.4);
  border-bottom-left-radius: 4px;
}

.chat-typing-dots.sender-debasmita .chat-dot {
  background: #f7b733;
}

.chat-typing-dots.sender-anurag {
  align-self: flex-end;
  background: linear-gradient(135deg, #f0db4a 0%, #f7b733 100%);
  border: 1px solid rgba(240, 219, 74, 0.5);
  border-bottom-right-radius: 4px;
}

.chat-typing-dots.sender-anurag .chat-dot {
  background: #3a2e1f;
}

.chat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  animation: chatDotBounce 1.4s infinite ease-in-out both;
  will-change: transform, opacity;
}

.chat-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatDotBounce {
  0%, 80%, 100% {
    transform: scale(0.35);
    opacity: 0.35;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ----------------------------------------------------------------------------
 * 7. QUIZ PAGE (/meow/quiz/)
 * ---------------------------------------------------------------------------- */
.quiz-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}

.quiz-progress-bar-wrap {
  background: rgba(240, 219, 74, 0.2);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f0db4a, #f7b733, #ff6f61);
  width: 16.66%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.quiz-card-container {
  background: #ffffff;
  border: 2px solid rgba(240, 219, 74, 0.6);
  border-radius: 28px;
  padding: 44px 34px;
  box-shadow: 0 18px 50px rgba(247, 183, 51, 0.12);
  position: relative;
  overflow: hidden;
}

.quiz-q-counter {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff6f61;
  margin-bottom: 12px;
}

.quiz-question-title {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.45rem;
  color: #3a2e1f;
  line-height: 1.4;
  margin-bottom: 28px;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-option-btn {
  background: #fffdfa;
  border: 1.5px solid rgba(240, 219, 74, 0.45);
  border-radius: 16px;
  padding: 16px 20px;
  text-align: left;
  font-size: 1rem;
  color: #3a2e1f;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 14px;
}

.quiz-option-btn:hover:not(:disabled) {
  transform: translateX(6px);
  border-color: #f7b733;
  background: #fff8e6;
}

.quiz-option-btn.selected {
  background: #fff2cc;
  border-color: #e5a71a;
  font-weight: 600;
}

.quiz-option-indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(240, 219, 74, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  background: #ffffff;
}

.quiz-option-btn.selected .quiz-option-indicator {
  background: #f7b733;
  color: #ffffff;
  border-color: #f7b733;
}

/* Cute Reaction Line Box */
.quiz-reaction-box {
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(255, 247, 220, 0.7);
  border: 1px solid rgba(240, 219, 74, 0.6);
  font-size: 0.95rem;
  color: #3a2e1f;
  display: none;
  animation: fadeIn 0.3s ease;
}

.quiz-reaction-box.active {
  display: block;
}

.quiz-actions-row {
  margin-top: 28px;
  display: flex;
  justify-content: flex-end;
}

/* Quiz Result Card */
.quiz-result-card {
  text-align: center;
  display: none;
}

.quiz-result-card.active {
  display: block;
}

.quiz-score-hearts {
  font-size: 2.4rem;
  margin-bottom: 16px;
  letter-spacing: 4px;
}

/* ----------------------------------------------------------------------------
 * 8. MINI-GAME PAGE (/meow/game/)
 * ---------------------------------------------------------------------------- */
.game-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 20px 80px;
  text-align: center;
}

.game-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid rgba(240, 219, 74, 0.6);
  border-radius: 20px;
  padding: 14px 24px;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(247, 183, 51, 0.1);
}

.game-hud-item {
  display: flex;
  flex-direction: column;
}

.game-hud-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #8c765a;
}

.game-hud-value {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: #3a2e1f;
}

.game-canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 480px;
  background: linear-gradient(180deg, #1c1524 0%, #2f2238 60%, #442a42 100%);
  border-radius: 28px;
  border: 2px solid rgba(240, 219, 74, 0.75);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

#stars-game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.game-start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 21, 36, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.game-start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.btn-game-start {
  background: linear-gradient(135deg, #f0db4a 0%, #f7b733 50%, #ff6f61 100%);
  color: #3a2e1f;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 16px 38px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(240, 219, 74, 0.4);
  transition: transform 0.25s ease;
}

.btn-game-start:hover {
  transform: scale(1.06);
}

/* Base / Desktop Game Result Card Styles (Pixel-identical to original) */
.game-result-card {
  display: contents;
}

.game-result-emoji {
  font-size: 3.5rem;
  margin-bottom: 10px;
}

.game-result-title {
  font-family: var(--font-heading, 'Playfair Display', serif);
  color: #ffffff;
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.game-result-score {
  font-size: 1.4rem;
  color: #f0db4a;
  font-weight: 700;
  margin-bottom: 12px;
}

.game-result-message {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  max-width: 400px;
  margin-bottom: 26px;
  line-height: 1.6;
}

.game-result-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-result-actions .game-back-hub-btn {
  background: rgba(255, 255, 255, 0.95);
  color: #3a2e1f !important;
}

/* Pill Return Button (matching Surprises Hub pill button) */
.back-to-hub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-main, #3a2e1f) !important;
  background: #ffffff;
  border: 1px solid var(--border-gold, #f0db4a);
  border-radius: 9999px;
  box-shadow: var(--shadow-sm, 0 4px 15px rgba(58, 46, 31, 0.08));
  text-decoration: none !important;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.back-to-hub-link:hover {
  background: rgba(240, 219, 74, 0.15);
  border-color: var(--color-coral, #ff6f61);
  color: var(--color-coral, #ff6f61) !important;
  transform: translateY(-2px);
}

/* ----------------------------------------------------------------------------
 * 9. SECRET VAULT PAGE (/meow/vault/)
 * ---------------------------------------------------------------------------- */
.vault-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}

.vault-door-container {
  background: #ffffff;
  border: 2px solid rgba(240, 219, 74, 0.7);
  border-radius: 32px;
  padding: 44px 34px;
  box-shadow: 0 20px 55px rgba(247, 183, 51, 0.16);
  position: relative;
  text-align: center;
}

.vault-lock-graphic {
  font-size: 4.2rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 6px 16px rgba(240, 219, 74, 0.4));
  transition: transform 0.5s ease;
}

.vault-door-container.shake {
  animation: vaultShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes vaultShake {
  10%, 90% { transform: translateX(-4px); }
  20%, 80% { transform: translateX(6px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.vault-input-group {
  margin: 26px auto 0;
  max-width: 440px;
  display: flex;
  gap: 10px;
}

.vault-input {
  flex-grow: 1;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1.5px solid rgba(240, 219, 74, 0.6);
  font-family: inherit;
  font-size: 1rem;
  color: #3a2e1f;
  background: #fffdfa;
  outline: none;
}

.vault-input:focus {
  border-color: #f7b733;
  box-shadow: 0 0 0 3px rgba(240, 219, 74, 0.25);
}

.btn-vault-unlock {
  background: linear-gradient(135deg, #f0db4a 0%, #f7b733 100%);
  color: #3a2e1f;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.vault-hints-accordion {
  margin-top: 24px;
  text-align: left;
}

.vault-hint-item {
  background: rgba(255, 247, 220, 0.6);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: #6b5b45;
  display: none;
}

.vault-hint-item.revealed {
  display: block;
}

/* Vault Unlocked Surprise Screen */
.vault-unlocked-reveal {
  text-align: center;
  animation: fadeIn 0.6s ease;
}

.vault-surprise-photo-frame {
  margin: 28px auto;
  max-width: 420px;
  border-radius: 20px;
  overflow: hidden;
  border: 4px solid #ffffff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.15);
}

.vault-surprise-photo-frame img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.vault-letter-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #3a2e1f;
  text-align: left;
  background: #fffdf7;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid rgba(240, 219, 74, 0.5);
  margin-bottom: 24px;
  white-space: pre-line;
}


/* ----------------------------------------------------------------------------
 * 11. RESPONSIVENESS & BREAKPOINTS
 * ---------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .surprises-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .scratch-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .surprises-grid {
    grid-template-columns: 1fr;
  }
  .scratch-cards-grid {
    grid-template-columns: 1fr;
  }
  .song-vinyl-card {
    padding: 18px 16px;
  }
  .quiz-card-container {
    padding: 30px 20px;
  }
  .vault-door-container {
    padding: 30px 20px;
  }
  .vault-input-group {
    flex-direction: column;
  }
  .btn-vault-unlock {
    width: 100%;
  }
  .game-wrapper {
    padding: 15px 14px calc(120px + env(safe-area-inset-bottom, 20px));
  }
  .game-canvas-container {
    max-height: min(440px, calc(100dvh - 290px));
    height: clamp(260px, 46dvh, 400px);
    aspect-ratio: auto;
  }
  /* When the round ends, size canvas container naturally to its content */
  .game-canvas-container.game-ended,
  .game-canvas-container:has(#game-end-modal:not([style*="display: none"])) {
    height: auto !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    overflow: visible !important;
  }
  .game-canvas-container.game-ended #stars-game-canvas,
  .game-canvas-container:has(#game-end-modal:not([style*="display: none"])) #stars-game-canvas {
    display: none !important;
  }
  #game-end-modal {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 26px 16px !important;
    border-radius: 28px !important;
    box-sizing: border-box !important;
  }
  .game-canvas-container:not(.game-ended) #game-end-modal {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  #game-end-modal .game-result-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: min(100%, 320px) !important;
    margin: 0 auto !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }
  #game-end-modal .game-result-emoji {
    font-size: clamp(2.4rem, 10vw, 3rem) !important;
    margin: 0 0 8px !important;
    line-height: 1 !important;
  }
  #game-end-modal .game-result-title {
    font-size: clamp(1.45rem, 6vw, 1.85rem) !important;
    line-height: 1.2 !important;
    margin: 0 0 10px !important;
    color: #ffffff !important;
    text-wrap: balance !important;
  }
  #game-end-modal .game-result-score {
    font-size: clamp(1.1rem, 4.5vw, 1.35rem) !important;
    color: #f0db4a !important;
    font-weight: 700 !important;
    margin: 0 0 10px !important;
    line-height: 1.3 !important;
  }
  #game-end-modal .game-result-message {
    font-size: clamp(0.85rem, 3.6vw, 0.95rem) !important;
    line-height: 1.5 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    max-width: 320px !important;
    margin: 0 auto 20px !important;
    text-wrap: pretty !important;
  }
  #game-end-modal .game-result-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
  }
  #game-end-modal .game-result-actions .btn-game-start,
  #game-end-modal .game-result-actions .btn-secondary-outline,
  #game-end-modal .game-result-actions .game-back-hub-btn {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: min(100%, 320px) !important;
    min-height: 48px !important;
    padding: 12px 24px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    border-radius: 9999px !important;
    text-decoration: none !important;
    line-height: 1.2 !important;
  }
  #game-end-modal .game-result-actions .btn-secondary-outline,
  #game-end-modal .game-result-actions .game-back-hub-btn {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #3a2e1f !important;
    border: 1.5px solid rgba(240, 219, 74, 0.8) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
  }
  #game-page .back-to-hub-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background: #ffffff;
    color: var(--color-text-main, #3a2e1f) !important;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none !important;
    border: 1px solid var(--border-gold, #f0db4a);
    border-radius: 9999px;
    box-shadow: var(--shadow-sm, 0 4px 15px rgba(58, 46, 31, 0.08));
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .game-wrapper {
    padding: 10px 14px calc(80px + env(safe-area-inset-bottom, 15px));
  }
  .game-canvas-container {
    max-height: calc(100dvh - 150px);
    height: clamp(190px, 58dvh, 290px);
  }
  .game-canvas-container.game-ended,
  .game-canvas-container:has(#game-end-modal:not([style*="display: none"])) {
    height: auto !important;
    max-height: none !important;
    aspect-ratio: auto;
  }
}

@media (max-width: 375px) {
  .surprise-card {
    padding: 24px 18px;
  }
  .write-back-card {
    padding: 24px 18px;
  }
  .chat-device-frame {
    border-radius: 20px;
  }
}

/* ----------------------------------------------------------------------------
 * 12. ACCESSIBILITY: PREFERS REDUCED MOTION
 * ---------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .surprise-card:hover {
    transform: none !important;
  }
  .vault-door-container.shake {
    animation: none !important;
  }
  .chat-bubble-row {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .chat-typing-dots {
    display: none !important;
  }
}
