/* ============================================================
   FORM PAGE STYLES (style.css)
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  overflow-x: hidden; 
  width: 100%;
}

body {
  background-color: #1a0000;
  background-image: radial-gradient(circle at 50% 0%, #3a0000 0%, #1a0000 70%);
  font-family: 'Montserrat', sans-serif;
  color: #fcf4eb;
  height: 100dvh; 
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #5c0000; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #8b0000; }

/* ============================================================
   APP CONTAINER
   ============================================================ */
.app-container {
  background: rgba(36, 0, 0, 0.85); 
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  margin: auto; 
  height: 100%; 
  max-height: 850px;
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  box-shadow: 0 25px 50px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ============================================================
   TOP STRIP
   ============================================================ */
.top-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  width: 100%;
  position: relative;
  z-index: 100;
  background: rgba(36, 0, 0, 0.95); 
  border-bottom: 1px solid rgba(255,255,255,0.05);
  border-radius: 20px 20px 0 0;
  flex-shrink: 0; 
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
  transition: all 0.2s;
}
.icon-btn:hover { background-color: rgba(255,255,255,0.2); }
#headerBackBtn.hidden-back { visibility: hidden; }

#musicToggle {
  padding: 0 !important;
  font-size: 1.2rem !important;
  background-color: transparent !important;
  border: 1px solid #e8ad7b !important;
  color: #e8ad7b !important;
}

.step-indicator-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
  padding: 0 10px;
}

.step-text-top {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e8ad7b;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.step-bar-top {
  width: 100%;
  max-width: 120px;
  height: 4px;
  background: #3a0000;
  border-radius: 2px;
  overflow: hidden;
}

.step-progress-top {
  height: 100%;
  background: #e8ad7b;
  transition: width 0.4s ease;
}

/* ============================================================
   FORM CONTENT WRAPPER
   ============================================================ */
.form-content-wrapper {
  position: relative;
  z-index: 10; 
  padding: 25px 30px 0 30px; 
  overflow-y: auto; 
  flex-grow: 1; 
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

.hearts-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; 
  z-index: 1; 
  overflow: hidden; 
  border-radius: 20px; 
}

.heart {
  position: absolute;
  bottom: -20px; 
  color: rgba(232, 173, 123, 0.3); 
  animation: floatUp 6s linear forwards;
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 0.8; }
  100% { transform: translateY(-800px) scale(1.5) rotate(20deg); opacity: 0; }
}

/* ============================================================
   FORM STEPS
   ============================================================ */
