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

:root {
  --pink: #ff4d6d;
  --pink-light: #ff758f;
  --pink-dark: #c9184a;
  --rose: #ff477e;
  --magenta: #ff0a54;
  --lavender: #e8b4f8;
  --gold: #ffd700;
  --bg-gradient: linear-gradient(135deg, #1a0011 0%, #2d0a1e 25%, #1a0a2e 50%, #0d001a 100%);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text: #fff;
  --text-muted: rgba(255, 255, 255, 0.65);
  --radius: 24px;
  --shadow: 0 8px 32px rgba(255, 77, 109, 0.25);
  /* safe area insets for notched phones */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* prevent pull-to-refresh on mobile */
  overscroll-behavior: none;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

/* ===== CREATOR SCREEN SCROLL WRAPPER ===== */
.screen-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 0;
}

/* ===== SNAP SCROLL ===== */
.snap-scroll {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.snap-scroll::-webkit-scrollbar {
  width: 3px;
}

.snap-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.snap-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 77, 109, 0.25);
  border-radius: 3px;
}

/* ===== SNAP PAGES ===== */
.snap-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  position: relative;
}

.page-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 380px;
  width: 100%;
  animation: pageIn 0.8s ease both;
}

/* ===== HEADER PAGE ===== */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 16px 0;
  background: linear-gradient(135deg, var(--pink-light), var(--lavender));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sparkle-big {
  font-size: 2.2rem;
  animation: sparkleFloat 2s ease-in-out infinite;
}

/* ===== PAGE CARD ===== */
.page-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 36px 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(255, 77, 109, 0.1), 0 0 80px rgba(255, 77, 109, 0.05);
  width: 100%;
}

.page-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12%;
  height: 76%;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--pink), var(--lavender));
  opacity: 0.6;
}

.page-card p {
  font-size: 1.1rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  z-index: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 77, 109, 0.06) 0%, transparent 60%);
  pointer-events: none;
  animation: cardGlowPulse 4s ease-in-out infinite;
}

/* ===== SCROLL HINT ===== */
.scroll-hint {
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.85rem;
  animation: fadeInOut 2.5s ease-in-out infinite;
  padding: 20px 0;
}

.scroll-hint.abs {
  position: absolute;
  bottom: max(30px, var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
}

.scroll-arrow {
  font-size: 1.3rem;
  margin-top: 4px;
  animation: bounceDown 1.5s ease-in-out infinite;
}

/* ===== FINAL BUTTONS ===== */
.final-buttons {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* ===== GLASS CARD ===== */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow), 0 0 80px rgba(255, 77, 109, 0.08);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(255, 77, 109, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* ===== TYPOGRAPHY ===== */
.script {
  font-family: 'Dancing Script', cursive;
}

.title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--pink-light), var(--lavender));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 18px;
}

.highlight {
  font-family: 'Dancing Script', cursive;
  font-size: 2.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink), var(--gold), var(--rose));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  animation: shimmer 3s ease-in-out infinite;
}

.question {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 10px 0;
}

/* ===== EMOJIS ===== */
.envelope-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  animation: float 3s ease-in-out infinite;
}

.rose-emoji {
  font-size: 2.8rem;
  margin-bottom: 6px;
}

.bear-emoji {
  font-size: 2.8rem;
  margin: 12px 0;
}

.mega-heart {
  font-size: 4rem;
  animation: heartbeat 1s ease-in-out infinite;
}

/* ===== USED SCREEN ===== */
.used-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

.used-message {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 8px 0;
}

.used-sub {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  margin: 4px 0 16px;
  font-style: italic;
}

.used-hearts {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 2rem;
  margin: 8px 0;
}

.used-hearts span {
  animation: float 2s ease-in-out infinite;
}

.used-hearts span:nth-child(2) {
  animation-delay: 0.4s;
}

.used-hearts span:nth-child(3) {
  animation-delay: 0.8s;
}

