/* =============================================================================
   STYLES.CSS  --  "Golden-hour romance". You don't need to edit this.
   Tweak the palette below if you want a different mood.
============================================================================= */

:root {
  /* --- Palette (warm dusk) --- */
  --base:        #2a1024;   /* deep plum base */
  --rose:        #ff5c8a;
  --rose-soft:   #ff90b3;
  --coral:       #ff7b54;
  --amber:       #ffba6b;
  --gold:        #ffd9a0;
  --cream:       #fff4e9;
  --plum:        #7b2c5e;

  --ink:         #fff4ec;            /* primary text on dark */
  --ink-dim:     rgba(255,244,236,0.72);
  --ink-faint:   rgba(255,244,236,0.5);

  --glass:       rgba(255, 238, 230, 0.07);
  --glass-edge:  rgba(255, 224, 200, 0.35);
  --glass-hi:    rgba(255,255,255,0.22);

  --good:        #7be3a3;
  --bad:         #ff8aa0;

  --shadow:      0 30px 80px -20px rgba(20, 4, 18, 0.7);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --body:  "Quicksand", ui-rounded, system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--base);
  overflow-x: hidden;          /* keep the runaway button from making sideways scroll */
  overflow-y: auto;            /* but allow scrolling when a message is long */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;   /* no grey flash on iOS taps */
}

/* =============================================================================
   BACKGROUND LAYERS
============================================================================= */

/* Living gradient sky: layered radial blooms over the base, slowly drifting. */
.sky {
  position: fixed;
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(40% 55% at 18% 22%, rgba(255, 124, 84, 0.55), transparent 60%),
    radial-gradient(45% 50% at 82% 18%, rgba(255, 92, 138, 0.55), transparent 62%),
    radial-gradient(55% 60% at 75% 82%, rgba(123, 44, 94, 0.65), transparent 60%),
    radial-gradient(50% 55% at 22% 85%, rgba(255, 186, 107, 0.4), transparent 62%),
    radial-gradient(120% 120% at 50% 50%, #3a142f, #1f0a1b 80%);
  filter: saturate(1.05);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: scale(1.05) translate3d(-1.5%, -1%, 0); }
  50%  { transform: scale(1.12) translate3d(1.5%, 1.5%, 0); }
  100% { transform: scale(1.05) translate3d(1%, -1.5%, 0); }
}

/* Floating hearts and romantic touches (spawned by JS into #hearts). */
.hearts { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.heart {
  position: absolute;
  bottom: -48px;
  color: var(--rose-soft);
  filter: drop-shadow(0 4px 10px rgba(255, 92, 138, 0.4));
  animation: floatUp linear forwards;
  will-change: transform, opacity;
}
@keyframes floatUp {
  0%   { transform: translateY(0) translateX(0) rotate(0deg) scale(0.7); }
  15%  { transform: translateY(-12vh) translateX(calc(var(--drift, 0px) * 0.2)) rotate(calc(var(--spin, 20deg) * 0.2)) scale(1); }
  100% { transform: translateY(-112vh) translateX(var(--drift, 0px)) rotate(var(--spin, 40deg)) scale(1.05); }
}
/* Sweet floating words (Mahrousa, hayati, babycakes, sweetheart). */
.heart.word {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  white-space: nowrap;
  color: var(--gold);
  letter-spacing: 0.01em;
  filter: drop-shadow(0 2px 12px rgba(255, 200, 140, 0.35));
}

/* Confetti canvas sits above the sky but below content text shadows. */
#confetti { position: fixed; inset: 0; z-index: 5; pointer-events: none; }

/* Film grain for warmth. */
.grain {
  position: fixed; inset: 0; z-index: 6; pointer-events: none;
  opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Vignette to draw the eye inward. */
.vignette {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(18,4,16,0.55) 100%);
}

/* =============================================================================
   LAYOUT
============================================================================= */
#app {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    calc(24px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
}

