: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: var(--ep-accent, linear-gradient(135deg, #ff5f8f, #ff2e6d));
  --btn-alt: var(--ep-alt, linear-gradient(135deg, #ff9ac0, #c56cf0));
  --glow: var(--ep-glow, 255, 90, 140);
  --photo-size: min(64vw, 330px);
  --thumb-size: min(26vw, 240px);
}

* { box-sizing: border-box; }

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

/* background + animations: runtime/themes.css (served by event-planner-cms) */
#scene { position: fixed; inset: 0; z-index: 0; }

/* ---------- flash transition ---------- */
.flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, #fff 0%, var(--ep-flash, #ffe3ec) 40%, rgba(var(--glow), 0.55) 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(var(--glow), 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(var(--glow), 0.6), 0 2px 6px rgba(0, 0, 0, 0.35);
}
.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(var(--glow), 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(0, 0, 0, 0.3), 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(var(--glow), 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(var(--glow), 0.9), 0 0 32px rgba(var(--glow), 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; }
}

/* Step 1 only: small Tak/Nie side by side on every screen, so "Nie" has room to run around */
.options.yesno { flex-direction: row !important; gap: 12px; }
.options.yesno .btn { width: auto !important; max-width: none !important; min-width: 0; padding: 10px 22px; font-size: 1rem; }

@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) {
  .photo-wrap, .btn.yes-big, .vs-label { animation: none !important; }
}

/* ---------- CMS-driven layouts ---------- */
.card.loading { opacity: 0; }
.btn { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.question { overflow-wrap: anywhere; }
/* 3+ options: buttons wrap, thumbnails become a captioned grid */
.options.many { flex-wrap: wrap; }
.vs.grid { flex-wrap: wrap; gap: 14px; max-width: 760px; }
.vs.grid .thumb { width: min(var(--thumb-size), 200px); }
.vs.grid.n3 .thumb, .vs.grid.n4 .thumb { width: min(26vw, 170px); }
.photo.text-frame {
  color: #fff;
  font-family: "Quicksand", sans-serif;
  display: grid;
  place-items: center;
  padding: 12%;
  text-align: center;
  font-weight: 700;
  font-size: clamp(0.85rem, 3.6vw, 1.15rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
  background: rgba(255, 255, 255, 0.12);
  -webkit-mask-image: none;
          mask-image: none;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.thumb-cap {
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  max-width: 100%;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary b { display: block; font-weight: 600; font-size: 0.85rem; }
.summary li + li { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.summary { max-width: min(92vw, 460px); max-height: 40vh; overflow: auto; }
@media (max-width: 599px) {
  .vs.grid .thumb, .vs.grid.n3 .thumb, .vs.grid.n4 .thumb { width: 28vw; }
  .vs.grid .thumb-cap { display: none; }
  .options.many:not(.final) .btn { padding: 11px 20px; }
}
/* lots of options on a short phone screen: allow the card to scroll */
@media (max-height: 760px), (max-width: 599px) {
  html, body { overflow: auto; }
  .stage { min-height: 100%; height: auto; }
}

/* ---------- credit ---------- */
.credit.site {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  margin: 0; padding: 6px 16px max(8px, env(safe-area-inset-bottom));
  text-align: center; font-size: 0.8rem; color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); pointer-events: none;
}
.credit.site a { color: #fff; font-weight: 700; text-decoration: none; pointer-events: auto; }
.credit.site a:hover { text-decoration: underline; }
.stage { padding-bottom: max(40px, calc(env(safe-area-inset-bottom) + 30px)); }
