/* ============================================
   MAIN.CSS — Sakura Dreams
   Reset, Custom Properties, Base Styles
   ============================================ */

/* --- CSS Reset & Box Model --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  max-width: 100%;
}

img,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select,
[role="button"] {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* --- CSS Custom Properties --- */
:root {
  /* Colors */
  --rose: #F4A7B9;
  --lavender: #C9B8E8;
  --peach: #FFD6BA;
  --cream: #FFF8F5;
  --deep-bg: #1A0F18;
  --deep-bg2: #2D1B2E;
  --deep-bg3: #3D2040;
  --gold: #F7E7A6;
  --text: #5C3A4A;
  --muted: #FDE8EF;

  /* Derived / Alpha */
  --rose-15: rgba(244, 167, 185, 0.15);
  --rose-30: rgba(244, 167, 185, 0.30);
  --rose-50: rgba(244, 167, 185, 0.50);
  --lavender-20: rgba(201, 184, 232, 0.20);
  --lavender-40: rgba(201, 184, 232, 0.40);
  --gold-20: rgba(247, 231, 166, 0.20);
  --white-05: rgba(255, 255, 255, 0.05);
  --white-10: rgba(255, 255, 255, 0.10);
  --white-15: rgba(255, 255, 255, 0.15);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --font-script: 'Dancing Script', cursive;
  --font-mono: 'DM Mono', 'Courier New', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;
  --space-4xl: 7rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.6s ease;
  --transition-spring: 0.4s cubic-bezier(0.23, 1, 0.32, 1);

  /* Shadows */
  --shadow-rose: 0 4px 30px rgba(244, 167, 185, 0.25);
  --shadow-rose-lg: 0 8px 50px rgba(244, 167, 185, 0.40);
  --shadow-gold: 0 4px 30px rgba(247, 231, 166, 0.30);
  --shadow-card: 0 10px 40px rgba(92, 58, 74, 0.12);
  --shadow-dark: 0 20px 60px rgba(26, 15, 24, 0.50);

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Z-index layers */
  --z-base: 1;
  --z-above: 10;
  --z-nav: 100;
  --z-modal: 500;
  --z-cursor: 9999;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* --- Base Styles --- */
body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--cream);
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  position: relative;
  /* native cursor */
  line-height: 1.7;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--cream);
}

::-webkit-scrollbar-thumb {
  background: var(--rose);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #e8809a;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--rose) var(--cream);
}

/* --- Scroll Progress Bar --- */
#scroll-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--rose), var(--lavender), var(--peach));
  z-index: calc(var(--z-nav) + 1);
  transition: width 0.1s linear;
  pointer-events: none;
}

/* --- Custom Cursor --- */
.custom-cursor {
  position: fixed;
  width: 14px;
  height: 14px;
  background: var(--rose);
  border-radius: var(--radius-full);
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease, width 0.2s ease, height 0.2s ease, background 0.2s ease;
  mix-blend-mode: normal;
  will-change: transform;
}

.custom-cursor.hovering {
  width: 22px;
  height: 22px;
  background: var(--lavender);
}

.cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--rose-50);
  border-radius: var(--radius-full);
  pointer-events: none;
  z-index: calc(var(--z-cursor) - 1);
  transform: translate(-50%, -50%);
  transition: transform 0.12s ease, width 0.2s ease, height 0.2s ease;
  will-change: transform;
}

.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: calc(var(--z-cursor) - 2);
  user-select: none;
  font-size: 14px;
  transform: translate(-50%, -50%);
}

/* --- Layout Container --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 5vw, 4rem);
}

/* --- Section Base --- */
section {
  padding: var(--space-3xl) 0;
  position: relative;
  overflow: hidden;
}

/* Defer rendering of heavy below-the-fold content for instant page load & smooth 60fps scrolling */
#letter,
#scrapbook,
#reasons,
#openwhen,
#memories,
#timeline,
#stats,
#music,
#chats,
#reelstorm,
#game,
#qna,
#guestbook {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 700px;
}

/* Low-end device performance overrides */
.is-low-end * {
  text-rendering: auto;
}

.is-low-end .glass,
.is-low-end .glass-light,
.is-low-end .glass-card,
.is-low-end .hero-card,
.is-low-end .music-player,
.is-low-end .chat-screen,
.is-low-end .guestbook-form,
.is-low-end .note-card,
.is-low-end .polaroid-modal-inner,
.is-low-end .bgm-pill {
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25) !important;
}

/* --- Utility Classes --- */
.glass {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--white-15);
  border-radius: var(--radius-lg);
}

.glass-light {
  background: rgba(255, 248, 245, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--rose-15);
  border-radius: var(--radius-lg);
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-3xl);
  position: relative;
  color: inherit;
  letter-spacing: -0.02em;
}

.section-title::before,
.section-title::after {
  content: '🌸';
  font-size: 0.6em;
  vertical-align: middle;
  margin: 0 var(--space-sm);
  opacity: 0.6;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  /* native cursor */
  transition: all var(--transition-spring);
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--rose);
  color: #fff;
  box-shadow: var(--shadow-rose);
}

.btn-primary:hover {
  background: #e8809a;
  transform: translateY(-2px);
  box-shadow: var(--shadow-rose-lg);
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--rose);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--rose-15);
  transform: translateY(-2px);
}

.btn-gold {
  background: var(--gold);
  color: var(--text);
  box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(247, 231, 166, 0.5);
}

/* --- Navigation --- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  padding: max(0.85rem, env(safe-area-inset-top, 0.85rem)) max(var(--space-xl), env(safe-area-inset-right, 1rem)) 0.85rem max(var(--space-xl), env(safe-area-inset-left, 1rem));
  background: rgba(255, 248, 245, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(244, 167, 185, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.4s ease, background 0.3s ease;
}

nav.nav-hidden {
  transform: translateY(-100%);
}

nav.nav-light {
  background: rgba(255, 248, 245, 0.92);
  border-bottom-color: var(--rose-30);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--rose);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition-base);
  letter-spacing: 0.01em;
}

.nav-links a:hover {
  background: var(--rose-15);
  color: var(--rose);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 2px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 8px;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  z-index: calc(var(--z-nav) + 1);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--rose);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Splash Screen --- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--deep-bg);
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(1.5rem, env(safe-area-inset-top, 1.5rem)) max(1.5rem, env(safe-area-inset-right, 1.5rem)) max(1.5rem, env(safe-area-inset-bottom, 1.5rem)) max(1.5rem, env(safe-area-inset-left, 1.5rem));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease, visibility 1s ease;
  overflow: hidden;
}

#splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#petals-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.splash-text {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--gold);
  text-align: center;
  position: relative;
  z-index: 2;
  margin-bottom: var(--space-xl);
  line-height: 1.2;
}

.splash-text .splash-char {
  display: inline-block;
  opacity: 0;
  animation: splash-letter 0.5s ease forwards;
  animation-delay: var(--delay, 0s);
}

#enter-btn {
  position: relative;
  z-index: 2;
  padding: 1rem 2.5rem;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  /* native cursor */
  letter-spacing: 0.02em;
  animation: pulse-glow 2s ease-in-out infinite;
  transition: transform var(--transition-spring), filter var(--transition-base);
  box-shadow:
    0 0 30px rgba(244, 167, 185, 0.5),
    0 4px 20px rgba(244, 167, 185, 0.3);
}

