/* ============================================
   Mou's Birthday Surprise - Styles
   Mobile-first, warm birthday palette
   ============================================ */

:root {
  --pink: #ff6b9d;
  --pink-light: #ffb3d0;
  --pink-dark: #e84d82;
  --gold: #ffd166;
  --gold-dark: #f4a826;
  --purple: #c77dff;
  --purple-soft: #e8d5ff;
  --cream: #fff8f0;
  --cream-dark: #ffe8d6;
  --text-dark: #4a2040;
  --text-soft: #7a4a6a;
  --glass: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.4);
  --shadow: 0 8px 32px rgba(74, 32, 64, 0.15);
  --font-display: 'Pacifico', cursive;
  --font-hand: 'Caveat', cursive;
  --font-body: 'Quicksand', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background: linear-gradient(160deg, #ffeef5 0%, #fff0e8 40%, #f5e6ff 100%);
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ---- Screens ---- */
.screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.02);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s;
  z-index: 1;
  overflow: hidden;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  z-index: 10;
}

.screen.exiting {
  opacity: 0;
  transform: scale(0.98);
}

/* ---- Ambient Balloons ---- */
.ambient-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.balloon {
  position: absolute;
  bottom: -120px;
  width: clamp(36px, 8vw, 56px);
  height: clamp(44px, 10vw, 68px);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: floatUp linear infinite;
  opacity: 0.85;
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 40px;
  background: rgba(74, 32, 64, 0.2);
}

.balloon-string {
  position: absolute;
  bottom: -48px;
  left: 50%;
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, rgba(74,32,64,0.3), transparent);
  transform-origin: top center;
  animation: stringSway 3s ease-in-out infinite;
}

@keyframes floatUp {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  5% { opacity: 0.85; }
  95% { opacity: 0.85; }
  100% { transform: translateY(-110vh) translateX(30px) rotate(8deg); opacity: 0; }
}

@keyframes stringSway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* ---- Hanging Letters ---- */
.hanging-letters {
  position: absolute;
  top: calc(var(--safe-top) + 8px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(2px, 0.8vw, 6px);
  padding: 0 8px;
  z-index: 5;
  pointer-events: none;
}

.letter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: letterSwing 4s ease-in-out infinite;
}

.letter-card:nth-child(odd) { animation-delay: -1s; }
.letter-card:nth-child(3n) { animation-delay: -2s; }

.letter-string {
  width: 1px;
  height: clamp(16px, 4vw, 28px);
  background: linear-gradient(to bottom, rgba(74,32,64,0.15), rgba(74,32,64,0.35));
}

.letter-chip {
  width: clamp(22px, 5.5vw, 34px);
  height: clamp(26px, 6.5vw, 40px);
  background: linear-gradient(145deg, #fff 0%, var(--cream-dark) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(0.65rem, 2.5vw, 0.95rem);
  color: var(--pink-dark);
  box-shadow: 0 3px 8px rgba(74, 32, 64, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.letter-chip.space {
  background: transparent;
  box-shadow: none;
  border: none;
  width: clamp(8px, 2vw, 16px);
}

@keyframes letterSwing {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

/* ---- Cover Screen ---- */
#screen-cover {
  background: linear-gradient(165deg, #ff9ec5 0%, #ffb8d9 30%, #ffd4e8 60%, #ffe8f0 100%);
}

.cover-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem 1.5rem;
  padding-top: calc(var(--safe-top) + 4rem);
}

.sparkle-ring {
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.6) 0%, transparent 70%);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

.cover-subtitle {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: var(--text-soft);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.cover-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 1.2;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 20px rgba(255, 107, 157, 0.3);
}

.name-glow {
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}

.cover-date {
  font-family: var(--font-hand);
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: var(--pink-dark);
  margin-bottom: 2.5rem;
}

.tap-continue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50px;
  padding: 1rem 2.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: tapPulse 2s ease-in-out infinite;
  transition: transform 0.2s, background 0.2s;
}

.tap-continue:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.7);
}

