/* ============================================================
   THEME / CUSTOM COLOURS
   ------------------------------------------------------------
   These CSS variables control the whole palette.
   ============================================================ */
:root {
  --bg: #0a1026;
  --bg-2: #111a3a;
  --white: #f4f6ff;
  --muted: #b7c0e0;
  --gold: #f5c66b;
  --gold-soft: rgba(245, 198, 107, 0.16);
  --lavender: #a78bfa;
  --lavender-soft: rgba(167, 139, 250, 0.16);
  --glass: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 22px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--white);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .hundred-big, .counter-number, .final-big {
  font-family: "Playfair Display", Georgia, serif;
}

/* Background canvas */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Confetti layer on top of everything (below fixed UI controls) */
#confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}

/* ============================================================
   SCREENS & LAYOUT
   ============================================================ */
.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.opening-inner,
.reveal-inner,
.card,
.counter-card,
.timeline,
.memories-head,
.gallery,
.fun-card,
.gift-inner,
.final-inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

/* ============================================================
   ENTRANCE ANIMATIONS
   ============================================================ */
.fade-up {
  opacity: 0;
  transform: translateY(26px);
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cell-hidden {
  opacity: 0 !important;
  transform: translateY(26px) !important;
}

/* Flash/glow overlay when celebration starts */
body.celebrating::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 20%, rgba(245, 198, 107, 0.18) 70%, rgba(0,0,0,0.2));
  animation: celebrateFlash 1.5s ease forwards;
}

@keyframes celebrateFlash {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.slide-scale {
  animation: slideScale 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes slideScale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* Scroll reveal (used for timeline / gallery items) */
.reveal-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   OPENING SCREEN
   ============================================================ */
.opening-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.opening-line {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  color: var(--white);
}

.hero-100 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: slideScale 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hundred-big {
  font-size: clamp(6rem, 30vw, 11rem);
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold), #fff, var(--lavender));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(245, 198, 107, 0.45));
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 22px rgba(245,198,107,0.35)); }
  50% { filter: drop-shadow(0 0 44px rgba(245,198,107,0.6)); }
}

.hundred-sub {
  color: var(--muted);
  font-size: clamp(1rem, 4vw, 1.2rem);
  max-width: 320px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn {
  border: none;
  border-radius: 60px;
  padding: 15px 34px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease;
  outline: none;
  min-height: 52px;
}

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

.btn-glow {
  background: linear-gradient(135deg, var(--gold), #e9b860);
  color: #241a04;
  box-shadow: 0 10px 30px rgba(245, 198, 107, 0.35);
}

.btn-glow:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 38px rgba(245, 198, 107, 0.5);
}

.btn-glow:active {
  transform: scale(0.97);
}

.btn-ghost {
  background: var(--glass);
  color: var(--white);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.10);
  transform: translateY(-2px);
}

.btn-ghost:active {
  transform: scale(0.97);
}

.btn-sparkle {
  display: inline-block;
  margin-left: 6px;
}

/* ============================================================
   MUSIC CONTROL
   ============================================================ */
.music-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  border-radius: 60px;
  padding: 10px 16px;
  color: var(--white);
  font-size: 0.9rem;
  transition: background 0.3s ease;
}

.music-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.music-dot {
  color: var(--gold);
  font-size: 1.2rem;
  animation: musicBounce 1.4s ease-in-out infinite;
}

.music-toggle.playing .music-dot {
  animation: musicBounce 1.4s ease-in-out infinite;
}

.music-toggle.muted .music-dot {
  animation: none;
  opacity: 0.5;
}

@keyframes musicBounce {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

/* ============================================================
   REVEAL SCREEN
   ============================================================ */
.reveal-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.big100-wrap {
  width: 220px;
  height: 220px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.big100-circle {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 2px solid var(--gold-soft);
  position: relative;
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.06); opacity: 1; }
}

.big100-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", serif;
  font-size: 5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), #fff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 28px rgba(245, 198, 107, 0.5));
}

.reveal-title {
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 700;
}

.reveal-text {
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 400;
}

.reveal-text-more {
  color: var(--muted);
  max-width: 420px;
  font-size: 1rem;
}

/* ============================================================
   CARDS / MESSAGE
   ============================================================ */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 24px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.section-title {
  font-size: clamp(1.7rem, 6.5vw, 2.6rem);
  font-weight: 700;
  margin-bottom: 18px;
}

.section-sub {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 1rem;
}

.message-body {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--muted);
  font-size: 1.05rem;
}

.message-body p:first-child {
  color: var(--white);
}

.big-love {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  color: var(--gold) !important;
  text-align: center;
  margin: 6px 0;
}

.closing {
  color: var(--muted);
}

/* ============================================================
   COUNTER
   ============================================================ */