#enter-btn:hover {
  transform: translateY(-3px) scale(1.04);
  filter: brightness(1.1);
}

#enter-btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

/* --- Main Site (hidden until splash dismissed) --- */
#main-site {
  opacity: 0;
  transition: opacity 1s ease 0.2s;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

#main-site.visible {
  opacity: 1;
}

/* --- Hero Section --- */
#hero {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--deep-bg) 0%, var(--deep-bg2) 60%, var(--deep-bg3) 100%);
  display: flex;
  align-items: center;
  padding-top: max(5rem, calc(4rem + env(safe-area-inset-top, 0px)));
  padding-bottom: max(3rem, calc(2rem + env(safe-area-inset-bottom, 0px)));
  position: relative;
  overflow: hidden;
}

#stars-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
  position: relative;
  z-index: 2;
}

.hero-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
}

.hero-label {
  font-family: var(--font-script);
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: var(--space-sm);
  display: block;
  opacity: 0.85;
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(4rem, 10vw, 7.5rem);
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin-bottom: var(--space-lg);
  display: flex;
  gap: 0.05em;
  filter: drop-shadow(0 0 20px rgba(244, 167, 185, 0.45));
}

.hero-name .letter {
  background: linear-gradient(135deg, var(--rose) 0%, var(--lavender) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#tagline {
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  color: rgba(255, 248, 245, 0.75);
  min-height: 3.8rem;
  line-height: 1.5;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-bottom: 0;
  overflow: visible;
}

.cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--gold);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 0.8s steps(1) infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.floating-hearts {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.floating-hearts .heart {
  font-size: 1.8rem;
  /* native cursor */
}

/* Hero Card */
.hero-card-wrapper {
  perspective: 1000px;
  display: flex;
  justify-content: center;
  align-self: center;
}

.hero-card {
  background: rgba(255, 248, 245, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(244, 167, 185, 0.25);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  transform-style: preserve-3d;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow:
    0 0 40px rgba(244, 167, 185, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  max-width: 420px;
  width: 100%;
}

.hero-card:hover {
  transform: rotateX(-5deg) rotateY(10deg) translateY(-5px);
  box-shadow:
    0 20px 60px rgba(244, 167, 185, 0.30),
    0 0 80px rgba(201, 184, 232, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.hero-card-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  display: block;
  animation: float 3s ease-in-out infinite;
}

.hero-card-quote {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-style: italic;
  color: rgba(255, 248, 245, 0.9);
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

.hero-card-sig {
  font-family: var(--font-script);
  font-size: 1.3rem;
  color: var(--gold);
}

/* Decorative petal corner */
.hero-petal-bg {
  position: absolute;
  font-size: 10rem;
  opacity: 0.04;
  user-select: none;
  pointer-events: none;
}

/* --- Letter Section --- */
#letter {
  background: var(--cream);
  position: relative;
}

.letter-section-inner {
  max-width: 740px;
  margin: 0 auto;
}

.envelope-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
  perspective: 1200px;
}

/* SVG Envelope */
.envelope-svg-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  filter: drop-shadow(var(--shadow-rose));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease, max-height 0.65s cubic-bezier(0.16, 1, 0.3, 1), margin 0.65s ease;
  max-height: 420px;
  overflow: visible;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  perspective: 1000px;
  transform-style: preserve-3d;
}

.envelope-svg-container:hover {
  transform: translateY(-5px) scale(1.03);
}

.envelope-svg-container:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 8px;
  border-radius: var(--radius-md);
}

.envelope-flap {
  transform-origin: 140px 40px;
  transform-box: view-box;
  transition: transform 0.85s cubic-bezier(0.25, 1, 0.5, 1), filter 0.85s ease;
  transform-style: preserve-3d;
}

.envelope-svg-container.is-opening .envelope-flap {
  transform: rotateX(180deg);
  filter: drop-shadow(0 4px 12px rgba(244, 167, 185, 0.4));
}

.envelope-svg-container.is-opening .envelope-prompt {
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.envelope-svg-container.is-opened {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  visibility: hidden;
  position: absolute;
  top: 0;
  transition: opacity 0.45s ease, transform 0.45s ease, visibility 0.45s;
}

.envelope-svg-container.is-hidden {
  display: none !important;
}

/* Unboxing Bloom Aura */
.envelope-unboxing-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 340px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 167, 185, 0.55) 0%, rgba(247, 231, 166, 0.35) 45%, transparent 70%);
  filter: blur(28px);
  pointer-events: none;
  z-index: 1;
  animation: unboxingBloom 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Unboxing Particle Burst Elements */
.unboxing-particles-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
  z-index: 10;
}

.unboxing-particle {
  position: absolute;
  display: inline-block;
  user-select: none;
  pointer-events: none;
  font-size: var(--p-sz, 1.2rem);
  animation: particleFloatOut var(--p-dur, 1.4s) cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--p-del, 0s);
}