.tap-arrow {
  font-size: 1.2rem;
  animation: bounce 1.5s ease-in-out infinite;
}

@keyframes tapPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(74, 32, 64, 0.15); }
  50% { box-shadow: 0 8px 40px rgba(255, 107, 157, 0.35); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---- Lock Screen ---- */
#screen-lock {
  background: #1a0a14;
}

.lock-wallpaper {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 107, 157, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(199, 125, 255, 0.35) 0%, transparent 50%),
    linear-gradient(180deg, #2d1525 0%, #1a0a14 50%, #0f0610 100%);
}

.lock-glass {
  position: relative;
  z-index: 2;
  width: min(92vw, 400px);
  padding: 2rem 1.5rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 28px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transition: transform 0.4s;
}

.lock-glass.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-12px); }
  30% { transform: translateX(12px); }
  45% { transform: translateX(-8px); }
  60% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

.lock-header {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #fff;
}

.lock-date {
  font-size: 0.95rem;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.lock-time {
  font-size: clamp(2.5rem, 12vw, 4rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.lock-hint {
  font-size: 0.85rem;
  opacity: 0.65;
  font-style: italic;
}

.passcode-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 20px;
  margin-bottom: 1.5rem;
}

.passcode-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  transition: all 0.2s ease;
}

.passcode-dot.filled {
  background: #fff;
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 1rem;
}

.key {
  aspect-ratio: 1.4;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0.92);
}

.key-empty {
  visibility: hidden;
  pointer-events: none;
}

.key-back {
  font-size: 1.3rem;
}

.key-enter {
  width: 100%;
  padding: 0.9rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.key-enter:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.unlock-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 107, 157, 0);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s, background 0.6s;
}

.unlock-overlay.active {
  opacity: 1;
  background: rgba(255, 107, 157, 0.85);
  pointer-events: auto;
}

.unlock-burst {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, transparent 70%);
  animation: unlockBurst 1s ease-out forwards;
}

@keyframes unlockBurst {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

.unlock-text {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  color: #fff;
  text-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: fadeInUp 0.8s ease 0.3s both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Reveal Screen ---- */
#screen-reveal {
  background: linear-gradient(180deg, #fff5f8 0%, #fff8f0 50%, #f8f0ff 100%);
  justify-content: flex-start;
  overflow: hidden;
}

.reveal-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: y proximity;
  padding-bottom: var(--safe-bottom);
}

.reveal-section {
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 2rem) 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-snap-align: start;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-soft);
  text-align: center;
  margin-bottom: 1.5rem;
}

.section-next {
  margin-top: auto;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(255, 107, 157, 0.35);
  transition: transform 0.2s;
}

.section-next:active {
  transform: scale(0.96);
}

/* Letter floating notes */
.letter-section::before {
  content: '♪ ♫ ♪ ♫';
  position: absolute;
  top: 15%;
  right: 10%;
  font-size: 1.5rem;
  color: rgba(255, 107, 157, 0.15);
  animation: floatNotes 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes floatNotes {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
  50% { transform: translateY(-15px) rotate(5deg); opacity: 0.6; }
}

.letter-section {
  position: relative;
}
  flex: 1;
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, #fffef9 0%, #fff8ee 100%);
  border-radius: 4px;
  padding: 2rem 1.5rem;
  margin: 1rem 0 2rem;
  box-shadow:
    0 2px 4px rgba(74, 32, 64, 0.06),
    0 12px 40px rgba(74, 32, 64, 0.1);
  position: relative;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 27px,
    rgba(255, 107, 157, 0.08) 27px,
    rgba(255, 107, 157, 0.08) 28px
  );
}

.letter-content {
  font-family: var(--font-hand);
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  line-height: 1.8;
  color: var(--text-dark);
  white-space: pre-wrap;
}