.screen { width: 100%; display: grid; place-items: center; }

/* =============================================================================
   CARD  (frosted glass + gold hairline)
============================================================================= */
.card {
  position: relative;
  width: min(92vw, 560px);
  padding: 44px 40px 40px;
  text-align: center;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,238,228,0.12), rgba(255,238,228,0.05));
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.card-wide { width: min(94vw, 760px); }

/* Soft gold glow ring */
.card::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--gold), transparent 35%, transparent 65%, var(--rose));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.6; pointer-events: none;
}

/* =============================================================================
   TYPOGRAPHY
============================================================================= */
.title {
  font-family: var(--serif);
  font-weight: 500;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 44px);
  text-shadow: 0 2px 30px rgba(255, 150, 120, 0.25);
}
.title.big {
  font-size: clamp(34px, 7vw, 60px);
  font-style: italic;
  margin-bottom: 28px;
  background: linear-gradient(180deg, #fff7f0, var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle {
  font-family: var(--body);
  font-weight: 500;
  color: var(--ink-dim);
  font-size: clamp(15px, 2.4vw, 18px);
  margin: 6px auto 26px;
  max-width: 46ch;
  line-height: 1.5;
}

/* Optional GIF pinned to the top of any screen's card. It always renders as a
   modest topper -- smaller than the content below -- no matter its real size. */
.screen-gif {
  display: flex;
  justify-content: center;
  margin: -6px 0 20px;
}
.screen-gif img {
  width: auto;
  height: auto;
  max-width: min(70%, 280px);     /* clearly narrower than the card */
  max-height: clamp(84px, 15vh, 150px);
  object-fit: contain;            /* never crop the GIF */
  border-radius: 14px;
  box-shadow: 0 12px 30px -14px rgba(20, 4, 18, 0.6);
}
@media (max-width: 600px) {
  .screen-gif img { max-width: min(60%, 200px); max-height: 110px; }
}

/* Small caption beneath the Yes/No buttons on the proposal screen,
   and the P.S. line beneath the buttons on the result screen. */
.proposal-note,
.result-ps {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: clamp(13px, 2vw, 15px);
  margin: 22px auto 0;
  max-width: 44ch;
  line-height: 1.5;
}

/* =============================================================================
   BUTTONS
============================================================================= */
.btn-row {
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
}
.btn {
  font-family: var(--body);
  font-weight: 700;
  font-size: clamp(16px, 2.4vw, 19px);
  letter-spacing: 0.01em;
  padding: 15px 34px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: #fff;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s ease, filter 0.2s ease;
  will-change: transform;
}
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.btn-yes {
  background: linear-gradient(135deg, var(--rose), var(--coral) 70%, var(--amber));
  box-shadow: 0 14px 34px -10px rgba(255, 92, 138, 0.8), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-yes:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 22px 46px -10px rgba(255, 92, 138, 0.95); filter: brightness(1.05); }
.btn-yes:active { transform: translateY(0) scale(0.98); }
.btn-yes.grow { transform: scale(1.16); box-shadow: 0 26px 60px -12px rgba(255, 92, 138, 1); }
.btn-yes.pop { animation: pop 0.6s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.btn-no {
  background: rgba(255,255,255,0.08);
  color: var(--ink-dim);
  border: 1px solid rgba(255,255,255,0.25);
  z-index: 50;
}
.btn-no:hover { color: var(--ink); }
/* Once it breaks free of the card it must float above every other layer. */
.btn.runaway {
  z-index: 9999;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.55);
  transition: left 0.18s cubic-bezier(.34,1.56,.64,1),
              top 0.18s cubic-bezier(.34,1.56,.64,1),
              transform 0.18s ease;
}

.btn-ghost {
  margin-top: 26px;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid rgba(255,255,255,0.22);
  font-weight: 600;
}
.btn-ghost:hover { color: var(--ink); transform: translateY(-2px); border-color: var(--gold); }

/* Result page: Try again + Read it again sit side by side. */
.result-actions { margin-top: 28px; }
.result-actions .btn-ghost { margin-top: 0; }
@media (max-width: 420px) {
  .result-actions { flex-direction: column; align-items: center; }
  .result-actions .btn { width: 100%; max-width: 280px; }
}

/* =============================================================================
   QUESTIONS
============================================================================= */
.progress {
  height: 7px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
  margin-bottom: 14px;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--rose), var(--coral));
  background-size: 200% 100%;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
  animation: shimmer 2.5s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }

.qcount {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 18px;
  font-weight: 600;
}

.options { display: grid; gap: 14px; margin-top: 28px; }

/* Text options: single column, wide tappable pills. */
.text-options { grid-template-columns: 1fr; }

/* Photo options: responsive grid. */
.photo-options { grid-template-columns: repeat(2, 1fr); }
.photo-options.n3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 540px) {
  .photo-options, .photo-options.n3 { grid-template-columns: repeat(2, 1fr); }
}

.choice {
  position: relative;
  font-family: var(--body);
  cursor: pointer;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), border-color 0.2s, background 0.2s, box-shadow 0.25s;
}
.choice:hover:not(.locked) {
  transform: translateY(-3px);
  border-color: var(--gold);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 16px 34px -16px rgba(255, 200, 140, 0.7);
}

.text-choice {
  padding: 17px 22px;
  font-size: clamp(15px, 2.4vw, 18px);
  font-weight: 600;
  text-align: center;
}

.photo-choice {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 4 / 5;            /* portrait-friendly for iPhone photos */
  display: flex;
  align-items: flex-end;
  background: #1b0814;
}
/* Blurred, zoomed copy of the photo fills the tile behind the real image. */
.photo-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(22px) brightness(0.6) saturate(1.1);
  transform: scale(1.25);        /* hide the blurred edges */
  z-index: 0;
}
/* The real photo, shown WHOLE so nothing (no faces!) gets cropped. */
.photo-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  z-index: 1;
  transition: transform 0.5s ease;
}
.photo-choice:hover:not(.locked) .photo-img { transform: scale(1.04); }

/* Tap-to-zoom button */
.zoom-btn {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: rgba(20,4,16,0.55);
  color: #fff; font-size: 16px; line-height: 1;
  cursor: pointer; backdrop-filter: blur(4px);
  transition: background 0.2s, transform 0.15s;
}
.zoom-btn:hover { background: rgba(20,4,16,0.8); transform: scale(1.08); }
.photo-choice.locked .zoom-btn { display: none; }

.photo-label {
  position: relative; z-index: 2;
  width: 100%;
  padding: 10px 12px;
  font-size: 14px; font-weight: 600;
  background: linear-gradient(0deg, rgba(20,4,16,0.85), transparent);
  text-align: left;
}

/* =============================================================================
   LIGHTBOX
============================================================================= */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: rgba(12, 3, 10, 0);
  backdrop-filter: blur(0px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
  cursor: zoom-out;
}
.lightbox.show {
  background: rgba(12, 3, 10, 0.88);
  backdrop-filter: blur(8px);
}
.lightbox img {
  /* Always fit within the visible screen, never the photo's full resolution.
     Leave room for the close button (top) and the notch / browser bars.
     svh = the small viewport height, so it fits even when mobile UI is shown. */
  width: auto;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 96px);
  max-height: calc(100svh - 96px);
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.8);
  transform: scale(0.96); opacity: 0;
  transition: transform 0.28s cubic-bezier(.22,1,.36,1), opacity 0.28s ease;
}
.lightbox.show img { transform: scale(1); opacity: 1; }
.lightbox-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top)); right: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer;
  background: rgba(255,255,255,0.15); color: #fff; font-size: 20px;
  backdrop-filter: blur(6px);
}
.lightbox-close:hover { background: rgba(255,255,255,0.28); }
.img-missing {
  display: grid; place-items: center;
}
.img-missing-label {
  position: relative; z-index: 2;
  color: var(--ink-faint);
  font-size: 13px; letter-spacing: 0.05em;
}