/* Letter Paper */
.letter-paper {
  display: none;
  background: #fffdf8;
  border-radius: var(--radius-md);
  padding: var(--space-2xl);
  box-shadow:
    0 12px 45px rgba(92, 58, 74, 0.14),
    0 1px 4px rgba(244, 167, 185, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  max-width: 680px;
  width: 100%;
  position: relative;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transform-origin: top center;
  /* Lined paper texture */
  background-image: repeating-linear-gradient(transparent,
      transparent 27px,
      rgba(244, 167, 185, 0.12) 27px,
      rgba(244, 167, 185, 0.12) 28px);
  line-height: 28px;
  cursor: pointer;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.letter-paper.visible {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.letter-paper.is-folding {
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.letter-para {
  opacity: 1;
  transform: none;
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.letter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background-color: var(--rose, #f4a7b9);
  margin-left: 2px;
  vertical-align: -0.15em;
  border-radius: 1px;
  animation: letterCursorBlink 0.75s ease-in-out infinite;
}

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

.letter-skip-hint {
  display: block;
  text-align: center;
  font-family: var(--font-body, 'Lato', sans-serif);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: rgba(184, 67, 93, 0.65);
  margin-top: 1rem;
  opacity: 0.85;
  transition: opacity 0.3s ease;
  user-select: none;
}

.letter-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-right: 75px;
}

.letter-badge {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rose);
  background: rgba(244, 167, 185, 0.15);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.letter-fold-btn {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: #7A5565;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(244, 167, 185, 0.4);
  padding: 4px 11px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.letter-fold-btn:hover {
  background: #FFF5F8;
  color: var(--rose-dark);
  border-color: var(--rose);
  transform: translateY(-1px);
}

.letter-content {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 180px;
  user-select: text;
}

.letter-paper em,
.letter-paper .letter-quote {
  font-style: italic;
  font-weight: 600;
  color: #8C3B56;
  background: rgba(244, 167, 185, 0.14);
  padding: 1px 5px;
  border-radius: 4px;
}

.letter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--rose);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 0.7s steps(1) infinite;
}

.wax-seal-container {
  text-align: center;
  margin-top: var(--space-xl);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.wax-seal-container.visible {
  opacity: 1;
}

/* --- Reasons Section --- */
#reasons {
  background: #fff;
  position: relative;
}

.reasons-decoration {
  position: absolute;
  font-size: 6rem;
  opacity: 0.04;
  user-select: none;
  pointer-events: none;
}

.reasons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.flip-card {
  height: 180px;
  perspective: 600px;
  /* native cursor */
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.flip-card-front {
  background: linear-gradient(135deg, var(--muted), var(--cream));
  border: 1px solid var(--rose-15);
  box-shadow: var(--shadow-card);
}

.flip-card-number {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--rose-30);
  line-height: 1;
}

.flip-card-emoji {
  font-size: 1.8rem;
  margin-top: var(--space-xs);
}

.flip-card-back {
  background: linear-gradient(135deg, var(--rose), #e8809a);
  transform: rotateY(180deg);
  text-align: center;
}

.flip-card-back p {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: #fff;
  line-height: 1.5;
  font-weight: 500;
}

/* Confetti pieces */
.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-above);
}

.confetti-piece:nth-child(1) {
  animation: confetti-fly-1 0.7s ease forwards;
  background: var(--gold);
}

.confetti-piece:nth-child(2) {
  animation: confetti-fly-2 0.7s ease forwards;
  background: var(--lavender);
}

.confetti-piece:nth-child(3) {
  animation: confetti-fly-3 0.7s ease forwards;
  background: var(--rose);
}

.confetti-piece:nth-child(4) {
  animation: confetti-fly-4 0.7s ease forwards;
  background: var(--peach);
}

.confetti-piece:nth-child(5) {
  animation: confetti-fly-5 0.7s ease forwards;
  background: var(--gold);
}

.shuffle-btn {
  display: block;
  margin: 0 auto;
}

/* --- Memory Wall / Polaroids --- */
#memories {
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 240, 246, 0.95) 0%, rgba(253, 237, 244, 0.9) 50%, rgba(248, 226, 236, 0.95) 100%),
    repeating-linear-gradient(45deg, rgba(244, 167, 185, 0.02) 0px, rgba(244, 167, 185, 0.02) 12px, transparent 12px, transparent 24px);
  padding: 5rem 0 6rem;
  position: relative;
  overflow: hidden;
}

#memories::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #F4A7B9, #FFD6BA, #E5D4EF, #F4A7B9);
  opacity: 0.6;
}

.memories-header-banner {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 1.4rem auto;
}

.memories-sub {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: #6C4456;
  margin-top: 0.4rem;
  line-height: 1.5;
}

.memories-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 2.8rem;
  flex-wrap: wrap;
}

.memories-shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFFDF9;
  border: 1.5px solid rgba(244, 167, 185, 0.6);
  color: #5C3246;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 14px rgba(92, 58, 74, 0.08);
}

.memories-shuffle-btn:hover {
  background: var(--rose);
  color: #1A0F18;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 22px rgba(244, 167, 185, 0.45);
}

.memories-counter-pill {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: #7A455C;
  background: rgba(244, 167, 185, 0.18);
  border: 1px dashed rgba(244, 167, 185, 0.5);
  padding: 7px 16px;
  border-radius: var(--radius-full);
}

.polaroid-grid {
  column-count: 3;
  column-gap: 2.2rem;
  padding: 0.8rem 0.5rem;
}

/* Authentic Polaroid Card with Washi Tape and Photographic Paper */
.polaroid {
  break-inside: avoid;
  background: #FFFDF9;
  padding: 13px 13px 18px 13px;
  box-shadow:
    0 12px 30px rgba(74, 38, 56, 0.13),
    0 2px 8px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  border-radius: 4px;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
  margin-bottom: 2.6rem;
  position: relative;
  cursor: pointer;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

/* Washi Tape Strip at the top of each polaroid */
.polaroid-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(var(--tape-rot, -1.2deg));
  width: 95px;
  height: 24px;
  background: var(--tape-color, rgba(244, 167, 185, 0.75));
  border-left: 2.5px dashed rgba(255, 255, 255, 0.55);
  border-right: 2.5px dashed rgba(255, 255, 255, 0.55);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(2px);
  border-radius: 2px;
  z-index: 4;
  opacity: 0.9;
  pointer-events: none;
}

/* Memory index chip on the polaroid */
.polaroid-num {
  position: absolute;
  top: 18px;
  right: 18px;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: rgba(46, 20, 36, 0.65);
  backdrop-filter: blur(4px);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  z-index: 3;
  letter-spacing: 0.04em;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.polaroid:hover .polaroid-num {
  opacity: 1;
  background: rgba(244, 167, 185, 0.9);
  color: #1A0F18;
}

.polaroid:hover {
  transform: translateY(-12px) rotate(0deg) scale(1.045);
  box-shadow:
    0 24px 55px rgba(92, 58, 74, 0.24),
    0 0 35px rgba(244, 167, 185, 0.4);
  z-index: 20;
}

.polaroid:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 6px;
}

.photo-placeholder {
  background: #20131D;
  border-radius: 3px;
  aspect-ratio: 4/5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.18);
}

.photo-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14) 0%, transparent 60%);
  pointer-events: none;
}

.photo-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 2px;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.polaroid:hover .photo-placeholder img {
  transform: scale(1.05);
}

/* Classic Polaroid Chin with rich handwriting */
.polaroid-chin {
  padding-top: 11px;
  text-align: center;
}

.polaroid-caption {
  position: static !important;
  font-family: var(--font-script, 'Dancing Script', cursive);
  font-size: 1.25rem;
  color: #261121; /* Rich dark espresso — high contrast on #FFFDF9 */
  text-align: center;
  margin: 0;
  line-height: 1.35;
  font-weight: 700;
  padding: 0 4px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

@media (max-width: 860px) {
  .polaroid-grid {
    column-count: 2;
    column-gap: 1.6rem;
  }
}

@media (max-width: 540px) {
  .polaroid-grid {
    column-count: 1;
    max-width: 380px;
    margin: 0 auto;
  }
}

/* Lightbox Scroll Lock */
html.lightbox-open,
body.lightbox-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(14, 8, 14, 0.94);
  z-index: 5000;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: max(1.2rem, env(safe-area-inset-top, 1.2rem)) max(1rem, env(safe-area-inset-right, 1rem)) max(1.2rem, env(safe-area-inset-bottom, 1.2rem)) max(1rem, env(safe-area-inset-left, 1rem));
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 167, 185, 0.4) transparent;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  background: transparent;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: min(94vw, 540px);
  width: 100%;
  margin: auto auto !important;
  align-self: center !important;
  text-align: center;
  animation: modal-appear 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
}