.counter-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.counter-number {
  font-size: clamp(6rem, 26vw, 10rem);
  font-weight: 700;
  line-height: 1.05;
  background: linear-gradient(135deg, var(--gold), #fff, var(--lavender));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.counter-label {
  font-size: 1.4rem;
  letter-spacing: 6px;
  color: var(--muted);
  margin-top: 6px;
}

.counter-tagline {
  margin-top: 18px;
  font-size: 1.2rem;
  color: var(--gold);
  font-weight: 600;
}

.counter-card.glowing .counter-number {
  filter: drop-shadow(0 0 34px rgba(245, 198, 107, 0.7));
  animation: glowBurst 1.2s ease;
}

@keyframes glowBurst {
  0% { filter: drop-shadow(0 0 10px rgba(245,198,107,0.2)); }
  30% { filter: drop-shadow(0 0 60px rgba(245,198,107,0.9)); }
  100% { filter: drop-shadow(0 0 34px rgba(245,198,107,0.7)); }
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 28px;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 20px;
  bottom: 40px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold), var(--lavender));
  opacity: 0.35;
}

.tl-item {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  margin-left: 0;
  position: relative;
}

.tl-dot {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #e9b860);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #241a04;
  font-size: 0.95rem;
  box-shadow: 0 0 18px rgba(245, 198, 107, 0.3);
}

.tl-body {
  flex: 1;
}

.tl-day {
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: var(--gold);
  font-weight: 600;
}

.tl-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.tl-text {
  color: var(--white);
  font-size: 1.05rem;
}

/* ============================================================
   GALLERY
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.gallery-item {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  background: linear-gradient(135deg, var(--bg-2), #1a2450);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.gallery-item img,
.gallery-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--bg-2), #1a2450);
}

.gallery-placeholder .ph-emoji {
  font-size: 2rem;
}

.gallery-placeholder .ph-label {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0 12px;
  text-align: center;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 8, 20, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeUp 0.3s ease;
}

.lightbox img {
  max-width: 92vw;
  max-height: 84vh;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 1.3rem;
}

/* ============================================================
   FUN SECTION
   ============================================================ */
.fun-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 22px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.fun-reveal {
  margin-top: 22px;
}

.fun-question {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 22px;
  font-family: "Playfair Display", serif;
}

.fun-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.fun-chip {
  background: var(--lavender-soft);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: 40px;
  padding: 12px 20px;
  font-size: 1rem;
  animation: popIn 0.5s ease backwards;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   GIFT BOX
   ============================================================ */
.gift-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.gift-box {
  width: 180px;
  height: 180px;
  position: relative;
  margin: 10px 0 20px;
  cursor: pointer;
}

.gift-lid {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7rem;
  z-index: 2;
  transition: transform 0.5s ease;
}

.gift-body {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 100px;
  background: linear-gradient(135deg, var(--gold), #e9b860);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(245, 198, 107, 0.4);
  animation: giftGlow 2.5s ease-in-out infinite;
}

@keyframes giftGlow {
  0%, 100% { box-shadow: 0 10px 30px rgba(245,198,107,0.3); }
  50% { box-shadow: 0 10px 40px rgba(245,198,107,0.6); }
}

.gift-box.opened .gift-lid {
  transform: translateX(-50%) translateY(-30px) rotate(-12deg);
}

.gift-card-wrap {
  width: 100%;
  max-width: 460px;
}

.gift-card {
  background: linear-gradient(160deg, #fff, #fdf6e8);
  color: #3a2f12;
  border-radius: 20px;
  padding: 30px 26px;
  text-align: left;
  box-shadow: var(--shadow);
}

.gift-card p {
  margin-bottom: 12px;
  line-height: 1.7;
}

.gift-dear {
  font-family: "Playfair Display", serif;
  font-size: 1.4rem;
  color: #241a04;
  margin-bottom: 18px !important;
}

.gift-thankyou {
  font-size: 2rem;
  font-weight: 700;
  color: #b8860b;
  text-align: center;
  letter-spacing: 2px;
  margin: 18px 0 !important;
}

.gift-end {
  font-weight: 600;
  color: #241a04;
}

.gift-sign {
  text-align: right;
  font-style: italic;
  margin-top: 8px;
  color: #6b5a22;
}

/* ============================================================
   FINAL SCREEN
   ============================================================ */
.final-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.final-title {
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  font-weight: 700;
}

.final-line {
  color: var(--muted);
  font-size: 1.1rem;
}

.final-line.sub {
  color: var(--gold);
  font-style: italic;
  font-family: "Playfair Display", serif;
}

.final-big {
  font-size: clamp(4.5rem, 20vw, 8rem);
  font-weight: 700;
  color: var(--gold);
  animation: glowPulse 3s ease-in-out infinite;
}

.final-happy {
  font-family: "Playfair Display", serif;
  font-size: 1.6rem;
  color: var(--white);
}

/* ============================================================
   SECRET STAR
   ============================================================ */
.secret-star {
  margin-top: 34px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.5rem;
  opacity: 0.35;
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: twinkle 2.4s ease-in-out infinite;
  padding: 10px;
}

.secret-star:hover {
  opacity: 1;
  transform: scale(1.2);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* Secret toast */
#secret-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  z-index: 95;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 18px 22px;
  max-width: 320px;
  text-align: center;
  color: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

#secret-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#secret-toast .st-title {
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 6px;
}

/* ============================================================
   REDUCED MOTION SUPPORT
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .fade-up {
    opacity: 1;
    transform: none;
  }

  .reveal-item {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   RESPONSIVE / DESKTOP
   ============================================================ */
@media (min-width: 768px) {
  .screen {
    padding: 40px;
  }

  .card {
    padding: 48px 44px;
  }

  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }

  .music-toggle {
    bottom: 30px;
    right: 30px;
  }
}