/* ===== INPUT ===== */
.input-group {
  margin-bottom: 14px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.label-hint {
  font-size: 0.65rem;
  text-transform: none;
  opacity: 0.6;
  letter-spacing: 0;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
  /* prevent iOS zoom on focus */
  font-size: 16px;
}

.input-group textarea {
  resize: vertical;
  min-height: 100px;
  max-height: 200px;
  line-height: 1.6;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 20px rgba(255, 77, 109, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 50px;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  /* min touch target */
  min-height: 48px;
  -webkit-user-select: none;
  user-select: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:active::after {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--magenta));
  color: white;
  box-shadow: 0 4px 20px rgba(255, 77, 109, 0.4);
  width: 100%;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-arrow {
  width: 18px;
  height: 18px;
}

.btn-yes {
  background: linear-gradient(135deg, var(--pink), var(--magenta));
  color: white;
  box-shadow: 0 4px 20px rgba(255, 77, 109, 0.4);
  padding: 16px 36px;
  font-size: 1.1rem;
  z-index: 2;
  min-height: 52px;
  flex: 1;
}

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

.btn-no {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.95rem;
  padding: 14px 24px;
  z-index: 999;
  transition: all 0.3s ease;
  min-height: 48px;
}

.btn-no.dodging {
  position: fixed;
  transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== LINK OUTPUT ===== */
.link-output {
  margin-top: 16px;
  animation: slideUp 0.5s ease;
}

.link-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.link-box {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.link-box input {
  flex: 1;
  padding: 12px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--pink-light);
  font-size: 0.7rem;
  font-family: 'Outfit', sans-serif;
  outline: none;
  /* prevent iOS zoom */
  font-size: 16px;
}

.btn-copy {
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-copy:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.95);
}

.copied-msg {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--pink-light);
  animation: fadeIn 0.3s ease;
}

/* ===== YES SCREEN ===== */
.yes-message {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin: 14px 0;
}

.love-emojis {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 1.6rem;
  margin: 14px 0;
}

.love-emojis span {
  animation: float 2s ease-in-out infinite;
}

.love-emojis span:nth-child(2) {
  animation-delay: 0.3s;
}

.love-emojis span:nth-child(3) {
  animation-delay: 0.6s;
}

.love-emojis span:nth-child(4) {
  animation-delay: 0.9s;
}

.love-emojis span:nth-child(5) {
  animation-delay: 1.2s;
}

.forever-text {
  margin-top: 10px;
  font-family: 'Dancing Script', cursive;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--gold), var(--pink-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== DOWNLOAD SECTION ===== */
.download-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  animation: slideUp 0.8s ease 0.5s both;
}

.download-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.card-preview {
  width: 100%;
  max-width: 240px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(255, 77, 109, 0.2);
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.download-btn {
  animation: pulse 2.5s ease-in-out infinite;
}

/* ===== FLOATING HEARTS ===== */
.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  bottom: -60px;
  font-size: 1.5rem;
  opacity: 0;
  animation: floatUp linear forwards;
}

/* ===== CONFETTI ===== */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  opacity: 0.9;
  animation: confettiFall linear forwards;
}

/* ===== HEARTS BURST ===== */
.hearts-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.burst-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.5rem;
  animation: burstOut 1.5s ease-out forwards;
}

.hidden {
  display: none !important;
}

/* ===== ANIMATIONS ===== */
@keyframes float {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-12px)
  }
}

@keyframes heartbeat {

  0%,
  100% {
    transform: scale(1)
  }

  15% {
    transform: scale(1.3)
  }

  30% {
    transform: scale(1)
  }

  45% {
    transform: scale(1.2)
  }
}

@keyframes shimmer {

  0%,
  100% {
    filter: brightness(1)
  }

  50% {
    filter: brightness(1.3) drop-shadow(0 0 20px rgba(255, 77, 109, 0.4))
  }
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 4px 20px rgba(255, 77, 109, 0.4)
  }

  50% {
    box-shadow: 0 4px 40px rgba(255, 77, 109, 0.7), 0 0 60px rgba(255, 77, 109, 0.3)
  }
}

@keyframes shake {

  0%,
  100% {
    transform: rotate(0)
  }

  25% {
    transform: rotate(-5deg)
  }

  75% {
    transform: rotate(5deg)
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px)
  }

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

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes fadeInOut {

  0%,
  100% {
    opacity: 0.2
  }

  50% {
    opacity: 0.6
  }
}

@keyframes bounceDown {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(10px)
  }
}

@keyframes sparkleFloat {

  0%,
  100% {
    transform: translateY(0) rotate(0);
    opacity: 0.6
  }

  50% {
    transform: translateY(-8px) rotate(15deg);
    opacity: 1
  }
}

@keyframes cardGlowPulse {

  0%,
  100% {
    opacity: 0.5
  }

  50% {
    opacity: 1
  }
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95)
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1)
  }
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(0) rotate(0) scale(1)
  }

  10% {
    opacity: 0.7
  }

  90% {
    opacity: 0.3
  }

  100% {
    opacity: 0;
    transform: translateY(-110vh) rotate(360deg) scale(0.5)
  }
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotateZ(0) rotateX(0)
  }

  100% {
    opacity: 0;
    transform: translateY(100vh) rotateZ(720deg) rotateX(360deg)
  }
}

@keyframes burstOut {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0)
  }

  60% {
    opacity: 1
  }

  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(1.5)
  }
}

/* ===== GLOW ORBS ===== */
body::before,
body::after {
  content: '';
  position: fixed;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background: var(--pink);
  top: -100px;
  right: -100px;
  animation: float 8s ease-in-out infinite;
}

body::after {
  background: var(--lavender);
  bottom: -100px;
  left: -100px;
  animation: float 10s ease-in-out infinite reverse;
}

.pulse-btn {
  animation: pulse 2.5s ease-in-out infinite;
}

/* ===== RESPONSIVE ===== */
@media (min-width:500px) {
  .glass-card {
    padding: 40px 32px;
    max-width: 420px;
  }

  .title {
    font-size: 2.4rem;
  }

  .highlight {
    font-size: 3.2rem;
  }

  .page-card p {
    font-size: 1.25rem;
  }

  .page-title {
    font-size: 2.6rem;
  }

  .page-content {
    max-width: 420px;
  }
}

/* Extra small phones */
@media (max-height: 600px) {
  .snap-page {
    padding: 16px;
  }

  .page-card {
    padding: 24px 18px;
  }

  .page-card p {
    font-size: 1rem;
  }

  .glass-card {
    padding: 24px 18px;
  }

  .envelope-icon {
    font-size: 2.5rem;
    margin-bottom: 6px;
  }

  .title {
    font-size: 1.7rem;
  }

  .highlight {
    font-size: 2.2rem;
  }
}