.lightbox-close {
  position: fixed;
  top: max(16px, calc(env(safe-area-inset-top, 0px) + 12px));
  right: max(16px, calc(env(safe-area-inset-right, 0px) + 12px));
  background: rgba(26, 15, 24, 0.88);
  border: 1.5px solid rgba(244, 167, 185, 0.45);
  color: #fff;
  font-size: 1.35rem;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-base), transform 0.2s ease;
  z-index: 5030;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.lightbox-close:hover {
  background: rgba(244, 167, 185, 0.45);
  transform: scale(1.08);
}

.lightbox-close:focus-visible {
  outline: 2px solid var(--gold);
}

/* Lightbox Previous / Next Navigation */
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(26, 15, 24, 0.88);
  border: 1.5px solid rgba(244, 167, 185, 0.45);
  color: #fff;
  width: 52px;
  height: 52px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 5010;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 14px rgba(244, 167, 185, 0.2);
  padding: 0;
}

.lightbox-nav svg {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.lightbox-nav:hover {
  background: rgba(244, 167, 185, 0.32);
  border-color: var(--rose, #f4a7b9);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(244, 167, 185, 0.4);
}

.lightbox-prev:hover svg {
  transform: translateX(-3px);
}

.lightbox-next:hover svg {
  transform: translateX(3px);
}

.lightbox-nav:focus-visible {
  outline: 2px solid var(--gold);
}

.lightbox-prev {
  left: max(1.2rem, calc((100vw - 600px) / 2 - 68px));
}

.lightbox-next {
  right: max(1.2rem, calc((100vw - 600px) / 2 - 68px));
}

.lightbox-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b4353;
  background: rgba(244, 167, 185, 0.18);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0;
  border: 1px solid rgba(244, 167, 185, 0.35);
}

.lightbox-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.75rem;
  gap: 12px;
}

.lightbox-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 167, 185, 0.18);
  border: 1px solid rgba(244, 167, 185, 0.35);
  color: #3b2839;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-save-btn:hover {
  background: var(--rose);
  color: #1A0F18;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244, 167, 185, 0.45);
}

.lightbox-save-btn:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .lightbox {
    padding: max(1rem, env(safe-area-inset-top, 1rem)) max(0.75rem, env(safe-area-inset-right, 0.75rem)) max(5.2rem, env(safe-area-inset-bottom, 5.2rem)) max(0.75rem, env(safe-area-inset-left, 0.75rem));
    align-items: center !important;
    justify-content: flex-start !important;
  }

  .lightbox-content {
    max-width: min(92vw, 420px);
    margin: 0 auto !important;
    align-self: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding-top: max(3rem, calc(env(safe-area-inset-top, 0px) + 2.2rem));
    padding-bottom: 2rem;
  }

  .lightbox-close {
    top: max(14px, calc(env(safe-area-inset-top, 0px) + 10px));
    right: max(14px, calc(env(safe-area-inset-right, 0px) + 10px));
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    font-size: 1.25rem;
  }

  .lightbox-nav {
    top: auto;
    bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 14px));
    transform: none;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    background: rgba(26, 15, 24, 0.92);
    border: 1.5px solid rgba(244, 167, 185, 0.5);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.75), 0 0 16px rgba(244, 167, 185, 0.35);
  }

  .lightbox-nav svg {
    width: 22px;
    height: 22px;
  }

  .lightbox-prev {
    left: calc(50% - 62px);
  }

  .lightbox-next {
    right: calc(50% - 62px);
  }

  .lightbox-nav:hover {
    transform: scale(1.06);
    background: rgba(244, 167, 185, 0.32);
  }

  .lightbox-nav:active {
    transform: scale(0.92);
    background: rgba(244, 167, 185, 0.45);
  }
}

/* --- Timeline Section --- */
#timeline {
  background: linear-gradient(180deg, var(--deep-bg2), var(--deep-bg3));
  color: #fff;
}

#timeline .section-title {
  color: var(--gold);
}

.timeline-container {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

/* Vertical center line */
.timeline-container::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, var(--rose), var(--lavender), var(--rose));
  transform-origin: top;
  opacity: 0.5;
}

.timeline-progress-line {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 2px;
  height: 0%;
  background: linear-gradient(to bottom, var(--rose), var(--lavender));
  z-index: 1;
  transition: height 0.3s ease;
}

.timeline-item {
  display: flex;
  justify-content: flex-end;
  padding-right: calc(50% + 2rem);
  margin-bottom: var(--space-2xl);
  position: relative;
}

.timeline-item:nth-child(even) {
  justify-content: flex-start;
  padding-right: 0;
  padding-left: calc(50% + 2rem);
}

.timeline-dot {
  position: absolute;
  left: 50%;
  top: 1.2rem;
  transform: translate(-50%, 0);
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--rose);
  border: 3px solid var(--deep-bg2);
  box-shadow: 0 0 0 3px var(--rose-30), 0 0 16px var(--rose-50);
  z-index: 2;
  transition: transform var(--transition-spring), box-shadow var(--transition-base);
}

.timeline-item:hover .timeline-dot {
  transform: translate(-50%, 0) scale(1.4);
  box-shadow: 0 0 0 5px var(--rose-30), 0 0 30px var(--rose-50);
}

.timeline-content {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(244, 167, 185, 0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 320px;
  transition: transform var(--transition-spring), box-shadow var(--transition-base);
}

.timeline-item:hover .timeline-content {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(244, 167, 185, 0.2);
}

.timeline-icon {
  font-size: 1.8rem;
  margin-bottom: var(--space-sm);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--rose);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
  display: block;
}

.timeline-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: var(--space-xs);
}

.timeline-desc {
  font-size: 0.9rem;
  color: rgba(255, 248, 245, 0.7);
  line-height: 1.6;
}

/* --- Stats Section --- */
#stats {
  background: var(--cream);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.stat-card {
  position: relative;
  background: rgba(255, 248, 245, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--rose-20, rgba(244, 167, 185, 0.2));
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-spring), box-shadow var(--transition-base);
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
      transparent 0%,
      rgba(244, 167, 185, 0.15) 40%,
      transparent 80%);
  background-size: 200% 100%;
  background-position: -200% 0;
  transition: background-position 0s;
  border-radius: inherit;
}

.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-rose-lg);
}

