:root {
  --pink: #f4a4c0;
  --pink-hot: #e86a9b;
  --pink-deep: #d94f86;
  --lavender: #c9b6d9;
  --bg-top: #fff0f5;
  --bg-mid: #f8d5e5;
  --bg-bot: #ecd5e8;
  --card: #ffffffee;
  --ink: #5c1a33;
  --ink-soft: #8a4a62;
  --muted: #a8909c;
  --no: #b59bc9;
  --shadow: 0 18px 50px rgba(180, 80, 120, 0.18);
  --radius: 28px;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bot) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  min-height: 100dvh;
}

.bg-glow {
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 182, 210, 0.45), transparent 42%),
    radial-gradient(circle at 80% 70%, rgba(210, 170, 230, 0.35), transparent 40%);
  pointer-events: none;
  z-index: 0;
  animation: glowPulse 8s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  from { transform: scale(1); opacity: 0.85; }
  to { transform: scale(1.08); opacity: 1; }
}

.bg-petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.petal {
  position: absolute;
  font-size: 1rem;
  opacity: 0.35;
  animation: drift linear infinite;
  user-select: none;
}

@keyframes drift {
  0% { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(360deg); }
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  min-height: 100svh;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem calc(1.5rem + var(--safe-bottom));
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
  animation: fadeIn 0.45s ease;
}

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

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(100%, 440px);
  padding: 1.75rem 1.4rem 1.5rem;
  text-align: center;
  position: relative;
}

.card--ask { overflow: visible; }

.card--celebrate {
  padding: 2.4rem 1.5rem 1.8rem;
  animation: celebratePop 0.55s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes celebratePop {
  0% { opacity: 0; transform: scale(0.82); }
  70% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

.celebrate-burst {
  font-size: clamp(2.2rem, 8vw, 3rem);
  letter-spacing: 0.2em;
  margin-bottom: 0.55rem;
  animation: burstPulse 1.1s ease-in-out infinite;
}

@keyframes burstPulse {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.12) rotate(2deg); }
}

.celebrate-hearts {
  color: var(--pink-hot);
  letter-spacing: 0.45em;
  font-size: 1.25rem;
  margin-bottom: 0.9rem;
  animation: heartbeat 1.4s ease-in-out infinite;
}

.celebrate-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 5.5vw, 2rem) !important;
  margin-bottom: 0.7rem !important;
  line-height: 1.2;
}

.celebrate-sub {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 3.8vw, 1.2rem);
  line-height: 1.4;
  margin-bottom: 0.85rem;
}

.celebrate-ps {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.35;
}

.card--form,
.card--food,
.card--letter {
  width: min(100%, 460px);
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pink-deep);
  margin-bottom: 0.85rem;
  font-weight: 700;
}

.pug-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.pug {
  width: min(148px, 38vw);
  height: min(148px, 38vw);
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(120, 60, 90, 0.15);
  animation: softFloat 3.6s ease-in-out infinite;
}

@keyframes softFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.question,
.card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.45rem, 5.2vw, 1.95rem);
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 0.65rem;
}

.soft-line {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
  letter-spacing: 0.02em;
}

.btn-row {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 3.2rem;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.78rem 1.55rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-yes {
  background: var(--pink-hot);
  color: #fff;
  box-shadow: 0 8px 20px rgba(232, 106, 155, 0.35);
  text-transform: lowercase;
  min-width: 7.5rem;
  font-size: 1.05rem;
}

.btn-yes:hover {
  background: var(--pink-deep);
  transform: translateY(-1px) scale(1.03);
}

.btn-no {
  background: var(--no);
  color: #fff;
  font-weight: 600;
  text-transform: lowercase;
  padding: 0.6rem 1.15rem;
  font-size: 0.92rem;
  position: relative;
  z-index: 5;
  transition: left 0.16s ease-out, top 0.16s ease-out;
  touch-action: none;
  will-change: left, top;
}

.btn-no.is-fleeing {
  position: fixed !important;
  margin: 0;
  z-index: 200;
  pointer-events: auto;
  box-shadow: 0 8px 22px rgba(120, 80, 150, 0.35);
}

.sound-toggle,
.back-btn {
  position: fixed;
  z-index: 120;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px);
}

.sound-toggle {
  top: max(0.75rem, env(safe-area-inset-top));
  right: 0.75rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 16px rgba(180, 80, 120, 0.18);
  font-size: 1.15rem;
}

.sound-toggle.is-muted {
  opacity: 0.7;
}

.back-btn {
  top: max(0.85rem, env(safe-area-inset-top));
  left: 0.75rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 4px 16px rgba(180, 80, 120, 0.15);
}

.back-btn:hover {
  background: #fff;
  color: var(--ink);
}

.bg-hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-heart {
  position: absolute;
  bottom: -8vh;
  color: #e86a9b;
  animation: heartRise linear infinite;
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(232, 106, 155, 0.25));
}

@keyframes heartRise {
  0% {
    transform: translateY(0) translateX(0) scale(0.85);
    opacity: 0;
  }
  12% { opacity: 0.55; }
  50% {
    transform: translateY(-55vh) translateX(18px) scale(1);
  }
  100% {
    transform: translateY(-110vh) translateX(-12px) scale(1.1);
    opacity: 0;
  }
}

