:root {
  --bg-1: #2a0b1f;
  --bg-2: #5b1238;
  --bg-3: #b83261;
  --pink: #ff7aa8;
  --pink-soft: #ffd1e0;
  --cream: #fff6f8;
  --text: #fff;
  --muted: rgba(255, 230, 238, 0.75);
  --btn-yes: linear-gradient(135deg, #ff5f8f, #ff2e6d);
  --btn-alt: linear-gradient(135deg, #ff9ac0, #c56cf0);
  --photo-size: min(64vw, 330px);
  --thumb-size: min(26vw, 240px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-1);
  color: var(--text);
  font-family: "Quicksand", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- background ---------- */
.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 20% 10%, var(--bg-3) 0%, transparent 60%),
    radial-gradient(900px 700px at 85% 90%, #7a1d6b 0%, transparent 60%),
    linear-gradient(160deg, var(--bg-2), var(--bg-1));
  animation: bgShift 18s ease-in-out infinite alternate;
}
@keyframes bgShift {
  0%   { filter: hue-rotate(0deg) saturate(1); }
  100% { filter: hue-rotate(-18deg) saturate(1.15); }
}
.bg-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 122, 168, 0.25), transparent 55%);
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ---------- hearts ---------- */
.hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.heart {
  position: absolute;
  bottom: -60px;
  user-select: none;
  will-change: transform, opacity;
  animation: rise linear forwards;
  filter: drop-shadow(0 0 6px rgba(255, 90, 140, 0.6));
}
.heart > span {
  display: inline-block;
  animation: sway ease-in-out infinite alternate;
}
@keyframes rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  10%  { opacity: var(--o, 0.8); }
  85%  { opacity: var(--o, 0.8); }
  100% { transform: translateY(-115vh) scale(1.1); opacity: 0; }
}
@keyframes sway {
  from { transform: translateX(calc(var(--sway, 20px) * -1)) rotate(-12deg); }
  to   { transform: translateX(var(--sway, 20px)) rotate(12deg); }
}
.burst {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  animation: burst 1s ease-out forwards;
}
@keyframes burst {
  from { transform: translate(0, 0) scale(0.4); opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) scale(1.3) rotate(var(--rot)); opacity: 0; }
}

/* ---------- flash transition ---------- */
.flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, #fff 0%, #ffe3ec 40%, rgba(255, 180, 205, 0.9) 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
}
.flash.go { animation: flash 0.75s ease-in-out; }
@keyframes flash {
  0%   { opacity: 0; }
  35%  { opacity: 1; }
  45%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- card ---------- */
.stage {
  position: relative;
  z-index: 10;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.card {
  width: min(100%, 760px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: opacity 0.3s ease, transform 0.4s ease;
}
.card.out { opacity: 0; transform: scale(0.96); }
.card.in { animation: cardIn 0.6s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* ---------- photo ---------- */
.photo-wrap {
  width: var(--photo-size);
  aspect-ratio: 1;
  position: relative;
  animation: float 6s ease-in-out infinite;
}
.photo-wrap.hidden { display: none; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.photo-wrap::before {
  /* soft glow halo behind photo */
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 48px;
  background: radial-gradient(circle, rgba(255, 122, 168, 0.55), transparent 70%);
  filter: blur(18px);
  z-index: -1;
}
.photo {
  position: absolute;
  inset: 0;
  border-radius: 36px;
  overflow: hidden;
  /* feathered / blurred edges */
  -webkit-mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 62%, rgba(0,0,0,0.6) 80%, transparent 100%);
          mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 62%, rgba(0,0,0,0.6) 80%, transparent 100%);
  background: rgba(255, 255, 255, 0.06);
}
.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.7s ease, transform 1.2s ease;
}
.photo img.show { opacity: 1; transform: scale(1); }
.photo-placeholder {
  position: absolute;
  inset: 14%;
  border: 2px dashed rgba(255, 209, 224, 0.55);
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  opacity: 0.6;
}
.photo.has-img .photo-placeholder { display: none; }

/* ---------- text ---------- */
.step-counter {
  margin: 6px 0 0;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.question {
  margin: 0;
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.15;
  text-shadow: 0 4px 24px rgba(255, 60, 120, 0.55);
}
.question small {
  display: block;
  font-family: "Quicksand", sans-serif;
  font-size: 0.42em;
  font-weight: 600;
  color: var(--muted);
  margin-top: 6px;
}

/* ---------- buttons ---------- */
.options {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  width: 100%;
}
.options.final { flex-direction: column; }
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: 700 1.1rem "Quicksand", sans-serif;
  color: #fff;
  padding: 15px 30px;
  min-width: 150px;
  border-radius: 999px;
  background: var(--btn-yes);
  box-shadow: 0 10px 30px rgba(255, 46, 109, 0.45), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s;
  position: relative;
}
.btn.alt { background: var(--btn-alt); box-shadow: 0 10px 30px rgba(197, 108, 240, 0.4), inset 0 1px 0 rgba(255,255,255,0.35); }
.btn:hover, .btn:focus-visible { transform: translateY(-3px) scale(1.05); filter: brightness(1.08); }
.btn:focus-visible { outline: 3px solid var(--pink-soft); outline-offset: 3px; }
.btn:active { transform: scale(0.96); }
.btn.yes-big { animation: heartbeat 1.6s ease-in-out infinite; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.08); }
  28% { transform: scale(1); }
  42% { transform: scale(1.06); }
}

