@import url('https://fonts.googleapis.com/css2?family=Cormorant+Infant:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Great+Vibes&display=swap');

/* ---------- Design tokens ---------- */
:root {
  --night-900: #0d0414;
  --night-800: #1a0822;
  --night-700: #2b0f33;
  --rose-300: #f9a8d4;
  --rose-400: #f472b6;
  --rose-500: #ec4899;
  --rose-700: #be185d;
  --blush: #ffe4f1;
  --gold: #fcd9a8;
  --lilac: #c4b5fd;

  --text: #fff5fa;
  --text-muted: #f3c9dd;
  --glass: rgba(255, 228, 241, 0.07);
  --glass-strong: rgba(255, 228, 241, 0.12);
  --glass-border: rgba(249, 168, 212, 0.25);
  --ring: #fbcfe8;

  --font-script: 'Great Vibes', cursive;
  --font-serif: 'Cormorant Infant', Georgia, serif;

  --radius-card: 28px;
  --radius-pill: 999px;
  --shadow-glow: 0 20px 60px -20px rgba(236, 72, 153, 0.55);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  height: 100%;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--night-900);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 110%, var(--night-700) 0%, transparent 60%),
    radial-gradient(90% 70% at 50% -10%, #3a0f3a 0%, transparent 55%),
    linear-gradient(180deg, var(--night-900) 0%, var(--night-800) 100%);
}

.aurora::before,
.aurora::after,
.aurora span {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}

.aurora::before {
  width: 60vmax;
  height: 60vmax;
  left: -15vmax;
  top: -20vmax;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.7), transparent 65%);
  animation: drift-a 16s ease-in-out infinite alternate;
}

.aurora::after {
  width: 55vmax;
  height: 55vmax;
  right: -18vmax;
  bottom: -22vmax;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.55), transparent 65%);
  animation: drift-b 20s ease-in-out infinite alternate;
}

.aurora span {
  width: 40vmax;
  height: 40vmax;
  left: 40%;
  top: 35%;
  background: radial-gradient(circle, rgba(252, 217, 168, 0.35), transparent 65%);
  animation: drift-c 24s ease-in-out infinite alternate;
}

/* soft twinkling stars */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 72%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 34%, #ffe4f1 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 26%, #ffe4f1 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 88%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 52% 90%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 94% 84%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 8%, #fff 50%, transparent 51%);
  animation: twinkle 5s ease-in-out infinite alternate;
}

@keyframes drift-a { to { transform: translate(12vmax, 10vmax) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-10vmax, -8vmax) scale(1.15); } }
@keyframes drift-c { to { transform: translate(-14vmax, 6vmax) scale(0.9); } }
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.9; } }

/* particle canvas (hearts + trail) */
#love-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Layout ---------- */
.stage {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.screen {
  width: 100%;
  display: grid;
  place-items: center;
  animation: rise-in 700ms var(--ease-out) both;
}

.screen[hidden] {
  display: none;
}

.card {
  position: relative;
  width: min(100%, 460px);
  padding: clamp(28px, 6vw, 44px) clamp(22px, 5vw, 40px);
  text-align: center;
  background: linear-gradient(160deg, var(--glass-strong), var(--glass));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.card > * + * {
  margin-top: 18px;
}

/* ---------- Typography ---------- */
.script {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  line-height: 1.1;
  color: var(--blush);
  text-shadow: 0 0 24px rgba(244, 114, 182, 0.55);
}

.lead {
  font-size: clamp(1.3rem, 4.4vw, 1.6rem);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  text-wrap: balance;
}

.muted {
  color: var(--text-muted);
  font-style: italic;
}

.eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rose-300);
}

/* ---------- Media ---------- */
.portrait {
  width: 168px;
  height: 168px;
  margin-inline: auto;
  object-fit: contain;
  border-radius: 50%;
  padding: 10px;
  background: radial-gradient(circle, rgba(255, 228, 241, 0.16), rgba(255, 228, 241, 0.04) 70%);
  box-shadow: 0 0 0 1px var(--glass-border), 0 0 40px rgba(244, 114, 182, 0.35);
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  50% { transform: translateY(-8px); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  min-width: 132px;
  padding: 12px 30px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out),
    background-color 200ms, border-color 200ms, opacity 200ms;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 4px;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--rose-500), var(--rose-700));
  box-shadow: 0 10px 30px -8px rgba(236, 72, 153, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -10px rgba(236, 72, 153, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-ghost {
  background: rgba(255, 228, 241, 0.08);
  border-color: var(--glass-border);
  color: var(--blush);
}

.btn-ghost:hover {
  background: rgba(255, 228, 241, 0.16);
  border-color: rgba(249, 168, 212, 0.5);
  transform: translateY(-2px);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.icon-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--blush);
  background: rgba(255, 228, 241, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 200ms, transform 200ms var(--ease-out);
}

.icon-btn:hover {
  background: rgba(255, 228, 241, 0.18);
  transform: scale(1.05);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: 8px;
  text-align: left;
}

.field label {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text);
  text-align: center;
  letter-spacing: 0.2em;
  background: rgba(13, 4, 20, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  transition: border-color 200ms, box-shadow 200ms;
}

.input::placeholder {
  color: rgba(243, 201, 221, 0.55);
  letter-spacing: 0.05em;
}

.input:focus {
  outline: none;
  border-color: var(--rose-300);
  box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.25);
}

.input[aria-invalid='true'] {
  border-color: #fda4af;
}

.error {
  min-height: 1.5em;
  font-size: 1.05rem;
  font-style: italic;
  color: #fecdd3;
}

.shake {
  animation: shake 420ms ease-in-out;
}

@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* ---------- Dialog ---------- */
dialog.love-dialog {
  margin: auto;
  width: min(92vw, 380px);
  padding: 0;
  color: var(--text);
  background: transparent;
  border: none;
  overflow: visible;
}

dialog.love-dialog::backdrop {
  background: rgba(13, 4, 20, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

dialog.love-dialog[open] .card {
  animation: pop-in 320ms var(--ease-out) both;
  background: linear-gradient(160deg, rgba(58, 15, 58, 0.95), rgba(26, 8, 34, 0.95));
}

/* ---------- Motion ---------- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: none; }
}

.fade-out {
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 450ms var(--ease-out), transform 450ms var(--ease-out);
}

.heart-mark {
  width: 44px;
  height: 44px;
  margin-inline: auto;
  color: var(--rose-400);
  filter: drop-shadow(0 0 12px rgba(244, 114, 182, 0.7));
  animation: heartbeat 1.6s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.icon-btn svg[hidden] {
  display: none;
}