.stat-card:hover::after {
  background-position: 200% 0;
  transition: background-position 0.7s ease;
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--rose);
  display: block;
  margin-bottom: var(--space-xs);
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.7;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* --- Music Section --- */
#music {
  background: linear-gradient(135deg, rgba(201, 184, 232, 0.15), rgba(255, 248, 245, 1));
}

.music-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: start;
}

.music-player {
  background: linear-gradient(145deg, var(--deep-bg2), var(--deep-bg3));
  border: 1px solid rgba(244, 167, 185, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-dark);
}

.album-art {
  width: 150px;
  height: 150px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2b1828, #180d19);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(244, 167, 185, 0.25);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.album-art::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent);
  pointer-events: none;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.music-player.playing .album-art {
  transform: scale(1.04);
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.65),
    0 0 35px rgba(244, 167, 185, 0.55);
}

.vinyl-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #140b15;
  border: 3px solid rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.6);
  z-index: 2;
  pointer-events: none;
}

.vinyl-fallback-svg {
  color: rgba(244, 167, 185, 0.85);
  filter: drop-shadow(0 0 8px rgba(244, 167, 185, 0.4));
}

.track-info {
  text-align: center;
  margin-bottom: var(--space-lg);
  overflow: hidden;
  padding: 0 var(--space-sm);
}

.track-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  letter-spacing: 0.02em;
  transition: text-shadow var(--transition-base);
}

.music-player.playing .track-title {
  text-shadow: 0 0 14px rgba(244, 167, 185, 0.7);
}

.track-artist {
  font-size: 0.85rem;
  color: var(--rose);
  margin-top: 0.25rem;
}

/* Waveform visualizer */
.waveform {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 40px;
  margin-bottom: var(--space-md);
}

.bar {
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(to top, var(--rose), var(--lavender));
  height: 32px;
  transform: scaleY(0.25);
  transform-origin: bottom;
}

/* Progress */
.progress-container {
  margin: var(--space-md) 0 var(--space-lg);
  padding: 0 4px;
}

.progress-times {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 248, 245, 0.7);
  margin-bottom: 0.5rem;
}

.progress-bar-track {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: background 0.2s ease;
}

/* Invisible generous hit target for easy tapping & dragging on phone and desktop */
.progress-bar-track::before {
  content: '';
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: 0;
  right: 0;
}

.progress-bar-track:hover,
.progress-bar-track.dragging {
  background: rgba(255, 255, 255, 0.32);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #F4A7B9, #FFD6BA);
  border-radius: 999px;
  width: 0%;
  transition: width 0.08s linear;
  position: relative;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(244, 167, 185, 0.65);
}

.progress-bar-track.dragging .progress-bar-fill {
  transition: none !important;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: #FFFFFF;
  border: 2px solid #F4A7B9;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(244, 167, 185, 0.9), 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.progress-bar-track:hover .progress-bar-fill::after,
.progress-bar-track.dragging .progress-bar-fill::after {
  transform: translateY(-50%) scale(1.3);
  box-shadow: 0 0 18px rgba(244, 167, 185, 1), 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Controls */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  margin: var(--space-md) 0 var(--space-lg);
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(244, 167, 185, 0.25);
  color: rgba(255, 248, 245, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.ctrl-btn:hover {
  color: #fff;
  background: rgba(244, 167, 185, 0.28);
  border-color: rgba(244, 167, 185, 0.6);
  transform: scale(1.1);
}

.ctrl-btn:active {
  transform: scale(0.95);
}

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

.ctrl-btn.play-pause {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--rose), #e8809a);
  border: none;
  color: #fff;
  box-shadow: 0 0 26px rgba(244, 167, 185, 0.65);
}

.ctrl-btn.play-pause:hover {
  background: linear-gradient(135deg, #ff94ac, var(--rose));
  transform: scale(1.12);
  box-shadow: 0 0 36px rgba(244, 167, 185, 0.85);
}

.ctrl-btn.play-pause:active {
  transform: scale(0.96);
}

.ctrl-btn svg {
  display: block;
  pointer-events: none;
}

/* Playlist */
.playlist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 2.5rem;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  border-bottom: 1px solid var(--rose-15);
  cursor: pointer;
}

.playlist-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(244, 167, 185, 0.3);
  flex-shrink: 0;
}

.playlist-item:last-child {
  border-bottom: none;
}

.playlist-item:hover {
  background: rgba(244, 167, 185, 0.12);
  transform: translateX(4px);
}

.playlist-item.active {
  background: linear-gradient(90deg, rgba(244, 167, 185, 0.22), rgba(201, 184, 232, 0.08));
  border-left: 3px solid var(--rose);
}

.playlist-item:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 2px;
}

.playlist-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0.45;
  width: 1.5em;
  flex-shrink: 0;
}

.playlist-info {
  flex: 1;
  min-width: 0;
}

.playlist-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-artist {
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item.active .playlist-title {
  color: var(--rose);
  font-weight: 700;
}

.playlist-item.active .playlist-num {
  color: var(--rose);
  opacity: 1;
}

.playlist-track-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.55;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.playlist-item:hover .playlist-track-icon,
.playlist-item.active .playlist-track-icon {
  opacity: 1;
  color: var(--rose);
}

.playlist-track-icon .pl-icon-play {
  display: none;
}

.playlist-item:not(.active):hover .playlist-track-icon .pl-icon-note {
  display: none;
}

.playlist-item:not(.active):hover .playlist-track-icon .pl-icon-play {
  display: block;
}

/* Equalizer wave bars for active playing song */
.pl-bars {
  display: none;
  align-items: flex-end;
  gap: 2.5px;
  height: 14px;
}

.pl-bar {
  width: 3px;
  background: var(--rose);
  border-radius: 2px;
  animation: pl-equalizer 0.8s ease-in-out infinite alternate;
}

.pl-bar:nth-child(1) {
  height: 45%;
  animation-delay: 0.1s;
}

.pl-bar:nth-child(2) {
  height: 95%;
  animation-delay: 0.3s;
}

.pl-bar:nth-child(3) {
  height: 60%;
  animation-delay: 0.2s;
}

@keyframes pl-equalizer {
  0% {
    height: 20%;
  }

  100% {
    height: 100%;
  }
}

.playlist-item.active.is-playing .pl-bars {
  display: inline-flex;
}

.playlist-item.active.is-playing .pl-icon-note,
.playlist-item.active.is-playing .pl-icon-play {
  display: none;
}

/* --- Chat Section --- */
#chats {
  background: var(--deep-bg3);
}

#chats .section-title {
  color: var(--gold);
}

.chat-hint {
  text-align: center;
  font-size: 0.95rem;
  color: rgba(255, 248, 245, 0.7);
  margin-top: -1rem;
  margin-bottom: var(--space-xl);
}