/* Answer reveal states */
.choice.locked { cursor: default; }
.choice.is-correct {
  border-color: var(--good);
  background: rgba(123, 227, 163, 0.16);
  box-shadow: 0 0 0 2px var(--good), 0 16px 34px -16px rgba(123,227,163,0.6);
}
.choice.is-wrong {
  border-color: var(--bad);
  background: rgba(255, 138, 160, 0.16);
  box-shadow: 0 0 0 2px var(--bad);
}
.choice.locked:not(.is-correct):not(.is-wrong) { opacity: 0.55; }

.feedback {
  margin-top: 8px;
  min-height: 24px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s;
}
.feedback.show { opacity: 1; transform: none; margin-top: 22px; }
.feedback.good { color: var(--good); }
.feedback.bad  { color: var(--bad); }
.feedback .spacer { height: 14px; }

/* =============================================================================
   RESULT
============================================================================= */
.score-badge {
  display: inline-grid;
  place-items: center;
  width: 116px; height: 116px;
  margin: 4px auto 18px;
  border-radius: 50%;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 34px;
  color: #3a142f;
  background: radial-gradient(circle at 35% 30%, #fff7ec, var(--gold) 60%, var(--amber));
  box-shadow: 0 18px 44px -14px rgba(255, 186, 107, 0.9), inset 0 2px 4px rgba(255,255,255,0.6);
  animation: badgeIn 0.7s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes badgeIn {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.message {
  font-family: var(--serif);
  font-size: clamp(17px, 2.6vw, 21px);
  font-style: italic;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-wrap;
  margin: 22px auto 0;
  max-width: 52ch;
  text-wrap: pretty;
}
.signature {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 0.02em;
}

/* =============================================================================
   ENTRANCE ANIMATION  (staggered reveal of card contents)
============================================================================= */
.screen-enter .card { animation: cardIn 0.7s cubic-bezier(.22,1,.36,1) both; }
@keyframes cardIn {
  0% { opacity: 0; transform: translateY(26px) scale(0.97); filter: blur(6px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
.screen-enter .card > * { animation: itemIn 0.6s cubic-bezier(.22,1,.36,1) both; }
.screen-enter .card > *:nth-child(1) { animation-delay: 0.12s; }
.screen-enter .card > *:nth-child(2) { animation-delay: 0.20s; }
.screen-enter .card > *:nth-child(3) { animation-delay: 0.28s; }
.screen-enter .card > *:nth-child(4) { animation-delay: 0.36s; }
.screen-enter .card > *:nth-child(5) { animation-delay: 0.44s; }
.screen-enter .card > *:nth-child(6) { animation-delay: 0.52s; }
@keyframes itemIn {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: none; }
}

/* =============================================================================
   MOBILE / iPhone tuning
============================================================================= */
@media (max-width: 600px) {
  .card { padding: 34px 22px 30px; border-radius: 24px; }
  .card-wide { width: min(94vw, 760px); }
  .btn { padding: 16px 30px; }              /* comfortable 48px+ tap targets */
  .btn-row { gap: 14px; }
  .options { margin-top: 22px; }
  .text-choice { padding: 18px 18px; }      /* bigger touch targets */
  .message { font-size: 18px; }
  /* On a phone, the runaway No button never needs hover; touch handles it. */
}

/* Very short landscape phones: don't force full-height centering. */
@media (max-height: 520px) {
  #app { padding-top: 16px; padding-bottom: 16px; }
}

/* Loading spinner */
.loader {
  width: 46px; height: 46px;
  margin: 6px auto 18px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .sky { animation: none; }
}