.letter-cursor {
  font-family: var(--font-hand);
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  color: var(--pink);
  animation: blink 1s step-end infinite;
}

.letter-cursor.hidden {
  display: none;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Flip Cards */
.flip-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 480px;
  margin-bottom: 2rem;
}

.flip-card {
  aspect-ratio: 0.85;
  perspective: 800px;
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(74, 32, 64, 0.12);
}

.flip-card-front {
  background: linear-gradient(145deg, #fff 0%, var(--cream-dark) 100%);
  font-size: 2rem;
}

.flip-card-back {
  background: linear-gradient(145deg, var(--pink-light) 0%, var(--purple-soft) 100%);
  transform: rotateY(180deg);
  font-family: var(--font-hand);
  font-size: clamp(1.1rem, 3.5vw, 1.35rem);
  color: var(--text-dark);
  line-height: 1.4;
}

/* Timeline */
.timeline {
  width: 100%;
  max-width: 480px;
  position: relative;
  padding-left: 2rem;
  margin-bottom: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--pink) 0%, var(--purple) 50%, var(--gold) 100%);
  border-radius: 3px;
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 1.5rem;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 0.4rem;
  width: 14px;
  height: 14px;
  background: var(--gold);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.4);
}

.timeline-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pink-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.timeline-title {
  font-family: var(--font-hand);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.timeline-photo {
  width: 100%;
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, var(--purple-soft) 0%, var(--pink-light) 100%);
  border-radius: 12px;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  opacity: 0.7;
}

/* Wish Jar */
.jar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0 2rem;
}

.wish-jar {
  position: relative;
  width: clamp(140px, 35vw, 180px);
  height: clamp(180px, 45vw, 230px);
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.3s;
}

.wish-jar:active {
  transform: scale(0.95);
}

.wish-jar.shake-jar {
  animation: jarShake 0.5s ease;
}

@keyframes jarShake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

.jar-lid {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 18%;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 8px 8px 4px 4px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.jar-body {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 78%;
  background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,182,213,0.3) 100%);
  border: 3px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px 8px 20px 20px;
  overflow: hidden;
  backdrop-filter: blur(4px);
}

.jar-papers {
  position: absolute;
  inset: 15% 10% 10%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  align-content: flex-end;
}

.jar-paper {
  width: 20px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
  opacity: 0.7;
  transform: rotate(var(--rot, 0deg));
}

.jar-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.3) 0%, transparent 70%);
  pointer-events: none;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.wish-message {
  min-height: 80px;
  max-width: 320px;
  padding: 1.25rem 1.5rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(74, 32, 64, 0.12);
  font-family: var(--font-hand);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  text-align: center;
  color: var(--text-dark);
  opacity: 0;
  transform: scale(0.8) translateY(10px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wish-message.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ---- Cake Screen ---- */
#screen-cake {
  background: linear-gradient(180deg, #1a0f1a 0%, #2d1a2d 40%, #1a1020 100%);
  justify-content: flex-start;
  padding-top: var(--safe-top);
  position: relative;
}

#screen-cake::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.25) 0%, transparent 100%);
  pointer-events: none;
  animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.cake-header {
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
  z-index: 5;
}

.cake-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  color: #fff;
  margin-bottom: 0.35rem;
}

.cake-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.cut-progress-wrap {
  margin-top: 0.75rem;
  width: min(280px, 80vw);
  margin-left: auto;
  margin-right: auto;
}

.cut-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  overflow: hidden;
}

.cut-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink) 0%, var(--gold) 100%);
  border-radius: 6px;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 12px rgba(255, 107, 157, 0.6);
}

.cut-progress-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.35rem;
}

.cut-guide {
  position: absolute;
  width: 4px;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 209, 102, 0.2) 10%,
    rgba(255, 209, 102, 0.85) 50%,
    rgba(255, 209, 102, 0.2) 90%,
    transparent 100%
  );
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  transition: opacity 0.5s;
  box-shadow: 0 0 20px rgba(255, 209, 102, 0.5);
  animation: guidePulse 1.5s ease-in-out infinite;
}