.chat-window {
  max-width: 520px;
  margin: 0 auto;
  background: rgba(28, 16, 28, 0.95);
  border: 2px solid rgba(244, 167, 185, 0.35);
  border-radius: 36px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 45px rgba(244, 167, 185, 0.15);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Phone status bar */
.chat-phone-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.3);
  letter-spacing: 0.3px;
}

.chat-notch {
  width: 80px;
  height: 14px;
  background: #110813;
  border-radius: 10px;
}

.chat-header {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-back {
  font-size: 1.25rem;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
}

.chat-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--rose);
}

.chat-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #1c101c;
}

.chat-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status {
  font-size: 0.75rem;
  color: var(--rose);
}

.chat-header-actions {
  display: flex;
  gap: 6px;
}

.chat-action-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #fff;
  padding: 6px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
}

.chat-action-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Pinned message */
.chat-pinned-banner {
  background: rgba(244, 167, 185, 0.12);
  border-left: 3px solid var(--rose);
  border-bottom: 1px solid rgba(244, 167, 185, 0.18);
  padding: 10px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255, 248, 245, 0.95);
}

.pinned-icon {
  font-size: 1rem;
}

.pinned-text strong {
  color: var(--gold);
}

/* Scroll area */
.chat-scroll-outer {
  height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: var(--space-md) var(--space-md);
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 167, 185, 0.4) transparent;
}

.chat-scroll-outer::-webkit-scrollbar {
  width: 6px;
  background: transparent;
}

.chat-scroll-outer::-webkit-scrollbar-track {
  background: transparent;
}

.chat-scroll-outer::-webkit-scrollbar-thumb {
  background: rgba(244, 167, 185, 0.4);
  border-radius: 10px;
}

.chat-scroll-outer::-webkit-scrollbar-thumb:hover {
  background: var(--rose);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-date-badge {
  align-self: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 0.7rem;
  letter-spacing: 0.8px;
  font-weight: 600;
  color: rgba(255, 248, 245, 0.7);
  text-transform: uppercase;
  margin: 12px 0 6px;
}

.chat-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.chat-bubble-row.left {
  justify-content: flex-start;
}

.chat-bubble-row.right {
  justify-content: flex-end;
}

.chat-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--rose);
  margin-bottom: 2px;
}

.chat-bubble {
  max-width: 78%;
  padding: 0.75rem 1.1rem;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
}

.chat-bubble.left {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-bubble.right {
  background: linear-gradient(135deg, #F4A7B9 0%, #E8809A 100%);
  color: #2D1B2E;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(244, 167, 185, 0.35);
}

.chat-reply-quote {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.25);
  border-left: 2px solid var(--rose);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  display: block;
}

.chat-reel-card {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(244, 167, 185, 0.35);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  max-width: 290px;
}

.chat-reel-card:hover {
  background: rgba(244, 167, 185, 0.2);
  transform: translateY(-2px);
}

.chat-reel-icon {
  font-size: 1.6rem;
}

.chat-reel-author {
  font-size: 0.75rem;
  color: var(--rose);
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-reel-caption {
  font-weight: 500;
  color: #FFF;
  font-size: 0.88rem;
  line-height: 1.3;
}

/* Instagram comments showcase */
.chat-comments-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(244, 167, 185, 0.3);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 10px 0;
  width: 100%;
  box-sizing: border-box;
}

.chat-comments-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-comment-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: flex-start;
}

.chat-comment-item:last-child {
  margin-bottom: 0;
}

.chat-comment-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--rose);
  object-fit: cover;
  flex-shrink: 0;
}

.chat-comment-user {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.chat-comment-text {
  font-size: 0.88rem;
  color: rgba(255, 248, 245, 0.95);
  line-height: 1.35;
}

/* Chat Footer Input */
.chat-footer {
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 16px;
}

.chat-input-pill {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-input-placeholder {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.9rem;
  flex: 1;
}

.chat-input-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.15rem;
}

.chat-heart-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-heart-btn:hover {
  transform: scale(1.3);
}

.chat-heart-btn:active {
  transform: scale(0.9);
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* --- Petal Game --- */
#game {
  background: linear-gradient(180deg, var(--deep-bg), var(--deep-bg2));
  padding: var(--space-3xl) 0;
}

#game .section-title {
  color: var(--rose);
}

.game-subtitle {
  text-align: center;
  color: rgba(255, 248, 245, 0.6);
  font-style: italic;
  margin-top: -var(--space-2xl);
  margin-bottom: var(--space-xl);
}

.game-ui {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.petal-counter {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--rose);
  background: rgba(244, 167, 185, 0.12);
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--rose-30);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 500px;
  /* native cursor */
  border-radius: var(--radius-lg);
  touch-action: pan-y;
}

/* Petal game message modal */
.message-reveal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(26, 15, 24, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.message-reveal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.message-reveal-card {
  background: linear-gradient(135deg, rgba(244, 167, 185, 0.15), rgba(201, 184, 232, 0.15));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(244, 167, 185, 0.4);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: modal-appear 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.message-reveal-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.message-reveal-text {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-style: italic;
  color: rgba(255, 248, 245, 0.95);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

.message-reveal-close {
  background: var(--rose);
  color: #fff;
  border: none;
  padding: 0.65rem 2rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  /* native cursor */
  transition: all var(--transition-base);
}

.message-reveal-close:hover {
  background: #e8809a;
}

.message-reveal-close:focus-visible {
  outline: 2px solid var(--gold);
}

/* All-petals-found message */
.all-found-msg {
  display: none;
  text-align: center;
  padding: var(--space-xl);
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-style: italic;
  animation: fadeInUp 0.8s ease;
}

.all-found-msg.show {
  display: block;
}

/* --- Guestbook Section --- */
#guestbook {
  background: var(--cream);
}

.guestbook-counter {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.65;
  margin-bottom: var(--space-xl);
}

.guestbook-form {
  max-width: 480px;
  margin: 0 auto var(--space-2xl);
  background: rgba(255, 248, 245, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--rose-15);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid var(--rose-15);
  border-radius: var(--radius-md);
  font-size: 16px;
  /* 16px mandatory to prevent iOS Safari auto-zoom */
  color: var(--text);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px var(--rose-15);
}

.form-group input:focus-visible,
.form-group textarea:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 2px;
}

.form-group textarea {
  min-height: 100px;
  font-family: var(--font-body);
}

.notes-grid {
  column-count: 3;
  column-gap: var(--space-lg);
  max-width: 960px;
  margin: 0 auto;
}

.note-card {
  break-inside: avoid;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  position: relative;
  cursor: default;
  box-shadow: var(--shadow-card);
  transform: rotate(var(--rot, 0deg));
  transition: transform var(--transition-spring), box-shadow var(--transition-base);
}

.note-card:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: var(--shadow-rose-lg);
}

.note-name {
  font-family: var(--font-script);
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: var(--space-xs);
  display: block;
}

.note-message {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.note-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text);
  opacity: 0.5;
}

