:root {
  --pink-soft: #FFE4EF;
  --pink-mid: #FFB6D3;
  --pink-deep: #FF7BAC;
  --pink-accent: #E8477A;
  --cream: #FFF8F3;
  --blush: #FDEEF5;
  --lavender: #F0E6FF;
  --gold: #FFD700;
  --text-dark: #3D1A24;
  --text-mid: #7A3B55;
  --text-light: #C06090;
}

body.theme-boy {
  --pink-soft: #E3F2FD;
  --pink-mid: #90CAF9;
  --pink-deep: #2196F3;
  --pink-accent: #1565C0;
  --cream: #F5FAFF;
  --blush: #EAF4FF;
  --lavender: #E0ECFF;
  --gold: #FFD700;
  --text-dark: #14253D;
  --text-mid: #345A85;
  --text-light: #6FA0C8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  background: var(--blush);
  color: var(--text-dark);
  overflow-x: hidden;
  min-height: 100vh;
  transition: background 0.4s ease;
}

.font-playfair { font-family: 'Playfair Display', serif; }
.font-dancing { font-family: 'Dancing Script', cursive; }

.page {
  display: none;
  min-height: 100vh;
  animation: fadeInPage 0.6s ease;
}

.page.active {
  display: block;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInCard {
  from { transform: translateY(16px); }
  to { transform: translateY(0); }
}

.bg-dots {
  background-image: radial-gradient(circle, var(--pink-mid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: var(--blush);
}

.page-shell {
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 16px 10px;
}

.Rani.compact {
  max-width: 520px;
}

.card-cute {
  background: white;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(232, 71, 122, 0.12), 0 2px 8px rgba(232, 71, 122, 0.08);
  border: 1.5px solid rgba(255, 182, 211, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: visible;
}

.card-cute:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(232, 71, 122, 0.18);
}

.card-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  padding: 3px 24px;
  background: rgba(255, 182, 211, 0.5);
  border-radius: 999px;
  color: var(--text-mid);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  z-index: 3;
}

.custom-alert {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translate(-50%, -14px);
  min-width: min(92vw, 360px);
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: 18px;
  border: 1.5px solid rgba(232, 71, 122, 0.35);
  background: linear-gradient(135deg, rgba(255, 228, 239, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: 0 12px 30px rgba(232, 71, 122, 0.18);
  color: var(--text-dark);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.custom-alert.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.custom-alert.error {
  border-color: rgba(232, 71, 122, 0.45);
}

.custom-alert.success {
  border-color: rgba(18, 136, 91, 0.4);
  background: linear-gradient(135deg, rgba(230, 255, 243, 0.98), rgba(255, 255, 255, 0.98));
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.92rem;
  color: var(--text-mid);
  border-bottom: 1px dashed rgba(255, 182, 211, 0.4);
}

.feature-list li:last-child {
  border-bottom: none;
}

.badge-free {
  background: #dcfce7;
  color: #16a34a;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.badge-pay {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.price-tag {
  background: linear-gradient(135deg, var(--pink-deep), var(--pink-accent));
  color: white;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 1.4rem;
  font-weight: 700;
  display: inline-block;
}

.price-strike {
  text-decoration: line-through;
  color: var(--text-light);
  font-size: 1rem;
}

.coupon-input-wrap {
  display: flex;
  gap: 10px;
}

.coupon-input-wrap .input-cute {
  border-radius: 16px;
}

.payment-secure {
  font-size: 0.75rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 10px;
}

.link-box {
  background: var(--pink-soft);
  border: 2px dashed var(--pink-mid);
  border-radius: 16px;
  padding: 16px 20px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text-mid);
  word-break: break-all;
  text-align: center;
}

.share-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 0.95rem;
}

.title-badge {
  display: inline-block;
  background: var(--lavender);
  color: var(--pink-accent);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 12px;
}

.header-title {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  margin: 0;
}

.subtitle {
  margin: 0;
  color: var(--text-mid);
  font-size: 1rem;
}

.sticker-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 16px;
}

.sticker {
  display: inline-block;
  font-size: 2rem;
  animation: wiggle 3s ease-in-out infinite;
}

.footer-stickers {
  margin-top: 18px;
}

.text-center { text-align: center; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.form-stack > * + * { margin-top: 10px; }
.question-block { margin-top: 0; }
.field-label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.gender-toggle-wrap {
  display: flex;
  gap: 10px;
}

.gender-btn,
.btn-pink,
.btn-apply {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 700;
}

.gender-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: 16px;
  border: 2px solid var(--pink-mid);
  background: white;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gender-btn.active {
  background: linear-gradient(135deg, var(--pink-deep), var(--pink-accent));
  color: white;
  border-color: var(--pink-accent);
  box-shadow: 0 6px 16px rgba(232, 71, 122, 0.3);
}

.input-cute {
  width: 100%;
  padding: 14px 20px;
  border-radius: 16px;
  border: 2px solid var(--pink-mid);
  background: white;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-cute:focus {
  border-color: var(--pink-deep);
  box-shadow: 0 0 0 4px rgba(255, 123, 172, 0.15);
}

.input-cute::placeholder {
  color: var(--text-light);
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.btn-pink,
.btn-apply {
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--pink-deep), var(--pink-accent));
  color: white;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(232, 71, 122, 0.35);
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.btn-pink:hover,
.btn-apply:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(232, 71, 122, 0.45);
}

.btn-pink:active,
.btn-apply:active {
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  color: var(--pink-accent);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 36px;
  border-radius: 50px;
  border: 2px solid var(--pink-deep);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-outline:hover {
  background: var(--pink-soft);
  transform: translateY(-2px);
}

.shine-effect {
  position: relative;
  overflow: hidden;
}

.shine-effect::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { left: -100%; }
  100% { left: 200%; }
}

.w-full { width: 100%; }

.flip-card {
  perspective: 1000px;
  cursor: pointer;
  height: 190px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s 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: 20px;
}

.flip-card-back {
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: linear-gradient(135deg, var(--pink-soft), #ffffff);
  border: 1.5px solid rgba(255, 182, 211, 0.55);
  box-shadow: 0 8px 24px rgba(232, 71, 122, 0.14);
  color: var(--text-dark);
}

.flip-card-back .font-dancing {
  color: var(--pink-accent);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.text-5xl { font-size: 3rem; }
.text-4xl { font-size: 2.6rem; }
.text-3xl { font-size: 2rem; }
.text-xl { font-size: 1.5rem; }
.text-xs { font-size: 0.8rem; }
.font-semibold { font-weight: 700; }
.text-white { color: #fff; }

.letter-card,
.payment-card,
.share-card {
  padding: 28px;
}

.letter-greeting {
  font-size: 2.2rem;
  margin: 8px 0 14px;
}

.letter-message,
.letter-sender {
  font-size: 1rem;
  line-height: 1.8;
}

.divider-hearts {
  color: var(--pink-accent);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.reason-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.reason-card {
  background: white;
  border-radius: 20px;
  padding: 18px 20px;
  border-left: 4px solid var(--pink-deep);
  box-shadow: 0 4px 16px rgba(232,71,122,0.1);
  animation: slideInCard 0.5s ease forwards;
  opacity: 1;
}

.reason-card .text-2xl {
  line-height: 1;
}

.flower-btn {
  cursor: pointer;
  transition: transform 0.3s ease;
  animation: floatUpDown 2.5s ease-in-out infinite;
}

.flower-btn:nth-child(2) {
  animation-delay: 0.8s;
}

.flower-btn:nth-child(3) {
  animation-delay: 1.6s;
}

.flower-btn:hover {
  transform: scale(1.15) rotate(5deg);
}

.tape {
  display: inline-block;
  background: rgba(255, 182, 211, 0.5);
  padding: 3px 24px;
  transform: rotate(-2deg);
  font-size: 0.7rem;
  color: var(--text-mid);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
}

.gift-step {
  display: none;
}

.gift-step.active {
  display: block;
}

.cake-wrap,
.gift-box-wrap {
  text-align: center;
}

.cake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gift-box-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cake-svg {
  position: relative;
  width: 220px;
  height: 200px;
  margin: 0 auto 20px;
}

.cake-bottom,
.cake-mid,
.frosting,
.flame,
.smoke {
  position: absolute;
}

.cake-bottom {
  width: 170px;
  height: 72px;
  background: linear-gradient(180deg, #ff9bc3, #ff6ba6);
  border-radius: 18px 18px 28px 28px;
  left: 25px;
  bottom: 28px;
}

.cake-mid {
  width: 124px;
  height: 58px;
  background: linear-gradient(180deg, #ffd9e8, #ff98bf);
  border-radius: 16px;
  left: 48px;
  bottom: 94px;
}

.frosting {
  width: 140px;
  height: 24px;
  background: #fff4f8;
  border-radius: 20px;
  left: 40px;
  bottom: 108px;
}

.flame {
  width: 18px;
  height: 24px;
  background: linear-gradient(180deg, #fff8b3, #ff9100);
  clip-path: polygon(50% 0%, 74% 34%, 92% 78%, 50% 100%, 8% 78%, 26% 34%);
  left: 100px;
  top: 42px;
  transition: transform 0.5s ease;
}

.smoke {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  left: 101px;
  top: 20px;
  filter: blur(1px);
}

#cakeSvg.blown #flameGroup {
  opacity: 0;
  transition: opacity 0.4s ease;
}

#cakeSvg.blown #smokeGroup {
  opacity: 1;
  transition: opacity 0.5s ease;
}

.gift-candle-name,
.gift-recipient-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0;
}

.gift-box {
  width: 100%;
  max-width: 320px;
  height: 220px;
  margin: 0 auto;
  position: relative;
  cursor: pointer;
  transition: height 0.3s ease;
}

.gift-box.opened {
  height: auto;
  cursor: default;
}

.gift-box-closed,
.gift-box-opened {
  border-radius: 24px;
}

.gift-box-closed {
  position: absolute;
  inset: 0;
  background: transparent;
  box-shadow: 0 18px 30px rgba(235, 78, 132, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gift-box-closed .illustration {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(232, 71, 122, 0.2));
}

.gift-box-opened {
  position: relative;
  background: linear-gradient(135deg, var(--pink-soft), var(--lavender));
  opacity: 0;
  transform: scale(0.85);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
  pointer-events: none;
}

.gift-open-content {
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 228, 239, 0.94));
  border: 1.5px solid rgba(255, 182, 211, 0.7);
  border-radius: 20px;
  padding: 20px 18px;
  box-shadow: 0 10px 24px rgba(232, 71, 122, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  width: 100%;
  position: relative;
  box-sizing: border-box;
}

.gift-open-content::before,
.gift-open-content::after {
  content: '';
  position: absolute;
  top: -10px;
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--pink-deep), var(--pink-accent));
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(232, 71, 122, 0.22);
}

.gift-open-content::before {
  left: -8px;
}

.gift-open-content::after {
  right: -8px;
}

#giftOpenTitle {
  color: var(--text-dark);
  letter-spacing: 0.3px;
}

#giftOpenMessage {
  line-height: 1.5;
  word-break: break-word;
  color: var(--pink-accent);
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: break-word;
}

#giftOpenSignature {
  color: var(--text-mid);
  font-weight: 700;
}

.gift-box.opened .gift-box-closed {
  opacity: 0;
}

.gift-box.opened .gift-box-opened {
  opacity: 1;
  transform: scale(1);
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed #efbfd0;
}

.total-row {
  margin-top: 18px;
}

.coupon-box {
  margin-top: 18px;
}

.coupon-row {
  display: flex;
  gap: 10px;
}

.coupon-row .input-cute {
  flex: 1;
}

.btn-apply {
  min-width: 98px;
}

.coupon-msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
}

.coupon-msg.hidden {
  display: none;
}

.coupon-success {
  background: #e9f9ee;
  color: #177349;
}

.coupon-error {
  background: #fff0f2;
  color: #9d1d3d;
}

.share-link-wrap {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

#musicBtn,
.music-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  border: 2px solid var(--pink-mid);
  box-shadow: 0 4px 12px rgba(232,71,122,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

#musicBtn:hover,
.music-btn:hover {
  transform: scale(1.1);
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(540deg);
    opacity: 0;
  }
}

@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.float-anim { animation: floatUpDown 3s ease-in-out infinite; }
.float-anim-delay { animation: floatUpDown 3s ease-in-out infinite 1.5s; }

@keyframes floatUpDown {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.heart-pulse { animation: heartBeat 1.5s ease-in-out infinite; }

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.emoji-bounce { animation: emojiBounce 2s ease-in-out infinite; }

@keyframes emojiBounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-8px) rotate(-5deg); }
  75% { transform: translateY(-4px) rotate(5deg); }
}

@keyframes wiggle {
  0%, 90%, 100% { transform: rotate(0deg); }
  92% { transform: rotate(-5deg); }
  96% { transform: rotate(5deg); }
}

@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .coupon-row,
  .share-link-wrap { flex-direction: column; }
}
