:root {
  --bg-1: #ffe6ec;
  --bg-2: #fff3e8;
  --card: rgba(255, 255, 255, 0.85);
  --text: #3f2e35;
  --accent: #f46fa1;
  --accent-dark: #d95388;
  --muted: #7a5c67;
  --btn-no: #fbc7d9;
  --shadow: 0 12px 35px rgba(122, 54, 86, 0.18);
  --nav-height: 72px;
  --nav-lift: 100px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 20%, #fff7fa 0%, #ffeef4 40%, #ffe8f0 100%);
}

.app-shell {
  width: 100%;
  max-width: 520px;
  height: 100dvh;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(155deg, var(--bg-1), var(--bg-2));
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0.4;
  pointer-events: none;
}

.app-shell::before {
  width: 260px;
  height: 260px;
  background: #ffd4e3;
  top: -120px;
  left: -80px;
}

.app-shell::after {
  width: 220px;
  height: 220px;
  background: #ffe1c9;
  bottom: -100px;
  right: -90px;
}

.slider {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  transition: transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1);
  touch-action: none;
  will-change: transform;
}

.slide {
  width: 100%;
  min-width: 100%;
  height: 100%;
  padding: 24px 18px calc(24px + var(--nav-lift));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.word-slide h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(3rem, 14vw, 5rem);
  margin: 0;
  animation: softPop 0.7s ease;
  text-align: center;
}

.card {
  width: 100%;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  border-radius: 28px;
  padding: 26px 20px;
  text-align: center;
}

.media-card {
  padding: 14px;
}

.hero-image {
  width: 100%;
  max-height: min(58dvh, 520px);
  object-fit: cover;
  border-radius: 20px;
  display: block;
  margin-bottom: 14px;
}

h2,
.valentine-text,
.small-message {
  margin: 0 0 14px;
}

h2 {
  font-family: "Playfair Display", serif;
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  line-height: 1.2;
}

p {
  margin: 0;
  line-height: 1.5;
}

.long-text {
  font-size: clamp(1.15rem, 5vw, 1.45rem);
}

.valentine-text {
  font-size: 1rem;
  line-height: 1.5;
}

.valentine-text.emphasis {
  margin-top: 8px;
  font-size: 1.1rem;
}

.small-message {
  color: var(--muted);
  min-height: 1.4em;
}

input {
  width: 100%;
  border: 1px solid #f1cad8;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1rem;
  margin-bottom: 12px;
  background: #fff;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 120px;
  color: #fff;
  background: var(--accent);
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn:hover {
  background: var(--accent-dark);
}

.nav-controls {
  position: relative;
  flex: 0 0 auto;
  min-height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translateY(calc(-1 * var(--nav-lift)));
  gap: 10px;
  z-index: 35;
  pointer-events: auto;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}

.nav-btn {
  min-width: 96px;
  padding: 11px 18px;
  font-size: 0.96rem;
  background: rgba(244, 111, 161, 0.9);
  box-shadow: 0 8px 20px rgba(95, 45, 72, 0.2);
  pointer-events: auto;
}

.nav-prev {
  background: rgba(184, 112, 142, 0.9);
}

.no-btn {
  color: #684b58;
  background: var(--btn-no);
}

.button-row,
.button-stack {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.button-stack {
  flex-direction: column;
}

.cat-popup {
  width: 95px;
  height: 95px;
  object-fit: cover;
  border-radius: 16px;
  margin: 8px auto 10px;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.shake {
  animation: shake 0.45s ease;
}

.bounce {
  animation: bounce 0.55s ease;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(49, 15, 30, 0.72);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay-content {
  width: 100%;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.95);
  padding: 26px 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.floating-hearts,
.confetti,
.heart-rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.heart {
  position: absolute;
  bottom: -30px;
  font-size: 16px;
  animation: floatHeart 3s linear infinite;
  opacity: 0.9;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: fallConfetti 2.8s linear infinite;
}

.heart-drop {
  position: absolute;
  top: -20px;
  font-size: 18px;
  animation: rainHeart 2.2s linear infinite;
}

.final-content h2 {
  margin-bottom: 12px;
}

#loveMessage {
  opacity: 0;
  font-size: 1.15rem;
  animation: fadeIn 1.4s ease forwards;
  animation-delay: 0.7s;
}

@keyframes softPop {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(8px);
  }
  75% {
    transform: translateX(-6px);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  70% {
    transform: translateY(-4px);
  }
}

@keyframes floatHeart {
  from {
    transform: translateY(0) scale(0.8);
    opacity: 0.8;
  }
  to {
    transform: translateY(-220px) scale(1.2);
    opacity: 0;
  }
}

@keyframes fallConfetti {
  from {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  to {
    transform: translateY(115vh) rotate(360deg);
    opacity: 0.6;
  }
}

@keyframes rainHeart {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(115vh);
    opacity: 0.2;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 431px) {
  body {
    background: linear-gradient(135deg, #ffe7f0, #fff3ea);
  }

  .app-shell {
    margin: 16px auto;
    border-radius: 30px;
    height: calc(100dvh - 32px);
    min-height: calc(100vh - 32px);
    border: 1px solid #ffd8e8;
    box-shadow: 0 25px 45px rgba(95, 45, 72, 0.2);
  }

  .slide {
    height: 100%;
    padding-bottom: calc(24px + var(--nav-lift));
  }
}

@media (min-width: 768px) {
  .nav-btn {
    min-width: 120px;
    padding: 12px 22px;
    font-size: 1rem;
  }
}