.note-delete-btn {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: rgba(244, 167, 185, 0.3);
  border: none;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
  /* native cursor */
  display: none;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-base);
}

.note-delete-btn.visible {
  display: flex;
}

.note-delete-btn:hover {
  background: rgba(244, 167, 185, 0.7);
}

/* --- Footer --- */
footer {
  background: var(--deep-bg);
  padding: var(--space-2xl) var(--space-md) max(5.5rem, calc(env(safe-area-inset-bottom, 0px) + 4.5rem));
  text-align: center;
  border-top: 1px solid rgba(244, 167, 185, 0.1);
}

.footer-text {
  font-family: var(--font-script);
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: var(--space-sm);
}

.footer-sub {
  font-size: 0.8rem;
  color: rgba(255, 248, 245, 0.3);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.footer-rose {
  display: inline-block;
  font-size: 2rem;
  animation: heartbeat 2s ease-in-out infinite;
  margin: var(--space-sm) 0;
}

/* ============================================
   FUN Q&A SECTION — Madam Ji
   ============================================ */
.qna-section {
  position: relative;
  padding: clamp(5rem, 8vw, 7.5rem) 0;
  background: radial-gradient(circle at 50% 30%, rgba(244, 167, 185, 0.12) 0%, transparent 70%);
  overflow: hidden;
}

.qna-card {
  max-width: 660px;
  margin: 0 auto;
  background: #FFFDFB;
  border: 1.5px solid rgba(244, 167, 185, 0.45);
  border-radius: var(--radius-xl);
  padding: 3rem 2.2rem;
  text-align: center;
  position: relative;
  box-shadow: 0 16px 45px rgba(92, 58, 74, 0.12), 0 2px 10px rgba(244, 167, 185, 0.1);
}

.qna-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8A4B64;
  background: rgba(244, 167, 185, 0.22);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
  border: 1px solid rgba(244, 167, 185, 0.45);
  font-weight: 700;
}

.qna-heading {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: #D45D79;
  margin-bottom: 0.6rem;
  line-height: 1.25;
}

.qna-sub {
  color: #7A5366;
  font-size: 1rem;
  margin-bottom: 1.8rem;
}

.qna-question-box {
  background: #FFF5F8;
  border: 1px solid rgba(244, 167, 185, 0.35);
  border-left: 4px solid #F4A7B9;
  border-radius: var(--radius-md);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2.2rem;
  box-shadow: inset 0 1px 3px rgba(244, 167, 185, 0.08);
}

.qna-prompt {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  color: #4A2B3B;
  font-weight: 600;
  line-height: 1.5;
}

/* Playground area where NO button teleports within bounds */
.qna-playground {
  position: relative;
  width: 100%;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
  margin-bottom: 1.2rem;
}

.qna-btn {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.85rem 1.8rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
}

.qna-btn-yes {
  background: linear-gradient(135deg, #F4A7B9, #e8809a);
  color: #1A0F18;
  border: 2px solid transparent;
  box-shadow: 0 6px 25px rgba(244, 167, 185, 0.45);
  z-index: 30;
}

.qna-btn-yes:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 30px rgba(244, 167, 185, 0.65);
}

.qna-btn-no {
  background: #FFFDFB;
  color: #5C3A4A;
  border: 2px solid #E8809A;
  position: relative;
  z-index: 20;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(92, 58, 74, 0.12), 0 0 0 1px rgba(232, 128, 154, 0.2);
}

.qna-btn-no:hover {
  border-color: #D45D79;
  background: #FFF5F8;
  box-shadow: 0 6px 20px rgba(232, 128, 154, 0.3);
}