.btn-pink {
  background: var(--pink-hot);
  color: #fff;
  box-shadow: 0 8px 20px rgba(232, 106, 155, 0.35);
}

.btn-pink:hover:not(:disabled) {
  background: var(--pink-deep);
  transform: translateY(-1px);
}

.btn-pink:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  font-weight: 600;
  margin-top: 0.35rem;
}

.btn-wide {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.9rem 1.25rem;
  font-size: 1.02rem;
  text-transform: lowercase;
}

.icon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.cal-icon {
  display: inline-flex;
  flex-direction: column;
  width: 42px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-family: var(--font-body);
  line-height: 1;
}

.cal-month {
  background: #e85a5a;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0;
  text-transform: uppercase;
}

.cal-day {
  background: #fff;
  color: #222;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.25rem 0 0.3rem;
}

.paws {
  font-size: 1.1rem;
  letter-spacing: 0.15em;
}

.field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 1rem;
  text-align: left;
  width: 100%;
}

.field span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px; /* prevents iOS zoom */
  padding: 0.8rem 0.9rem;
  border: 1.5px solid #ecd4de;
  border-radius: 14px;
  background: #fffafc;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--pink-hot);
  box-shadow: 0 0 0 3px rgba(232, 106, 155, 0.18);
}

.char-count {
  text-align: right;
  color: var(--muted);
  font-size: 0.8rem;
  margin: -0.4rem 0 0.8rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
}

.choice-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 420px) {
  .choice-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .choice-grid--2 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.95rem 0.35rem;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #f3eef1;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  min-height: 88px;
}

.choice:hover,
.choice:focus-visible {
  background: #fce8f0;
  border-color: var(--pink);
  transform: translateY(-2px);
}

.choice.selected {
  background: #fde4ef;
  border-color: var(--pink-hot);
  box-shadow: 0 0 0 2px rgba(232, 106, 155, 0.2);
}

.choice-emoji {
  font-size: 1.7rem;
  line-height: 1;
}

.choice-emoji--alfa {
  filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(450%) hue-rotate(75deg) brightness(0.95);
  display: inline-block;
}

.choice-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(120, 60, 90, 0.18);
}

.choice--figo span:last-child {
  font-size: 0.78rem;
  line-height: 1.15;
}

.stack-choices {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.stack-choice {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  width: 100%;
  padding: 0.95rem 1rem;
  border: 2px solid transparent;
  border-radius: 18px;
  background: #f3eef1;
  color: var(--ink);
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.stack-choice:hover,
.stack-choice:focus-visible,
.stack-choice.selected {
  background: #fde4ef;
  border-color: var(--pink-hot);
  transform: translateY(-1px);
}

.stack-emoji {
  font-size: 1.55rem;
  flex-shrink: 0;
}

.stack-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stack-text strong {
  font-size: 0.98rem;
}

.stack-text small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.card--letter h1 {
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  margin-bottom: 1rem;
}

.ps {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 3.5vw, 1.08rem);
  color: var(--ink-soft);
  line-height: 1.45;
  margin-bottom: 1.15rem;
}

.hearts-row {
  color: var(--pink-hot);
  letter-spacing: 0.35em;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  animation: heartbeat 1.8s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.letter-summary {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.55;
  padding: 0.85rem 0.2rem 0.35rem;
  border-top: 1px solid #f0d8e2;
  text-align: left;
}

.letter-summary .row {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.letter-summary .label {
  color: var(--muted);
  min-width: 5.5rem;
}

.letter-actions {
  margin-top: 1rem;
}

.marry-box {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid #f0d8e2;
  text-align: center;
}

.marry-label {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.marry-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.marry-hint span {
  opacity: 0.85;
}

.marry-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: #1a0a12;
  box-shadow: 0 8px 24px rgba(120, 40, 70, 0.18);
}

.marry-frame iframe,
#yt-marry-player {
  width: 100%;
  height: 100%;
}

.btn-marry {
  background: linear-gradient(135deg, #e86a9b, #c45a8a);
  color: #fff;
  box-shadow: 0 8px 20px rgba(232, 106, 155, 0.28);
  text-transform: none;
  letter-spacing: 0.02em;
}

.btn-marry.is-playing {
  background: #f3eef1;
  color: var(--ink-soft);
  box-shadow: none;
}

.status-line {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

.status-line.ok { color: #2f8f5b; }
.status-line.err { color: #b14a5a; }

.ig-note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0.35rem 0 0.85rem;
}

#btn-calendar {
  margin-top: 0.15rem;
  font-size: 0.95rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120%);
  z-index: 300;
  max-width: min(92vw, 360px);
  padding: 0.85rem 1.1rem;
  border-radius: 16px;
  background: rgba(92, 26, 51, 0.94);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 12px 32px rgba(80, 20, 50, 0.28);
  transition: transform 0.28s ease, opacity 0.28s ease;
  opacity: 0;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

@media (max-width: 380px) {
  .card {
    padding: 1.35rem 1rem 1.2rem;
    border-radius: 22px;
  }

  .choice {
    min-height: 80px;
    font-size: 0.78rem;
    padding: 0.75rem 0.25rem;
  }

  .choice-emoji { font-size: 1.45rem; }

  .btn-yes { min-width: 6.5rem; }
}
