/* ============================================================
   style.css — theme, layout, components
   Palette & fonts per project spec
   ============================================================ */

:root {
  --pink: #FF4D6D;
  --rose: #FF8FAB;
  --bg: #FFF0F5;
  --accent: #FFD166;
  --white: #FFFFFF;
  --ink: #343A40;

  --glass: rgba(255, 255, 255, 0.35);
  --glass-strong: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.65);
  --shadow: 0 18px 50px rgba(255, 77, 109, 0.22);
  --shadow-soft: 0 8px 24px rgba(255, 77, 109, 0.14);

  --f-head: 'Great Vibes', cursive;
  --f-script: 'Parisienne', cursive;
  --f-quote: 'Dancing Script', cursive;
  --f-body: 'Poppins', system-ui, sans-serif;
  --f-btn: 'Quicksand', sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body { height: 100%; }

body {
  font-family: var(--f-body);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Background layers ---------- */
.bg-gradient {
  position: fixed; inset: 0; z-index: -3;
  background: linear-gradient(135deg, #FFF0F5 0%, #FFE3EC 35%, #FFD9E6 60%, #FFF7E8 100%);
  background-size: 300% 300%;
  animation: gradientShift 18s ease infinite;
}
.bg-blobs { position: fixed; inset: 0; z-index: -2; overflow: hidden; filter: blur(40px); opacity: 0.6; }
.blob { position: absolute; border-radius: 50%; mix-blend-mode: multiply; will-change: transform; }
.blob--1 { width: 42vmax; height: 42vmax; left: -10vmax; top: -12vmax; background: radial-gradient(circle, var(--rose), transparent 70%); animation: blobFloat 22s var(--ease) infinite; }
.blob--2 { width: 36vmax; height: 36vmax; right: -8vmax; top: 20vmax; background: radial-gradient(circle, var(--accent), transparent 70%); animation: blobFloat 26s var(--ease) infinite reverse; }
.blob--3 { width: 30vmax; height: 30vmax; left: 30vmax; bottom: -10vmax; background: radial-gradient(circle, var(--pink), transparent 70%); animation: blobFloat 30s var(--ease) infinite; }

#ambient-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
#fx-canvas { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

/* ---------- Screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(18px, 5vw, 48px);
  opacity: 0; visibility: hidden; transform: scale(1.02);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), visibility 0.6s;
}
.screen--active { opacity: 1; visibility: visible; transform: scale(1); z-index: 10; }

/* ---------- Sound toggle ---------- */
.sound-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 80;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer; box-shadow: var(--shadow-soft);
  font-size: 1.2rem; line-height: 1; transition: transform 0.25s var(--ease);
}
.sound-toggle:hover { transform: scale(1.1); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  font-family: var(--f-btn); font-weight: 700;
  border: none; cursor: pointer; border-radius: 999px;
  padding: 14px 34px; font-size: 1.05rem; color: var(--white);
  background: linear-gradient(135deg, var(--pink), var(--rose));
  box-shadow: var(--shadow); transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), opacity 0.25s;
  letter-spacing: 0.3px; user-select: none;
}
.btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 22px 60px rgba(255, 77, 109, 0.32); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn--glass {
  background: var(--glass-strong); color: var(--pink);
  border: 1px solid var(--glass-border); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); position: relative; overflow: hidden;
}
.btn--glass::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.5); transition: box-shadow 0.4s;
}
.btn--glass:hover::after { box-shadow: 0 0 36px 4px rgba(255, 143, 171, 0.55); }

.btn--ghost {
  background: transparent; color: var(--pink);
  box-shadow: none; border: 1.5px solid var(--rose);
}
.btn--ghost:hover { background: rgba(255, 143, 171, 0.12); transform: translateY(-2px); }

.btn--primary.is-disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-soft); }