.qna-btn-no.dodging {
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.qna-hint {
  font-size: 0.88rem;
  color: #8C6578;
  font-style: italic;
  font-weight: 500;
  opacity: 0.9;
}

/* Victory / Success card */
.qna-success {
  position: absolute;
  inset: 0;
  background: rgba(26, 12, 22, 0.97);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  z-index: 50;
  animation: modal-appear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.qna-success.hidden {
  display: none;
}

.qna-success-inner {
  max-width: 480px;
}

.qna-success-emoji {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 0.8rem;
  animation: bounce 2s infinite ease-in-out;
}

.qna-success-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

.qna-success-text {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--cream);
  margin-bottom: 1.5rem;
}

.qna-success-seal {
  font-family: var(--font-script);
  font-size: 1.45rem;
  color: var(--rose);
  margin-bottom: 1.5rem;
}

.qna-replay-btn {
  background: transparent;
  border: 1px dashed rgba(244, 167, 185, 0.45);
  color: var(--rose);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.qna-replay-btn:hover {
  background: rgba(244, 167, 185, 0.15);
  border-color: var(--rose);
  transform: translateY(-1px);
}

/* ============================================
   DEEP MOBILE & TOUCH OPTIMIZATION
   ============================================ */

/* Touch-specific adaptations (phones, tablets, touchscreens) */
@media (hover: none) and (pointer: coarse) {

  *,
  *::before,
  *::after,
  html,
  body {
    cursor: auto !important;
  }

  .custom-cursor,
  .cursor-ring,
  .cursor-sparkle {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  a,
  button,
  .btn,
  .flip-card,
  .polaroid,
  .playlist-item,
  .nav-toggle,
  .scroll-top-btn,
  .bgm-toggle-btn,
  .openwhen-card,
  .scrapbook-tab,
  .scrapbook-nav-btn {
    cursor: pointer !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Instant tactile feedback on mobile taps */
  .btn:active,
  .bgm-toggle-btn:active,
  .ctrl-btn:active,
  .nav-toggle:active {
    transform: scale(0.95) !important;
  }

  /* Neutralize sticky hover states on mobile touchscreens */
  .polaroid:hover {
    transform: rotate(var(--rot, 0deg)) !important;
    box-shadow: 0 4px 16px rgba(92, 58, 74, 0.12) !important;
  }

  .polaroid:active {
    transform: scale(0.98) !important;
  }

  .stat-card:hover {
    transform: none !important;
  }

  .ctrl-btn:hover {
    transform: none !important;
  }

  .scroll-top-btn:hover {
    transform: none !important;
  }
}

/* Tablet & Intermediate screens */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .reasons-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .polaroid-grid,
  .notes-grid {
    column-count: 2;
  }

  .music-inner {
    grid-template-columns: 1fr;
  }
}

/* Mobile Screens (iPhones, Android, Foldables - <= 768px) */
@media (max-width: 768px) {

  /* Containers & Section Spacing */
  .container {
    padding-left: max(1rem, env(safe-area-inset-left, 1rem));
    padding-right: max(1rem, env(safe-area-inset-right, 1rem));
  }

  section {
    padding-top: clamp(2.5rem, 5vh, 3.5rem);
    padding-bottom: clamp(4.5rem, 9vh, 6rem);
  }

  .section-title {
    font-size: clamp(1.8rem, 7vw, 2.3rem);
    margin-bottom: var(--space-md);
  }

  /* Hero scroll hint placed safely above floating controls on mobile */
  .hero-scroll-hint {
    bottom: max(3.8rem, calc(env(safe-area-inset-bottom, 0px) + 3.2rem));
  }

  /* Navigation Drawer */
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(26, 15, 24, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    z-index: calc(var(--z-nav) - 1);
    padding: max(4rem, calc(env(safe-area-inset-top, 0px) + 2rem)) 1.5rem max(2rem, calc(env(safe-area-inset-bottom, 0px) + 1.5rem));
    animation: fadeIn 0.25s ease forwards;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: inline-block;
    width: 80%;
    max-width: 260px;
    font-size: 1.25rem;
    font-family: var(--font-heading);
    color: var(--cream);
    padding: 0.65rem 1rem;
    border: 1px solid rgba(244, 167, 185, 0.2);
    border-radius: var(--radius-full);
  }

  .nav-links a:hover,
  .nav-links a:active {
    background: rgba(244, 167, 185, 0.25);
    color: var(--rose);
  }

  /* Hero Section */
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .hero-card-wrapper {
    order: 2;
    margin-top: 0.5rem;
  }

  .hero-card {
    padding: 1.4rem 1.1rem;
    max-width: 340px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
  }

  .hero-card-quote {
    font-size: 1.02rem;
    line-height: 1.55;
    margin-bottom: 0.75rem;
  }

  .hero-card-sig {
    font-size: 1.15rem;
  }

  .hero-avatar-wrap {
    width: 110px;
    height: 110px;
    margin: 0 auto 0.75rem;
  }

  .hero-avatar-img {
    width: 110px;
    height: 110px;
  }

  .hero-name {
    font-size: clamp(2.8rem, 14vw, 4.5rem);
    letter-spacing: 0.08em;
  }

  .hero-label {
    font-size: 1.25rem;
  }

  .hero-text {
    min-height: auto;
  }

  #tagline {
    font-size: 1.05rem;
    min-height: 4.2rem;
    max-height: 4.2rem;
  }

  .hero-cta {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta .btn {
    flex: 0 1 auto;
    min-height: 46px;
    padding: 0.85rem 1.6rem;
    border-radius: 9999px;
    font-size: clamp(0.85rem, 2.8vw, 0.95rem);
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .floating-hearts {
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
  }

  /* Love letter */
  .envelope-svg {
    width: min(260px, 80vw);
  }

  .letter-paper {
    padding: 1.6rem 1.1rem;
    font-size: 0.96rem;
    line-height: 25px;
  }

  .letter-header-row {
    padding-right: 65px;
    margin-bottom: 1.1rem;
  }

  .letter-content {
    font-size: 0.96rem;
    line-height: 1.6;
  }

  .wax-seal-svg {
    width: 60px;
    height: 60px;
  }

  /* 12 Reasons */
  .reasons-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .flip-card {
    height: clamp(170px, 24vh, 200px);
  }

  .flip-card-number {
    font-size: 2.8rem;
  }

  .flip-card-text {
    font-size: 1rem;
    padding: 0 0.5rem;
  }

  /* Memory Wall Polaroids (2 neat columns on phones!) */
  .polaroid-grid {
    column-count: 2;
    column-gap: 0.75rem;
  }

  .polaroid {
    padding: 6px 6px 10px 6px;
    margin-bottom: 0.75rem;
  }

  .polaroid-caption {
    font-size: 0.82rem;
    margin-top: 0.35rem;
  }

  /* Timeline */
  .timeline-container::before {
    left: 20px;
  }

  .timeline-progress-line {
    left: 20px;
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    justify-content: flex-start;
    padding-left: 50px;
    padding-right: 0;
    width: 100%;
  }

  .timeline-dot {
    left: 20px;
    width: 14px;
    height: 14px;
  }

  .timeline-content {
    width: 100%;
    padding: 1.1rem;
  }

  /* Bonding Stats (clean 2x2 grid on phones) */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .stat-card {
    padding: 1.1rem 0.6rem;
  }

  .stat-number {
    font-size: clamp(1.8rem, 7vw, 2.5rem);
  }

  .stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
  }

  /* Music Player */
  .music-player {
    padding: 1.5rem 1.1rem;
  }

  .album-art {
    width: 105px;
    height: 105px;
  }

  .track-title {
    font-size: 1.15rem;
  }

  .track-artist {
    font-size: 0.85rem;
  }

  .ctrl-btn {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .ctrl-btn.play-pause {
    width: 50px;
    height: 50px;
    font-size: 1.35rem;
  }

  .playlist-item {
    padding: 0.75rem 0.75rem;
    min-height: 48px;
  }

  /* Chat Reel */
  .chat-window {
    max-width: 100%;
    padding: 0;
    border-radius: 28px;
  }

  .chat-scroll-outer {
    height: clamp(280px, 48vh, 380px);
    padding: 0.75rem 0.6rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .chat-bubble {
    max-width: 88%;
    font-size: 0.92rem;
    padding: 0.6rem 0.85rem;
  }

  /* Petal Game */
  #game-canvas {
    height: 320px;
  }

  .message-reveal-card {
    width: 90vw;
    max-width: 360px;
    padding: 1.6rem 1.2rem;
  }

  .message-reveal-text {
    font-size: 1.1rem;
  }

  /* Q&A section on mobile */
  .qna-card {
    padding: 2.2rem 1.2rem;
  }

  .qna-heading {
    font-size: 1.65rem;
  }

  .qna-prompt {
    font-size: 1.15rem;
  }

  .qna-playground {
    min-height: 220px;
    gap: 1.2rem;
  }

  .qna-btn {
    font-size: 0.95rem;
    padding: 0.75rem 1.4rem;
  }

  /* Guestbook */
  .guestbook-form {
    padding: 1.3rem 1.1rem;
  }

  .notes-grid {
    column-count: 1;
  }

  .note-card {
    padding: 1.1rem;
  }

  /* Lightbox on mobile */
  .lightbox-content {
    max-width: min(92vw, 420px);
    margin: 0 auto !important;
    align-self: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .lightbox-close {
    top: max(14px, calc(env(safe-area-inset-top, 0px) + 10px));
    right: max(14px, calc(env(safe-area-inset-right, 0px) + 10px));
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
  }
}

/* Compact phones (iPhone SE, Galaxy Mini - <= 400px) */
@media (max-width: 400px) {
  .hero-name {
    font-size: 2.6rem;
  }

  .polaroid-grid {
    column-count: 1;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.9rem 0.4rem;
  }

  .stat-number {
    font-size: 1.65rem;
  }

  .hero-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta .btn {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-height: 46px;
    padding: 0.85rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.9rem;
    white-space: normal;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
  }
}

/* Accessibility: 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;
  }
}