:root {
  --bg-gradient: linear-gradient(135deg, #fff5f5 0%, #fed7e2 50%, #fce7f3 100%);
  --primary-rose: #e11d48;
  --rose-glow: rgba(225, 29, 72, 0.25);
  --soft-pink: #f43f5e;
  --deep-wine: #881337;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(244, 63, 94, 0.16);
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-hand: 'Caveat', cursive;
  --shadow-sm: 0 4px 14px rgba(225, 29, 72, 0.08);
  --shadow-md: 0 10px 25px -3px rgba(225, 29, 72, 0.12);
  --shadow-lg: 0 20px 35px -5px rgba(225, 29, 72, 0.18);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

#heartCanvas, #confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

#confettiCanvas {
  z-index: 9999;
}

/* Welcome Overlay (Guaranteed Instant Audio on Open) */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #fff1f2 0%, #fecdd3 60%, #fda4af 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: pointer;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s ease;
}

.welcome-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-box {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(225, 29, 72, 0.2);
  border-radius: 28px;
  padding: 36px 24px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 45px rgba(225, 29, 72, 0.25);
  animation: floatBox 3s ease-in-out infinite;
}

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

.welcome-heart-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: heartPulse 1.5s infinite;
}

.welcome-badge {
  display: inline-block;
  background: #ffe4e6;
  color: var(--deep-wine);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.welcome-name {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--deep-wine);
  margin-bottom: 6px;
}

.welcome-note {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.welcome-open-btn {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: white;
  border: none;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 50px;
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.35);
  cursor: pointer;
  animation: pulseBtn 2s infinite;
}

@keyframes pulseBtn {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 22px rgba(225, 29, 72, 0.35); }
  50% { transform: scale(1.04); box-shadow: 0 12px 28px rgba(225, 29, 72, 0.45); }
}

.mobile-wrapper {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 60px;
  position: relative;
  z-index: 2;
}

/* Music Pill */
.music-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(225, 29, 72, 0.16);
  border-radius: 50px;
  padding: 8px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.music-icon {
  font-size: 1.2rem;
  background: #ffe4e6;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  animation: spinSlow 8s linear infinite;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.music-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.music-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--deep-wine);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.play-indicator {
  background: var(--primary-rose);
  color: white;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.play-indicator:hover {
  background: var(--soft-pink);
  transform: scale(1.05);
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 14px 8px 28px;
}

.bday-badge {
  display: inline-block;
  background: #ffe4e6;
  color: var(--deep-wine);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 30px;
  border: 1px solid rgba(225, 29, 72, 0.2);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.15rem;
  font-weight: 700;
  color: var(--deep-wine);
  line-height: 1.25;
  margin-bottom: 12px;
}

.highlight-name {
  color: var(--primary-rose);
  position: relative;
  display: inline-block;
}

.highlight-name::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 100%;
  height: 8px;
  background: rgba(244, 63, 94, 0.22);
  z-index: -1;
  border-radius: 4px;
}

.heart-pulse {
  display: inline-block;
  animation: heartBeat 1.4s infinite;
}

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

.hero-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto 18px;
}

.scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--primary-rose);
  font-weight: 600;
}

.arrow-down {
  font-size: 1.1rem;
  animation: bounceDown 1.5s infinite;
}

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

/* Integrated Story & Timeline */
.story-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 40px;
}

.story-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 22px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.story-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.story-text p {
  font-size: 0.95rem;
  color: #374151;
  line-height: 1.75;
  margin-bottom: 12px;
}

.story-text p:last-child {
  margin-bottom: 0;
}

.story-text .greeting {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--deep-wine);
}

/* Embedded Timeline Node inside Story */
.inline-timeline-node {
  background: rgba(254, 242, 242, 0.75);
  border: 1px dashed rgba(225, 29, 72, 0.25);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--deep-wine);
  letter-spacing: 0.3px;
}

.today-badge {
  color: var(--primary-rose);
  font-size: 0.8rem;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  position: relative;
}

.sender-name {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  margin-bottom: 3px;
  color: var(--deep-wine);
}

.chat-time {
  display: block;
  font-size: 0.65rem;
  color: #6b7280;
  text-align: right;
  margin-top: 4px;
}

.om-bubble {
  background: #dcf8c6;
  border-top-left-radius: 2px;
  color: #064e3b;
  align-self: flex-start;
  width: 90%;
}

.nye-bubble {
  background: #ffffff;
  border-top-right-radius: 2px;
  color: #1f2937;
  border: 1px solid rgba(0,0,0,0.06);
  align-self: flex-start;
  width: 95%;
}

.highlighted-bubble {
  border: 1.5px solid var(--primary-rose);
  background: #fff1f2;
}

.today-bubble {
  background: linear-gradient(135deg, var(--deep-wine) 0%, var(--primary-rose) 100%);
  color: white;
  text-align: center;
  width: 100%;
  padding: 14px;
}

.today-bubble .sender-name {
  color: #fbcfe8;
}

.today-bubble p {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.memory-caption {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 2px;
}

.signoff-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(225, 29, 72, 0.2);
}

.native-sign {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-rose);
  margin-bottom: 2px !important;
}

.written-by {
  font-family: var(--font-hand);
  font-size: 1.65rem;
  color: var(--deep-wine);
}

/* Stats Section */
.stats-section {
  margin-bottom: 40px;
}

.section-badge {
  display: inline-block;
  background: #ffe4e6;
  color: var(--deep-wine);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  color: var(--deep-wine);
  margin-bottom: 4px;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-big {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(254, 226, 226, 0.8) 100%);
  border-color: rgba(225, 29, 72, 0.3);
}

.love-card {
  background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);
}

.stat-icon {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--deep-wine);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stats-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 14px;
}

/* Reasons Flip Cards */
.reasons-section {
  margin-bottom: 38px;
}

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

.reason-card {
  perspective: 1000px;
  height: 150px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

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

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
}

.card-front {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-emoji {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--deep-wine);
}

.tap-label {
  font-size: 0.65rem;
  color: var(--primary-rose);
  margin-top: 6px;
  font-weight: 600;
}

.card-back {
  background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);
  color: var(--deep-wine);
  transform: rotateY(180deg);
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 500;
}

/* Celebrate Section */
.celebrate-section {
  margin-bottom: 32px;
  text-align: center;
}

.celebrate-card {
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 24px 18px;
  box-shadow: var(--shadow-md);
}

.celebrate-card h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--deep-wine);
  margin-bottom: 6px;
}

.celebrate-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.magic-bday-btn {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: white;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  max-width: 320px;
}

.magic-bday-btn:active {
  transform: scale(0.96);
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.25);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 20px 10px 10px;
  border-top: 1px dashed rgba(225, 29, 72, 0.2);
}

.footer-quote {
  font-size: 0.82rem;
  color: var(--deep-wine);
  font-style: italic;
  margin-bottom: 10px;
}

.footer-love {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer-code {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-rose);
  margin-top: 6px;
}
