/* ============================================================
   screens.css — Layout, Screen-Übergänge, Screen-Spezifika
   ============================================================ */

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ---------------- Screen-Container ---------------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(28px, 0, 0) scale(0.97);
  transition:
    transform 0.62s var(--ease-out),
    opacity 0.42s var(--ease-out),
    visibility 0s linear 0.62s;
  will-change: transform, opacity;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  transition:
    transform 0.62s var(--ease-out),
    opacity 0.42s var(--ease-out) 0.08s,
    visibility 0s linear 0s;
}

/* verlassener Screen zieht nach links weg */
.screen.is-past {
  opacity: 0;
  transform: translate3d(-28px, 0, 0) scale(0.97);
}

.screen__inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  padding: calc(var(--pad-top) + 8px) 20px calc(var(--pad-bot) + 8px);
}
.screen__inner--center {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.screen__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  flex: 0 0 auto;
  padding-top: 4px;
}

.screen__foot {
  flex: 0 0 auto;
  padding-top: 6px;
  width: 100%;
}

.screen__actions { width: 100%; padding-top: 8px; }

/* Phasen innerhalb eines Screens (Screen 4 + 6) */
.phase {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
}
.phase[hidden] { display: none; }
.phase--result { justify-content: center; text-align: center; gap: 14px; }
.phase--final  { justify-content: center; align-items: center; text-align: center; gap: 14px; }

#phaseLoading { justify-content: center; }
#phaseSlider  { justify-content: center; }

/* ---------------- Eintritts-Stagger ---------------- */
.stagger { opacity: 0; transform: translateY(18px) scale(0.98); }
.screen.is-active .stagger {
  animation: stagger-in 0.62s var(--ease-pop) forwards;
  animation-delay: calc(var(--i, 0) * 65ms + 90ms);
}
@keyframes stagger-in {
  to { opacity: 1; transform: none; }
}

/* ---------------- Screen 1: großes Herz ---------------- */
.hero-heart {
  font-size: clamp(84px, 26vw, 118px);
  line-height: 1;
  filter: drop-shadow(0 14px 30px rgba(244, 80, 143, 0.42));
  transform-origin: 50% 60%;
}
.hero-heart--sm { font-size: clamp(56px, 16vw, 72px); align-self: center; }

.screen.is-active .hero-heart {
  animation:
    stagger-in 0.62s var(--ease-pop) forwards,
    heartbeat 2.2s var(--ease-io) 0.8s infinite;
}

@keyframes heartbeat {
  0%, 100%   { transform: scale(1); }
  14%        { transform: scale(1.13); }
  28%        { transform: scale(1); }
  42%        { transform: scale(1.09); }
  56%        { transform: scale(1); }
}

/* Herz-Burst beim Start-Klick */
.heart-burst {
  position: fixed;
  z-index: 65;
  pointer-events: none;
  font-size: 22px;
  line-height: 1;
  will-change: transform, opacity;
  animation: heart-burst 1.05s var(--ease-out) forwards;
}
@keyframes heart-burst {
  0%   { transform: translate(-50%, -50%) scale(0.2) rotate(0); opacity: 0; }
  18%  { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--bx)), calc(-50% + var(--by))) scale(var(--bs, 1)) rotate(var(--br, 40deg));
    opacity: 0;
  }
}

/* ---------------- Screen 6: Finale ---------------- */
/* höhere Spezifität als `.screen.is-active .hero-heart` — sonst gewinnt die Stagger-Regel */
.screen.is-active .final-heart {
  animation: final-heart 1.4s var(--ease-pop) both, heartbeat 2.2s var(--ease-io) 1.4s infinite;
}
@keyframes final-heart {
  0%  { transform: scale(0.2); opacity: 0; }
  55% { transform: scale(1.12); opacity: 1; }
  100%{ transform: scale(1); opacity: 1; }
}

.final-line {
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  animation: stagger-in 0.9s var(--ease-pop) forwards;
  animation-delay: var(--d, 0s);
}

/* Verlaufs-Text UND Glaskarte: background-clip:text würde die Kartenfläche
   mit wegschneiden, deshalb liegt die Karte in ::before dahinter. */
.mission {
  position: relative;
  isolation: isolate;
  font-size: clamp(28px, 8.4vw, 38px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 8px 0;
  padding: 22px 22px;
  background-image: linear-gradient(120deg, var(--pink-500), var(--lilac-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-wrap: balance;
}
.mission::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: var(--r-card);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  box-shadow: var(--sh-card-hi);
}

.whisper {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-soft);
  opacity: 0.9;
  margin-top: auto;
  padding-top: 12px;
}

/* Zusammenfassung + Schick-Button.
   Die Animation sitzt auf dem Wrapper, NICHT auf dem Button — sonst hielte ihr
   `forwards` das transform fest und der Button hätte keinen Hover/Tap mehr. */
.summary {
  width: 100%;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary__line {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--violet-700);
  opacity: 0.85;
}

/* Glitzer-Overlay am Ende */
.sparkle {
  position: fixed;
  z-index: 62;
  pointer-events: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255, 240, 250, 0.9) 40%, transparent 70%);
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.85);
  will-change: transform, opacity;
  animation: sparkle 1.3s var(--ease-out) forwards;
  animation-delay: var(--sd, 0s);
}
@keyframes sparkle {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  35%  { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}

/* ---------------- kleine Screens ---------------- */
@media (max-height: 700px) {
  .card { min-height: 60px; padding: 11px 16px; }
  .card__emoji { font-size: 24px; }
  .card__label { font-size: 16px; }
  .screen__inner { gap: 12px; }
  .title { font-size: 21px; }
  .btn { min-height: 56px; padding: 14px 22px; }
  .slider-panel { padding: 22px 20px 18px; }
  .slider-bubble { width: 66px; height: 66px; font-size: 27px; margin-bottom: 16px; }
  .perk, .check { min-height: 48px; padding: 9px 15px; font-size: 14.5px; }

  /* Screen 6 ist der höchste Screen (Herz + 5 Punkte + Unterschrift + Button).
     Ohne diese Kur schrumpft die Checkliste und schluckt den letzten Punkt. */
  #screen-6 .phase { gap: 10px; }
  .hero-heart--sm { font-size: 44px; }
  #screen-6 .title--tight { font-size: 19px; }
  .checklist { gap: 7px; }
  .check { min-height: 42px; padding: 7px 14px; font-size: 13.5px; }
  .check__box { font-size: 16px; }
  .sign__title { font-size: 15px; margin-bottom: 8px; }
  .sign__pad { height: clamp(92px, 14vh, 118px); }
  .sign__line { bottom: 24px; left: 18px; right: 18px; }
}