.cut-guide.visible {
  opacity: 1;
}

.cut-guide::before,
.cut-guide::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border: 2px dashed rgba(255, 209, 102, 0.6);
  border-radius: 50%;
}

.cut-guide::before { top: -6px; }
.cut-guide::after { bottom: -6px; }

@keyframes guidePulse {
  0%, 100% { opacity: 0.7; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.3); }
}

.cake-stage {
  flex: 1;
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  padding-bottom: calc(var(--safe-bottom) + 1rem);
}

.cake-wrapper {
  position: relative;
  width: min(280px, 70vw);
  transition: opacity 0.5s, transform 0.3s;
  --cut-gap: 0px;
}

.cake-wrapper.cutting .cake {
  opacity: 1;
}

.cake-wrapper.cut-opening #cake {
  position: relative;
}

.cake-wrapper.cut-opening #cake::after {
  content: '';
  position: absolute;
  top: -40px;
  bottom: -20px;
  left: 50%;
  width: max(2px, var(--cut-gap));
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(26, 15, 26, 0.9) 15%, rgba(26, 15, 26, 0.9) 85%, transparent);
  z-index: 15;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.cake-wrapper.cut-shake .cake {
  animation: cakeCutShake 0.15s ease-in-out infinite;
}

@keyframes cakeCutShake {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(1px); }
}

.cake-wrapper.split-prep .cake {
  animation: cakePreSplit 0.35s ease forwards;
}