/* the runaway "Nie" button */
.btn.no {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  min-width: 120px;
}
.btn.no.fleeing {
  position: fixed;
  z-index: 30;
  transition: left 0.35s cubic-bezier(.2,.9,.3,1.3), top 0.35s cubic-bezier(.2,.9,.3,1.3), transform 0.35s;
}
.btn.no.wiggle { animation: wiggle 0.45s ease; }
@keyframes wiggle {
  0%, 100% { rotate: 0deg; }
  25% { rotate: -14deg; }
  50% { rotate: 12deg; }
  75% { rotate: -6deg; }
}

/* ---------- final ---------- */
.final-note {
  max-width: 440px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0;
}
.summary {
  list-style: none;
  padding: 16px 22px;
  margin: 4px 0 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 209, 224, 0.25);
  border-radius: 20px;
  text-align: left;
  backdrop-filter: blur(8px);
}
.summary li { padding: 5px 0; }
.summary b { color: var(--pink-soft); }
.big-emoji { font-size: 4.5rem; animation: heartbeat 1.6s ease-in-out infinite; }

/* ---------- photo 1 VS photo 2 ---------- */
.vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 28px);
  width: 100%;
}
.vs.hidden { display: none; }
.thumb {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  position: relative;
  width: var(--thumb-size);
  aspect-ratio: 1;
  flex: 0 0 auto;
  transition: transform 0.35s cubic-bezier(.2,.9,.3,1.3), opacity 0.4s ease, filter 0.4s ease;
}
.thumb::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 40px;
  background: radial-gradient(circle, rgba(255, 122, 168, 0.5), transparent 70%);
  filter: blur(14px);
  opacity: 0.5;
  transition: opacity 0.35s ease;
  z-index: -1;
}
.thumb .photo { border-radius: 28px; }
.thumb.hot { transform: scale(1.06) rotate(-1deg); }
.thumb.hot::before { opacity: 1; }
.thumb.picked { transform: scale(1.12); }
.thumb.picked::before { opacity: 1; }
.thumb.faded { opacity: 0.25; filter: grayscale(0.8) blur(1px); transform: scale(0.9); }
.vs-label {
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 4rem);
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 90, 140, 0.9), 0 0 32px rgba(255, 46, 109, 0.7);
  animation: vsPulse 1.8s ease-in-out infinite;
  flex: 0 0 auto;
  user-select: none;
}
@keyframes vsPulse {
  0%, 100% { transform: scale(1) rotate(-6deg); }
  50% { transform: scale(1.15) rotate(-6deg); }
}
.btn.hot { transform: translateY(-3px) scale(1.05); filter: brightness(1.08); }

@media (max-width: 599px) {
  :root { --thumb-size: 34vw; }
  .options:not(.final) { flex-direction: column; }
  .options:not(.final) .btn { width: 100%; max-width: 320px; }
  .options:not(.final) .btn.no.fleeing { width: auto; max-width: none; }
  .vs { gap: 6px; }
}

@media (max-height: 700px) {
  :root { --photo-size: min(48vw, 220px); --thumb-size: min(32vw, 150px); }
  .btn { padding: 12px 26px; }
  .card { gap: 10px; }
  .question { font-size: clamp(1.6rem, 6vw, 2.3rem); }
}

@media (prefers-reduced-motion: reduce) {
  .heart, .bg, .bg-glow, .photo-wrap, .btn.yes-big, .vs-label { animation: none !important; }
}