.btn--yes { font-size: 1.3rem; padding: 18px 46px; }
.btn--no {
  font-size: 1.3rem; padding: 18px 46px;
  background: linear-gradient(135deg, #adb5bd, #ced4da); color: #fff;
  transition: transform 0.18s ease, left 0.18s ease, top 0.18s ease;
  z-index: 30;
}
.btn__spark { display: inline-block; }

/* ============================================================
   Screen 1 — Preloader
   ============================================================ */
.preloader { text-align: center; }
.preloader__heart { font-size: clamp(72px, 18vw, 140px); animation: heartbeat 1.1s ease-in-out infinite; filter: drop-shadow(0 10px 24px rgba(255, 77, 109, 0.4)); }
.preloader__text { margin-top: 22px; font-family: var(--f-quote); font-size: clamp(1.3rem, 4vw, 2rem); color: var(--pink); }
.dots i { animation: dotBlink 1.4s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }

/* ============================================================
   Screen 2 — Landing
   ============================================================ */
.landing { text-align: center; max-width: 720px; }
.typewriter {
  font-family: var(--f-script); color: var(--ink);
  font-size: clamp(1.8rem, 6vw, 3.4rem); line-height: 1.25; min-height: 1.5em;
}
.caret { color: var(--pink); animation: caretBlink 0.8s steps(1) infinite; font-family: var(--f-body); font-weight: 300; }
.continue-btn { margin-top: 40px; opacity: 0; transform: translateY(24px); pointer-events: none; }
.continue-btn.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; animation: fadeUp 0.7s var(--ease); }

/* ============================================================
   Screen 3 — Main question
   ============================================================ */
.question-hero { text-align: center; max-width: 760px; transition: transform 0.5s var(--ease), opacity 0.5s; }
.question-hero.is-bursting { transform: scale(1.08); opacity: 0; }
.question-hero__heart { font-size: clamp(80px, 20vw, 160px); animation: heartbeat 1.2s ease-in-out infinite; filter: drop-shadow(0 12px 30px rgba(255, 77, 109, 0.45)); }
.question-hero__title { font-family: var(--f-head); font-weight: 400; font-size: clamp(2.4rem, 8vw, 5rem); color: var(--pink); line-height: 1.05; margin: 10px 0 36px; }
.question-hero__buttons { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.no-teaser { margin-top: 26px; font-family: var(--f-quote); font-size: 1.3rem; color: var(--pink); min-height: 1.4em; }
.no-teaser b { font-family: var(--f-body); font-weight: 600; }

/* ============================================================
   Screen 4 — Questionnaire
   ============================================================ */
#screen-questionnaire { flex-direction: column; }
.heart-progress { display: flex; gap: 8px; margin-bottom: clamp(18px, 4vh, 40px); font-size: 1.5rem; }
.heart-progress__pip { opacity: 0.6; transition: transform 0.3s var(--ease), opacity 0.3s; color: var(--rose); }
.heart-progress__pip.is-on { opacity: 1; transform: scale(1.18); }

.slides { position: relative; width: min(680px, 100%); flex: 1; display: flex; align-items: center; }
.slide {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  opacity: 0; transform: translateX(60px); pointer-events: none;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.slide--active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.slide--prev { transform: translateX(-60px); }
.slide__title { font-family: var(--f-head); font-weight: 400; font-size: clamp(2rem, 6vw, 3.2rem); color: var(--pink); text-align: center; line-height: 1.1; }
.slide__hint { font-family: var(--f-quote); color: var(--ink); opacity: 0.7; font-size: 1.05rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; width: 100%; max-height: 56vh; overflow-y: auto; padding: 4px; }
.card-grid--time { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); max-width: 460px; margin: 0 auto; }

.card {
  font-family: var(--f-btn); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; border-radius: 22px;
  background: var(--glass-strong); border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft); color: var(--ink);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s, background 0.25s;
}
.card:hover { transform: translateY(-4px) scale(1.03); box-shadow: var(--shadow); border-color: var(--rose); }
.card.is-selected { background: linear-gradient(135deg, var(--pink), var(--rose)); color: var(--white); border-color: transparent; box-shadow: var(--shadow); }
.card__icon { font-size: 2rem; line-height: 1; }
.card__label { font-size: 0.95rem; font-weight: 600; }

.custom-wrap { width: 100%; max-width: 420px; }
.custom-input, .textarea, .date-input {
  font-family: var(--f-body); width: 100%; padding: 14px 18px;
  border-radius: 16px; border: 1.5px solid var(--glass-border);
  background: var(--glass-strong); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); color: var(--ink); font-size: 1rem;
  outline: none; transition: border-color 0.25s, box-shadow 0.25s;
}
.textarea { resize: vertical; min-height: 110px; max-width: 480px; }
.date-input { max-width: 320px; text-align: center; font-size: 1.1rem; }
.custom-input:focus, .textarea:focus, .date-input:focus { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.25); }