@keyframes cakePreSplit {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.cake-wrapper.split .cake {
  opacity: 0;
  pointer-events: none;
}

.cake {
  position: relative;
  width: 100%;
  transition: transform 0.3s, opacity 0.5s;
}

.cake-clone {
  width: 100%;
  position: relative;
}

.cake-layer {
  border-radius: 8px;
  margin: 0 auto;
  position: relative;
}

.cake-layer-top {
  width: 100%;
  height: 70px;
  background: linear-gradient(180deg, #ffb8d0 0%, #ff8fb8 100%);
  border-radius: 12px 12px 4px 4px;
  position: relative;
  z-index: 3;
}

.frosting-drip {
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 16px;
  background:
    radial-gradient(ellipse 12px 16px at 15% 0, #fff 70%, transparent 71%),
    radial-gradient(ellipse 14px 18px at 35% 0, #fff 70%, transparent 71%),
    radial-gradient(ellipse 12px 16px at 55% 0, #fff 70%, transparent 71%),
    radial-gradient(ellipse 14px 18px at 75% 0, #fff 70%, transparent 71%),
    radial-gradient(ellipse 10px 14px at 90% 0, #fff 70%, transparent 71%);
}

.cake-layer-middle {
  width: 92%;
  height: 50px;
  background: linear-gradient(180deg, #ff9ec5 0%, #ff7aab 100%);
  margin-top: -4px;
  z-index: 2;
}

.cake-layer-bottom {
  width: 84%;
  height: 45px;
  background: linear-gradient(180deg, #ff8ab8 0%, #ff6b9d 100%);
  border-radius: 4px 4px 12px 12px;
  margin-top: -4px;
  z-index: 1;
}

.cake-plate {
  width: 110%;
  height: 12px;
  background: linear-gradient(180deg, #e8e8e8 0%, #c0c0c0 100%);
  border-radius: 50%;
  margin: 8px auto 0;
  margin-left: -5%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.candles {
  position: absolute;
  top: -52px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  z-index: 30;
  pointer-events: auto;
}

.candle {
  position: relative;
  width: 52px;
  height: 72px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.candle:active .candle-body {
  transform: scale(0.92);
}

.candle.out {
  pointer-events: none;
}

.candle-body {
  width: 12px;
  height: 38px;
  background: repeating-linear-gradient(
    90deg,
    #fff 0px, #fff 3px,
    var(--pink) 3px, var(--pink) 6px
  );
  border-radius: 2px;
  transition: transform 0.15s;
  pointer-events: none;
}

.flame {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 22px;
  background: radial-gradient(ellipse at 50% 80%, #ff6b00 0%, #ffd166 40%, transparent 70%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 0.15s ease-in-out infinite alternate;
  pointer-events: none;
}

.candle.out .flame {
  animation: blowOut 0.4s ease forwards;
}

@keyframes flicker {
  0% { transform: translateX(-50%) scale(1) rotate(-2deg); }
  100% { transform: translateX(-50%) scale(1.05) rotate(2deg); }
}

@keyframes blowOut {
  0% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(0); }
}

.cake-half {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.cake-half-left {
  left: 0;
}

.cake-half-right {
  right: 0;
}

.cake-half-inner {
  width: 200%;
  height: 100%;
  position: relative;
}

.cake-half-right .cake-half-inner {
  margin-left: -100%;
}

.cake-wrapper.split .cake-half {
  opacity: 1;
}

.cake-wrapper.split .cake-half-left {
  animation: splitLeft 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cake-wrapper.split .cake-half-right {
  animation: splitRight 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes splitLeft {
  0% { transform: translateX(0) rotate(0deg); }
  60% { transform: translateX(-18%) rotate(-6deg); }
  100% { transform: translateX(-32%) rotate(-10deg) translateY(8px); }
}

@keyframes splitRight {
  0% { transform: translateX(0) rotate(0deg); }
  60% { transform: translateX(18%) rotate(6deg); }
  100% { transform: translateX(32%) rotate(10deg) translateY(8px); }
}

#cut-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

.knife {
  position: absolute;
  width: 56px;
  height: 140px;
  z-index: 20;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-30deg);
  transition: opacity 0.5s, filter 0.2s;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45));
  will-change: transform, left, top;
}

.knife.visible {
  opacity: 1;
  pointer-events: auto;
}

.knife.dragging {
  cursor: grabbing;
  filter: drop-shadow(0 8px 24px rgba(255, 107, 157, 0.5));
  z-index: 25;
}

.knife.cutting-motion {
  opacity: 0;
  transition: opacity 0.3s;
}

.knife-touch-area {
  position: absolute;
  inset: -24px -20px;
  z-index: 5;
}

.knife-blade {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 82px;
  background: linear-gradient(90deg, #a8a8a8 0%, #f5f5f5 45%, #d0d0d0 55%, #909090 100%);
  border-radius: 2px 2px 0 0;
  clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
}

.knife-handle {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 58px;
  background: linear-gradient(180deg, #a0522d 0%, #6b3a1f 100%);
  border-radius: 4px 4px 10px 10px;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.cake-celebration {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 15, 26, 0.7);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.6s;
}

.cake-celebration.show {
  opacity: 1;
  pointer-events: auto;
}

.celebration-text {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.2rem);
  color: #fff;
  text-align: center;
  animation: celebrationPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.celebration-sub {
  font-family: var(--font-hand);
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  color: var(--pink-light);
  margin-top: 0.5rem;
  animation: fadeInUp 0.8s ease 0.4s both;
}

@keyframes celebrationPop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .flip-cards {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
  }

  .hanging-letters {
    gap: 8px;
  }

  .letter-chip {
    width: 38px;
    height: 44px;
    font-size: 1rem;
  }

  .cake-wrapper {
    width: min(340px, 50vw);
  }
}

@media (min-width: 1024px) {
  .reveal-section {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (max-height: 600px) {
  .cover-content {
    padding-top: calc(var(--safe-top) + 3rem);
  }

  .hanging-letters {
    transform: scale(0.85);
    transform-origin: top center;
  }

  .lock-glass {
    padding: 1.25rem 1rem;
  }

  .keypad {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