.form-header { text-align: center; margin-bottom: 30px; }
.form-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  color: #e8ad7b;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(232, 173, 123, 0.2);
  line-height: 1.3; 
  word-wrap: break-word; 
}
.form-header p { font-size: 0.85rem; color: #aaa; letter-spacing: 0.5px; }

.form-step { display: none; }
.form-step.active {
  display: flex;
  flex-direction: column;
  min-height: 100%; 
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================================
   STICKY BUTTONS
   ============================================================ */
.nav-buttons {
  position: sticky;
  bottom: 0;
  margin-top: auto; 
  background: #240000; 
  padding: 15px 0 calc(20px + env(safe-area-inset-bottom, 15px)) 0;
  z-index: 100;
  display: flex;
  gap: 10px;
  width: 100%;
}

.nav-buttons .secondary-btn { flex: 1; padding: 16px; }
.nav-buttons .primary-btn, 
.nav-buttons button[type="submit"] { flex: 1; margin-top: 0; }

/* ============================================================
   INPUTS & SECTIONS
   ============================================================ */
.form-section {
  background: #2e0000;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.section-hint { font-size: 0.75rem; color: #aaa; margin-bottom: 15px; margin-top: -10px; }
.input-group { margin-bottom: 15px; flex: 1; }
.input-group label { display: block; font-size: 0.75rem; font-weight: 600; margin-bottom: 8px; color: #e8ad7b; text-transform: uppercase; letter-spacing: 1px; }

input[type="text"], 
input[type="email"], 
input[type="date"], 
input[type="tel"], 
input[type="number"], 
textarea {
  width: 100%;
  padding: 14px 16px;
  background: #1a0000 !important; 
  border: 1px solid #5c0000;
  border-radius: 10px;
  color: #fff !important;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.7;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

input::placeholder, textarea::placeholder { color: #888 !important; }
input:focus, textarea:focus { border-color: #e8ad7b; box-shadow: 0 0 0 3px rgba(232, 173, 123, 0.15); background: #240000 !important; }
textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

/* File Upload */
input[type="file"] {
  width: 100%;
  padding: 10px;
  background: #1a0000;
  border: 1px dashed #8b0000;
  border-radius: 10px;
  color: #aaa;
  font-size: 0.8rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  background: #e8ad7b;
  color: #111;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 15px;
}

/* DYNAMIC REASONS LIST */
.reasons-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 15px; }
.reason-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fcf4eb;
  border-radius: 12px;
  padding: 15px 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.reason-text { color: #8b0000; font-size: 0.85rem; font-weight: 600; flex: 1; white-space: normal; word-break: break-word; }
.delete-btn { background: transparent; border: none; color: #8b0000; font-size: 1.2rem; cursor: pointer; padding: 0 0 0 10px; opacity: 0.6; }
.delete-btn:hover { opacity: 1; }

/* Manual Input for Reasons */
.manual-reason-input { display: flex; gap: 10px; margin-bottom: 20px; }
.manual-reason-input input { flex: 1; background: #1a0000 !important; border: 1px solid #e8ad7b !important; color: #fff !important; border-radius: 10px; padding: 14px; }
.manual-reason-input .add-btn { background: #e8ad7b; color: #111; border: none; border-radius: 10px; padding: 0 20px; font-weight: bold; cursor: pointer; }

/* SUGGESTIONS UI */
.textarea-wrapper { position: relative; }
.char-count { text-align: right; font-size: 0.7rem; color: #888; margin-top: 5px; margin-bottom: 25px; }
.suggestion-header { display: flex; justify-content: flex-start; align-items: center; margin-bottom: 15px; }
.suggestion-label { font-size: 0.65rem; font-weight: 700; color: #aaa; letter-spacing: 1px; }
.suggestions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.suggestion-card {
  background: rgba(232, 173, 123, 0.03);
  border: 1px dashed rgba(232, 173, 123, 0.4);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.75rem;
  line-height: 1.6;
  color: #ddd;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.suggestion-card:hover { background: rgba(232, 173, 123, 0.1); border-color: #e8ad7b; color: #fff; }
.plus-icon { color: #e8ad7b; font-weight: bold; font-size: 1rem; margin-right: 4px; }
.suggestion-card.used { opacity: 0.3; pointer-events: none; filter: grayscale(100%); }

/* BUTTONS */
.primary-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #e8ad7b, #d49863);
  color: #111;
  border: none;
  border-radius: 10px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(232, 173, 123, 0.3);
  margin-top: 10px;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(232, 173, 123, 0.4); }

button[type="submit"] {
  background: linear-gradient(135deg, #d32f2f, #8b0000) !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4) !important;
}

.secondary-btn {
  padding: 12px 20px;
  background: #1a0000;
  color: #ccc;
  border: 1px solid #5c0000;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.secondary-btn:hover { background: #2e0000; color: #fff; border-color: #8b0000; }

/* ============================================================
   LIVE PREVIEW MODAL
   ============================================================ */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: #110000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden; 
}

.preview-top-bar {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-wrap: wrap; /* Allows elements to wrap on small screens */
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px; 
  background: #240000;
  border-bottom: 1px solid #5c0000;
  color: #e8ad7b;
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 10px;
}

.preview-header-left { display: flex; align-items: center; gap: 15px; }
.live-preview-text { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; white-space: nowrap; }
.close-preview-btn { background: transparent; border: 1px solid #ff4d4d; color: #ff4d4d; padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }

.preview-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* PROMO CODE INPUT STYLING (With perfect tooltip) */
.promo-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 10px;
  position: relative; /* Crucial for absolute tooltip */
}

#previewPromoCode {
  padding: 0 12px;
  height: 36px;
  box-sizing: border-box;
  width: 140px;
  border-radius: 30px;
  border: 1px solid #5c0000;
  background: #1a0000;
  color: #fff;
  font-size: 0.65rem;
  text-transform: uppercase;
  outline: none;
  transition: all 0.3s;
  text-align: center;
}

#previewPromoCode:focus {
  border-color: #e8ad7b;
}

/* PERFECT TOOLTIP: Absolutely positioned below the input */
#promoMessage {
  position: absolute;
  top: 100%; /* Right below the input */
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  display: none;
  z-index: 20;
  padding: 4px 8px;
  background: #1a0000;
  border-radius: 4px;
}

.price-btn {
  background: #e8ad7b;
  color: #240000;
  border: none;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.price-btn del { opacity: 0.6; font-size: 0.8rem; font-weight: 500; }
.price-btn .discount-badge { background: #16a34a; color: white; padding: 3px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: 700; }

.preview-info-banner {
  text-align: center;
  margin: 10px auto; 
  padding: 6px 14px; 
  background: rgba(232, 173, 123, 0.1);
  border: 1px dashed #e8ad7b;
  border-radius: 20px;
  color: #e8ad7b;
  font-size: 0.75rem; 
  width: fit-content;
  max-width: 90%;
}

#livePreviewModal .card { margin-top: 10px; margin-bottom: 20px; }

/* Base Card */
.card { position: relative; width: 360px; height: 650px; perspective: 1200px; margin: 0 auto; }
.cover, .inside {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  backface-visibility: hidden;
}
.cover {
  background: linear-gradient(145deg, #8b0000, #5c0000);
  box-shadow: 0 20px 60px rgba(139, 0, 0, 0.4);
  z-index: 2;
  cursor: pointer;
  transition: transform 1s cubic-bezier(.4,0,.2,1);
  transform-origin: left center;
}
.card.open .cover { transform: rotateY(-160deg); }

.inside { 
  background: linear-gradient(145deg, #8b0000, #5c0000) !important; 
  box-shadow: 0 20px 60px rgba(0,0,0,.3); 
  overflow: hidden; 
  z-index: 1; 
}

/* ============================================================
   UNIFIED SCREEN HEADERS
   ============================================================ */
.screen-header {
  text-align: center;
  width: 100%;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px; 
}

.screen-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.6rem;
  font-weight: 600;
  color: #fcf4eb;
  line-height: 1.1;
  text-shadow: 0 3px 10px rgba(0,0,0,0.3);
  margin: 0;
  text-align: center;
  width: 100%;
}

.screen-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #e8ad7b;
  letter-spacing: 0.5px;
  margin: 0;
  text-align: center;
  width: 100%;
  line-height: 1.4;
}

.highlight-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.3em; 
  font-weight: 700;
  color: #fff4e6;
  text-shadow: 0 2px 5px rgba(255,255,255,0.2);
  display: inline-block;
  margin: 0 4px;
}

/* ============================================================
   BASE SCREEN LAYOUT
   ============================================================ */
.screen { 
  position: absolute; 
  inset: 0; 
  padding: 30px 20px; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: space-between; 
  border-radius: 16px; 
  transition: opacity .6s ease, transform .6s ease; 
}
.screen.hidden { 
  opacity: 0; 
  transform: scale(.92); 
  pointer-events: none; 
  display: none !important; 
}

/* ============================================================
   GENTLE SWING ANIMATION
   ============================================================ */
@keyframes gentle-swing {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-4deg) scale(1.02); }
  75% { transform: rotate(4deg) scale(1.02); }
}

.gift-img { 
  width: 120px; 
  height: auto; 
  display: block; 
  margin-bottom: 16px; 
  animation: gentle-swing 3s infinite ease-in-out; 
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); 
}

.final-teddy { 
  width: 120px; 
  margin-bottom: 5px; 
  animation: gentle-swing 3s infinite ease-in-out; 
  filter: drop-shadow(0 0 20px rgba(255, 100, 100, 0.3)); 
}

/* ============================================================
   DOUBLE LAYER CAKE SCREEN
   ============================================================ */
#screenCake { justify-content: center; gap: 15px; padding-top: 30px; padding-bottom: 30px; }

.cake-scene {
  position: relative;
  width: 100%;
  max-width: 240px;
  height: 180px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.magical-glow {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 180, 80, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 0;
  animation: pulseGlow 3s infinite alternate;
  pointer-events: none;
}

.cake {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floatCake 4s ease-in-out infinite;
  z-index: 2;
  width: 100%;
}

.layer-top {
  width: 120px;
  height: 40px;
  background: #ff9ec4;
  border-radius: 6px 6px 4px 4px;
  position: relative;
  z-index: 3;
  box-shadow: inset 0 -8px 12px rgba(0,0,0,0.15);
  margin: 0 auto;
}
.layer-top::before {
  content: '';
  position: absolute;
  top: -8px; left: 0; right: 0;
  height: 16px;
  background: #fff;
  border-radius: 50% 50% 8px 8px / 20px 20px 4px 4px;
  z-index: 4;
}

.layer-bottom {
  width: 160px;
  height: 50px;
  background: #ff6b9d;
  border-radius: 6px 6px 4px 4px;
  position: relative;
  z-index: 2;
  margin: -2px auto 0;
  box-shadow: inset 0 -8px 12px rgba(0,0,0,0.15);
}
.layer-bottom::before {
  content: '';
  position: absolute;
  top: -8px; left: 0; right: 0;
  height: 16px;
  background: #fff;
  border-radius: 50% 50% 8px 8px / 20px 20px 4px 4px;
  z-index: 3;
}

.cake-plate {
  width: 180px;
  height: 12px;
  background: linear-gradient(to bottom, #ffffff, #d4d4d4);
  border-radius: 50%;
  position: relative;
  z-index: 1;
  margin: -6px auto 0;
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
  animation: shadowPulse 4s ease-in-out infinite;
}

.candles {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  margin-bottom: 5px;
}

.candle {
  width: 10px;
  height: 35px;
  background: repeating-linear-gradient(-45deg, #ff6b9d 0 4px, #fff 4px 8px);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}
.candle:nth-child(2) { background: repeating-linear-gradient(-45deg, #4d96ff 0 4px, #fff 4px 8px); }
.candle:nth-child(3) { background: repeating-linear-gradient(-45deg, #6bcB77 0 4px, #fff 4px 8px); }
.candle:nth-child(4) { background: repeating-linear-gradient(-45deg, #f5b800 0 4px, #fff 4px 8px); }
.candle:nth-child(5) { background: repeating-linear-gradient(-45deg, #9b59ff 0 4px, #fff 4px 8px); }

.flame {
  position: absolute;
  top: -18px; left: 50%;
  transform: translateX(-50%);
  width: 12px; height: 20px;
  background: radial-gradient(ellipse at 50% 80%, #fff 0%, #ffe57a 35%, #ff9a3c 75%, transparent 100%);
  border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
  transform-origin: bottom center;
  animation: flicker 0.15s infinite alternate;
  box-shadow: 0 0 15px 5px rgba(255, 150, 50, 0.5);
  transition: all 0.3s ease;
}
.candle.out .flame {
  opacity: 0;
  transform: translateX(-50%) scale(0);
  box-shadow: none;
}

.cake-footer { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.blow-hint { font-family: 'Playfair Display', serif; font-style: italic; font-size: 1rem; color: #fcf4eb; text-align: center; }
.blow-hint small { display: block; font-family: 'Montserrat', sans-serif; font-style: normal; font-size: .6rem; color: #e8ad7b; margin-top: 4px; }
.mic-btn { padding: 10px 20px; border: none; border-radius: 30px; background: #fcf4eb; color: #8b0000; font-weight: 600; font-size: .7rem; cursor: pointer; }

@keyframes pulseGlow { 0% { transform: translateX(-50%) scale(0.8); opacity: 0.5; } 100% { transform: translateX(-50%) scale(1.2); opacity: 1; } }
@keyframes floatCake { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shadowPulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(0.95); opacity: 0.5; } }
@keyframes flicker { 0% { transform: translateX(-50%) scale(1) rotate(-2deg); } 100% { transform: translateX(-50%) scale(1.1, 1.15) rotate(2deg); } }

/* ============================================================
   BALLOONS SCREEN
   ============================================================ */
#screenBalloons { justify-content: center; gap: 20px; padding-top: 30px; padding-bottom: 30px; }
.balloons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px 10px; width: 100%; padding: 0 6px; margin: 10px 0; }
.balloon-wrap { display: flex; flex-direction: column; align-items: center; position: relative; min-height: 100px; }
.balloon { width: 55px; height: 68px; border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%; position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: bold; font-family: 'Playfair Display', serif; color: #fcf4eb; animation: float 3s ease-in-out infinite; }
.balloon::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 2px; height: 15px; background: rgba(252, 244, 235, 0.5); }
.balloon.popped { animation: pop .35s forwards; pointer-events: none; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); opacity: 1; } 100% { transform: scale(0); opacity: 0; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.b1 { background: radial-gradient(circle at 35% 30%, #b30000, #8b0000); }
.b2 { background: radial-gradient(circle at 35% 30%, #f2c3a7, #e8ad7b); }
.b3 { background: radial-gradient(circle at 35% 30%, #6b4c3a, #4a342a); }
.b4 { background: radial-gradient(circle at 35% 30%, #fcf4eb, #d4c5b9); color: #8b0000; }
.b5 { background: radial-gradient(circle at 35% 30%, #b30000, #8b0000); }
.reason { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); background: #fcf4eb; color: #8b0000; font-family: 'Playfair Display', serif; font-style: italic; font-weight: 600; font-size: .75rem; padding: 8px 6px; border-radius: 10px; width: 90px; text-align: center; z-index: 5; transition: transform .35s cubic-bezier(.34,1.56,.64,1); pointer-events: none; }
.reason.show { transform: translate(-50%, -50%) scale(1); }
.progress { font-size: .7rem; font-weight: 600; color: #e8ad7b; text-align: center; margin: 0; margin-top: 10px; }

/* ============================================================
   PHOTOS SCREEN (UNIFIED CARD SIZE)
   ============================================================ */
#screenPhotos {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden; 
  padding: 20px 0 15px 0 !important; 
}

#screenPhotos .screen-header {
  margin-bottom: 5px !important;
}

.photo-lane {
  display: flex !important;
  flex: 1 !important; 
  align-items: center !important;
  overflow-x: auto !important;
  scroll-snap-type: x mandatory !important;
  -webkit-overflow-scrolling: touch;
  width: 100% !important;
  scrollbar-width: none; 
  padding: 10px 12.5% !important; 
}
.photo-lane::-webkit-scrollbar { display: none; }

/* Force all cards to be the same height */
.photo-card {
  flex: 0 0 75% !important; 
  margin: 0 6px !important; 
  height: 400px !important; 
  max-height: 90% !important;
  scroll-snap-align: center !important;
  background: #ffffff !important;
  padding: 10px !important; 
  border-radius: 4px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4) !important;
  cursor: pointer !important;
  display: flex !important; 
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* The image fits inside the fixed-height card without stretching */
.photo-img {
  width: 100% !important;
  height: 100% !important; 
  object-fit: contain !important; /* PREVENTS STRETCHING */
  border-radius: 2px !important;
  background-color: #ffffff;
  display: block !important;
}

/* Dots for carousel */
.photo-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.dot.active {
  width: 18px;
  border-radius: 4px;
  background-color: #e8ad7b; 
}

#screenPhotos .progress {
  margin: 5px 0 0 0 !important;
  font-size: 0.8rem !important;
  color: #ff9ec4 !important;
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================================
   ENVELOPE SCREEN
   ============================================================ */
#screenEnvelope { justify-content: center; gap: 30px; }
.envelope { position: relative; width: 200px; height: 140px; cursor: pointer; animation: envFloat 3s ease-in-out infinite; }
@keyframes envFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.env-back, .env-front, .env-flap { position: absolute; inset: 0; border-radius: 8px; }
.env-back { background: linear-gradient(145deg, #f2c3a7, #e8ad7b); }
.env-front { background: linear-gradient(145deg, #a30000, #700000); clip-path: polygon(0 45%, 50% 75%, 100% 45%, 100% 100%, 0 100%); border-radius: 0 0 8px 8px; z-index: 2; }
.env-flap { background: linear-gradient(145deg, #b30000, #8b0000); clip-path: polygon(0 0, 100% 0, 50% 62%); transform-origin: top center; transition: transform .6s ease; z-index: 3; }
.env-seal { position: absolute; top: 52%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; background: radial-gradient(circle at 35% 30%, #fcf4eb, #e8ad7b 60%, #8b0000 100%); color: #8b0000; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; z-index: 4; transition: transform .3s; }
.env-letter-preview { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); width: 78%; height: 70%; background: #fcf4eb; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 2rem; transition: transform .6s ease .15s; z-index: 1; }
.envelope.opening .env-flap { transform: rotateX(180deg); }
.envelope.opening .env-letter-preview { transform: translate(-50%, -60px) scale(1.05); }
.env-hint { font-family: 'Playfair Display', serif; font-style: italic; font-size: 1rem; color: #e8ad7b; }

/* ============================================================
   LETTER SCREEN
   ============================================================ */
.letter { background: linear-gradient(160deg, #8b0000, #5c0000); border: 2px solid rgba(255,255,255,.2); justify-content: center; }
.letter .divider { width: 60px; height: 1px; background: linear-gradient(90deg, transparent, #e8ad7b, transparent); margin: 10px auto 15px; opacity: 0.5; }
.letter .msg { font-family: 'Playfair Display', serif; font-style: italic; font-size: 0.95rem; line-height: 1.4; color: #fcf4eb; min-height: 180px; max-width: 260px; margin: 0 auto; text-align: left; }
.letter .signature { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 1.2rem; color: #fcf4eb; opacity: 0; transition: opacity .8s ease .2s; margin-top: 20px; text-align: center; width: 100%; }
.letter .signature small { display: block; font-family: 'Montserrat', sans-serif; font-style: normal; font-size: .6rem; color: #e8ad7b; letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; }

/* ============================================================
   FINAL SCREEN (STRICT FITTING)
   ============================================================ */
.final-screen { 
  background: linear-gradient(145deg, #8b0000, #5c0000); 
  justify-content: center; 
  gap: 5px; 
  padding: 20px 15px; 
  box-sizing: border-box;
}
.final-name-highlight {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2rem, 8vw, 4rem); 
  color: #e8ad7b;
  margin-top: 5px;
  margin-bottom: 5px;
  line-height: 1.2;
  text-shadow: 0 4px 15px rgba(0,0,0,0.4);
  text-align: center;
  width: 100%;
  word-wrap: break-word; 
  overflow-wrap: break-word;
  max-height: 180px; 
  overflow: hidden; 
}
.final-footer { 
  font-family: 'Montserrat', sans-serif; 
  font-size: 0.7rem; 
  color: #e8ad7b; 
  text-align: center; 
  margin-top: 10px; 
}
.final-footer span { color: #fcf4eb; font-weight: 600; }

/* ============================================================
   MODALS & OVERLAYS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 3000; backdrop-filter: blur(8px);
}
.modal-content {
  background: #240000; border: 1px solid #5c0000; border-radius: 20px; padding: 30px 25px; width: 90%; max-width: 380px; text-align: center; box-shadow: 0 25px 50px rgba(0,0,0,0.8);
}
.modal-content h2 { font-family: 'Playfair Display', serif; color: #e8ad7b; margin-bottom: 10px; font-size: 1.6rem; }

/* ============================================================
   ANIMATIONS & HINTS
   ============================================================ */
@keyframes pulse-hint { 0%, 100% { opacity: 0.7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.tap-hint {
  margin-top: 20px; font-family: 'Montserrat', sans-serif; font-size: 0.75rem; font-weight: 600;
  color: rgba(252, 244, 235, 0.6); letter-spacing: 1px; text-transform: uppercase; animation: pulse-hint 2s infinite;
}

.confetti { position: fixed; width: 8px; height: 8px; top: -20px; z-index: 9999; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(110vh) rotate(720deg); opacity: 0.8; } }

/* ============================================================
   MOBILE & TABLET RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .app-container { width: 95%; max-height: 95dvh; }
  .form-content-wrapper { padding: 20px 20px 0 20px; }
  .form-header h2 { font-size: 1.8rem !important; }
  
  .card { width: 95vw !important; max-width: 400px !important; height: 75vh !important; max-height: 750px !important; }
  .screen-title { font-size: 1.8rem !important; }
  .screen-subtitle { font-size: 0.8rem !important; }
  .highlight-name { font-size: 1.2em; }
  .final-name-highlight { font-size: clamp(1.8rem, 9vw, 3rem) !important; max-height: 140px; }
  .final-teddy { width: 100px !important; }
  
  #screenCake { gap: 15px; }
  .cake-scene { transform: scale(0.85); margin-bottom: 10px; }
  .blow-hint { font-size: 0.95rem !important; }
  .mic-btn { padding: 10px 20px; font-size: 0.75rem; }
  .balloon { width: 50px; height: 60px; font-size: 1rem; }
  .reason { width: 80px; font-size: 0.7rem; }
  .letter .msg { font-size: 0.85rem; max-width: 90%; }
  .music-toggle { top: 10px; right: 10px; width: 35px; height: 35px; font-size: 1rem; }

  /* Mobile Top Bar - Fixes the squishing */
  .preview-top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 15px;
    gap: 12px;
  }

  .preview-header-left {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .preview-header-right {
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    width: 100%;
    gap: 10px;
  }

  .promo-input-wrapper {
    width: 100%;
    margin-right: 0;
  }

  #previewPromoCode {
    width: 100% !important;
    max-width: 100% !important;
    text-align: center;
  }

  .price-btn {
    width: 100%;
    justify-content: center;
    padding: 12px !important;
  }
  
  input[type="text"], input[type="email"], input[type="date"], input[type="tel"], textarea {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
}


/* ============================================================
   iOS DATE INPUT FIX
   ============================================================ */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  min-height: 48px; /* Forces a minimum height */
  line-height: normal;
}

/* Centers the text inside the date input on iOS */
input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

/* Fixes the calendar icon position */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.7;
  padding: 0;
  margin: 0;
}

@media (min-width: 768px) {
  .app-container { max-width: 750px !important; max-height: 92vh; }
  .form-content-wrapper { padding: 40px 60px 0 60px !important; }
  .form-header h2 { font-size: 2.8rem !important; }
  .form-header p { font-size: 1rem !important; }
  .input-group label { font-size: 0.85rem; }
  input[type="text"], textarea { font-size: 1.05rem !important; padding: 18px 20px !important; }
  .primary-btn { font-size: 1.1rem !important; padding: 18px !important; }
  .secondary-btn { font-size: 1rem !important; padding: 18px 24px !important; }
  .suggestion-card { padding: 20px !important; font-size: 0.9rem !important; }
  
  #livePreviewModal .card { 
    width: 550px !important; 
    height: 850px !important; 
    max-height: 90dvh !important; 
    margin-top: 20px; 
    margin-bottom: 40px; 
  }
  .preview-top-bar { max-width: 750px !important; }
  
  .screen-title { font-size: 3.2rem !important; }
  .screen-subtitle { font-size: 1rem !important; }
  .final-name-highlight { font-size: clamp(3rem, 8vw, 5.5rem) !important; max-height: 200px; }
  .gift-img { width: 180px !important; }
  
  .cake-scene { transform: scale(1.3); margin-bottom: 30px; }
  .blow-hint { font-size: 1.3rem !important; }
  .mic-btn { padding: 15px 30px !important; font-size: 1rem !important; }
  
  .balloon { width: 80px !important; height: 100px !important; font-size: 1.5rem !important; }
  .reason { width: 120px !important; font-size: 1rem !important; padding: 12px 8px !important; }
  .letter .msg { font-size: 1.2rem !important; max-width: 400px !important; }
  .final-teddy { width: 200px !important; }
}