.slide-nav { display: flex; gap: 16px; margin-top: clamp(18px, 4vh, 36px); }

/* ============================================================
   Screen 5 — Review
   ============================================================ */
.review { width: min(560px, 100%); text-align: center; }
.review__title { font-family: var(--f-head); font-weight: 400; font-size: clamp(2rem, 6vw, 3rem); color: var(--pink); margin-bottom: 24px; }
.review-card {
  background: var(--glass-strong); border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 26px; box-shadow: var(--shadow); padding: 12px 8px;
  text-align: left; animation: fadeUp 0.6s var(--ease);
}
.review-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px dashed rgba(255, 143, 171, 0.4); }
.review-row:last-child { border-bottom: none; }
.review-row__icon { font-size: 1.2rem; }
.review-row__label { font-weight: 600; color: var(--ink); opacity: 0.7; font-size: 0.92rem; }
.review-row__value { font-weight: 600; color: var(--pink); text-align: right; max-width: 60%; }
.review__actions { display: flex; gap: 16px; justify-content: center; margin-top: 28px; }

/* ============================================================
   Screen 6 — Submit / envelope
   ============================================================ */
.submit-stage { text-align: center; }
.envelope {
  position: relative; width: 220px; height: 150px; margin: 0 auto;
  transition: transform 1.4s var(--ease), opacity 1.4s var(--ease);
}
.envelope__back, .envelope__front, .envelope__flap, .envelope__letter { position: absolute; inset: 0; border-radius: 12px; }
.envelope__back { background: var(--pink); }
.envelope__letter {
  background: var(--white); border-radius: 8px; top: -36px; height: 120px;
  width: 88%; left: 6%; box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  transition: top 0.8s var(--ease); z-index: 1;
}
.envelope.is-sealing .envelope__letter { top: 14px; }
.envelope__front {
  background: linear-gradient(135deg, var(--rose), var(--pink));
  z-index: 2; clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0, 50% 58%);
}
.envelope__flap {
  background: linear-gradient(135deg, #ff6b8a, var(--pink)); z-index: 3;
  transform-origin: top; clip-path: polygon(0 0, 100% 0, 50% 62%);
  transform: rotateX(180deg); transition: transform 0.8s var(--ease);
}
.envelope.is-sealing .envelope__flap { transform: rotateX(0deg); }
.envelope__seal {
  position: absolute; top: 38%; left: 50%; transform: translate(-50%,-50%) scale(0);
  z-index: 4; font-size: 1.8rem; transition: transform 0.4s var(--ease) 0.7s;
}
.envelope.is-sealing .envelope__seal { transform: translate(-50%,-50%) scale(1); }
.envelope.is-flying { transform: translateY(-130vh) rotate(-12deg) scale(0.5); opacity: 0; }
.submit-stage__text { margin-top: 40px; font-family: var(--f-quote); font-size: 1.6rem; color: var(--pink); animation: pulse 1.6s ease-in-out infinite; }

/* ============================================================
   Screen 7 — Final
   ============================================================ */
.final { text-align: center; max-width: 620px; }
.final__heart { font-size: clamp(80px, 18vw, 150px); animation: heartbeat 1.1s ease-in-out infinite; filter: drop-shadow(0 12px 30px rgba(255, 77, 109, 0.45)); }
.final__title { font-family: var(--f-head); font-weight: 400; font-size: clamp(3rem, 10vw, 6rem); color: var(--pink); line-height: 1; }
.final__text { font-family: var(--f-script); font-size: clamp(1.4rem, 4vw, 2.2rem); color: var(--ink); margin-top: 8px; line-height: 1.3; }
.final__sub { margin-top: 18px; font-family: var(--f-quote); font-size: 1.25rem; color: var(--pink); }
.final .btn { margin-top: 34px; }

/* ============================================================
   Toast / idle message
   ============================================================ */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 30px);
  z-index: 90; background: var(--ink); color: var(--white);
  padding: 14px 26px; border-radius: 999px; font-family: var(--f-btn);
  font-weight: 600; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); max-width: 90vw; text-align: center;
}
.toast.is-visible { opacity: 0.97; transform: translate(-50%, 0); }

/* ---------- Mouse-trail hearts ---------- */
.mouse-heart {
  position: fixed; z-index: 70; pointer-events: none; color: var(--rose);
  transform: translate(-50%, -50%); animation: trailFade 0.9s ease-out forwards;
}
