:root {
  color-scheme: light;
  --cream: #fff8f2;
  --cream-2: #fff1e8;
  --rose-50: #fff0f3;
  --rose-100: #ffdce5;
  --rose-300: #f6a9bd;
  --rose-500: #e65c7b;
  --rose-700: #a92f55;
  --red-warm: #d84a55;
  --violet: #6f4a8e;
  --violet-deep: #211630;
  --violet-mid: #3c2455;
  --gold: #d8aa52;
  --ink: #36252b;
  --muted: #755f68;
  --white: #ffffff;
  --shadow: 0 20px 60px rgba(111, 50, 75, 0.16);
  --shadow-soft: 0 10px 30px rgba(111, 50, 75, 0.11);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-right: max(16px, env(safe-area-inset-right));
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  --safe-left: max(16px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 10%, rgba(246, 169, 189, 0.24), transparent 34%),
    radial-gradient(circle at 90% 75%, rgba(111, 74, 142, 0.14), transparent 32%),
    linear-gradient(160deg, var(--cream) 0%, #fff2ef 55%, #f8ecff 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(111, 74, 142, 0.45);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100%;
  min-height: 100svh;
  isolation: isolate;
}

.scene-host {
  position: relative;
  width: 100%;
  min-height: 100svh;
}

.scene {
  display: none;
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  padding: calc(var(--safe-top) + 84px) var(--safe-right) calc(var(--safe-bottom) + 24px) var(--safe-left);
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.scene.is-active {
  display: flex;
  animation: scene-in 520ms cubic-bezier(.2, .8, .2, 1) both;
}

.start-scene {
  padding-top: calc(var(--safe-top) + 24px);
  text-align: center;
}

.scene-card {
  position: relative;
  z-index: 2;
  width: min(100%, 620px);
  padding: clamp(24px, 6vw, 38px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  backdrop-filter: blur(22px) saturate(125%);
  margin-block: auto;
  text-align: center;
}

.wide-card {
  width: min(100%, 760px);
}

.hero-card {
  padding-top: clamp(36px, 10vw, 64px);
  padding-bottom: clamp(34px, 9vw, 56px);
}

.start-glow {
  position: absolute;
  width: 76vw;
  max-width: 420px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 92, 123, 0.24), rgba(246, 169, 189, 0.08) 45%, transparent 72%);
  filter: blur(6px);
  animation: breathe 6s ease-in-out infinite;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.6rem, 13vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.9rem, 8vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--rose-700);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  max-width: 35rem;
  margin-inline: auto;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: clamp(1.05rem, 4.5vw, 1.25rem);
}

.instruction {
  max-width: 38rem;
  margin: 0 auto 24px;
  color: var(--muted);
}

.button-stack,
.button-row {
  display: flex;
  gap: 12px;
}

.button-stack {
  flex-direction: column;
}

.button-row {
  justify-content: center;
  flex-wrap: wrap;
}

.button {
  min-height: 50px;
  min-width: 48px;
  padding: 13px 20px;
  border: 0;
  border-radius: 17px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.15;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
}

.button:active {
  transform: scale(0.965);
}

.button-primary {
  color: var(--white);
  background: linear-gradient(135deg, var(--rose-500), var(--red-warm));
  box-shadow: 0 12px 24px rgba(216, 74, 85, 0.24);
}

.button-secondary {
  color: var(--white);
  background: linear-gradient(135deg, var(--violet), #9b5c92);
  box-shadow: 0 12px 24px rgba(111, 74, 142, 0.21);
}

.button-ghost {
  color: var(--rose-700);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(169, 47, 85, 0.16), var(--shadow-soft);
}

.button-gold {
  color: #2a1d19;
  background: linear-gradient(135deg, #ffe29a, var(--gold));
  box-shadow: 0 12px 28px rgba(216, 170, 82, 0.28);
}

.button-large {
  min-height: 58px;
  padding-inline: 24px;
  font-size: 1.05rem;
}

.button.is-bouncing {
  animation: button-bounce 420ms cubic-bezier(.2, .9, .25, 1.25);
}

.continue-btn {
  width: 100%;
  margin-top: 22px;
}

.inline-message,
.status-line,
.success-message {
  min-height: 26px;
  margin: 18px auto 0;
}

.inline-message,
.status-line {
  color: var(--muted);
}

.success-message {
  color: var(--rose-700);
  font-weight: 800;
}

.swipe-note {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 2px);
  left: 20px;
  right: 20px;
  margin: 0;
  color: rgba(117, 95, 104, 0.78);
  font-size: 0.76rem;
}

.top-bar {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  padding: var(--safe-top) var(--safe-right) 11px var(--safe-left);
  background: linear-gradient(to bottom, rgba(255, 248, 242, 0.95), rgba(255, 248, 242, 0.76), transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.progress-copy strong {
  color: var(--rose-700);
  font-size: 0.88rem;
}

.progress-track {
  grid-column: 1 / 2;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(169, 47, 85, 0.11);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose-500), var(--gold));
  transition: width 420ms cubic-bezier(.2, .8, .2, 1);
}

.top-actions {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 16px;
  background: rgba(255,255,255,0.76);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 1.15rem;
}

.hold-heart {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(150px, 45vw, 210px);
  aspect-ratio: 1;
  margin: 12px auto 24px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95), rgba(255,220,229,0.82) 58%, rgba(246,169,189,0.42));
  box-shadow: 0 22px 50px rgba(216, 74, 85, 0.22), inset 0 0 0 1px rgba(255,255,255,0.84);
  cursor: pointer;
  touch-action: none;
  overflow: hidden;
}

.heart-symbol {
  position: relative;
  z-index: 2;
  color: var(--rose-500);
  font-size: clamp(6.6rem, 30vw, 9.5rem);
  line-height: 1;
  filter: drop-shadow(0 10px 14px rgba(169,47,85,0.22));
  transform: translateY(-2px);
}

.heart-shine {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.9), transparent 35%);
  opacity: 0.8;
}

.hold-heart.is-holding {
  animation: heart-grow 3.6s linear forwards;
}

.hold-heart.is-complete {
  animation: heart-complete 700ms cubic-bezier(.2, .85, .25, 1.2) both;
}

.heart-card.is-warming {
  background: linear-gradient(150deg, rgba(255,255,255,0.82), rgba(255, 223, 222, 0.88));
}

.meter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.meter-track {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(169,47,85,0.11);
}

.meter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f6a9bd, #e65c7b, #d8aa52);
}

.reasons-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.reason-card {
  position: relative;
  min-height: 160px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  cursor: pointer;
  perspective: 800px;
}

.reason-front,
.reason-back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 620ms cubic-bezier(.2, .75, .2, 1);
}

.reason-front {
  color: var(--rose-700);
  background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(255,220,229,0.75));
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(255,255,255,0.8);
  font-size: 2.2rem;
  font-weight: 900;
}

.reason-front::after {
  content: "Tippen";
  position: absolute;
  bottom: 14px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reason-back {
  color: var(--ink);
  background: linear-gradient(145deg, #fffaf7, #ffe8ee);
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(230,92,123,0.1);
  transform: rotateY(180deg);
  font-size: 0.92rem;
  font-weight: 720;
}

.reason-card.is-open .reason-front {
  transform: rotateY(-180deg);
}

.reason-card.is-open .reason-back {
  transform: rotateY(0deg);
}

.reason-icon {
  display: block;
  margin-bottom: 7px;
  font-size: 1.65rem;
}

.food-reason.is-open .chef-icon {
  animation: chef-wiggle 850ms ease-in-out;
}

.oracle-card {
  overflow: hidden;
}

.oracle-orb {
  display: grid;
  place-items: center;
  width: 105px;
  aspect-ratio: 1;
  margin: 0 auto 18px;
  border-radius: 50%;
  color: #ffe5a6;
  background: radial-gradient(circle at 35% 30%, #d69ad5, #765092 45%, #362348 78%);
  box-shadow: 0 18px 45px rgba(82, 48, 104, 0.3), inset 0 0 24px rgba(255,255,255,0.28);
  font-size: 2.4rem;
}

.oracle-orb span {
  animation: orb-float 3s ease-in-out infinite;
}

.oracle-output {
  display: grid;
  place-items: center;
  min-height: 128px;
  margin: 22px 0;
  padding: 22px;
  border-radius: 22px;
  color: #4a315a;
  background: linear-gradient(145deg, rgba(248,236,255,0.88), rgba(255,240,243,0.9));
  box-shadow: inset 0 0 0 1px rgba(111,74,142,0.1);
  font-size: 1.08rem;
  font-weight: 760;
}

.game-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.game-field {
  position: relative;
  width: 100%;
  min-height: 310px;
  max-height: 42vh;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.85), transparent 24%),
    linear-gradient(160deg, #ffe5eb, #f6e9ff);
  box-shadow: inset 0 0 0 1px rgba(111,74,142,0.09), inset 0 -30px 70px rgba(111,74,142,0.08);
  touch-action: manipulation;
}

.game-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.catch-heart {
  position: absolute;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--rose-500);
  background: rgba(255,255,255,0.82);
  box-shadow: 0 8px 18px rgba(169,47,85,0.18);
  font-size: 2rem;
  cursor: pointer;
  animation: pop-heart 240ms cubic-bezier(.2, .85, .25, 1.3), heart-idle 700ms ease-in-out alternate infinite;
}

.catch-heart.is-caught {
  pointer-events: none;
  animation: caught-heart 240ms ease-out forwards;
}

.answer-arena {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 12px;
  min-height: 132px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,240,243,0.82), rgba(248,236,255,0.82));
  overflow: hidden;
}

.answer-button {
  width: 100%;
}

.no-button {
  transform-origin: center;
}

.no-button.is-roaming {
  position: relative;
}

.chef-badge {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: 0 auto 16px;
  border-radius: 24px;
  background: linear-gradient(145deg, #fff, #ffe8d6);
  box-shadow: var(--shadow-soft);
  font-size: 2.4rem;
}

.chef-badge.is-celebrating {
  animation: chef-wiggle 800ms ease-in-out 2;
}

.slider-wrap {
  padding: 20px 4px 8px;
}

input[type="range"] {
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  touch-action: pan-x;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2b3c2, #e65c7b 55%, #d8aa52);
  box-shadow: inset 0 2px 4px rgba(80,30,40,0.12);
}

input[type="range"]::-webkit-slider-thumb {
  width: 34px;
  height: 34px;
  margin-top: -11px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--rose-700);
  box-shadow: 0 5px 14px rgba(80,30,40,0.25);
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2b3c2, #e65c7b 55%, #d8aa52);
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--rose-700);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 740;
}

.verdict {
  min-height: 74px;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 20px;
  color: var(--rose-700);
  background: rgba(255,255,255,0.72);
  box-shadow: inset 0 0 0 1px rgba(169,47,85,0.1);
  font-weight: 850;
}

.food-celebration {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  color: var(--rose-700);
}

.food-celebration span {
  font-size: 1.65rem;
}

.stars-scene {
  background:
    radial-gradient(circle at 15% 12%, rgba(177,133,207,0.2), transparent 28%),
    radial-gradient(circle at 85% 75%, rgba(216,170,82,0.13), transparent 26%),
    linear-gradient(160deg, #171020, var(--violet-deep) 55%, #321d45);
}

.star-card {
  color: #fff8f2;
  border-color: rgba(255,255,255,0.12);
  background: rgba(40,24,55,0.72);
  box-shadow: 0 24px 70px rgba(0,0,0,0.3);
}

.light-eyebrow {
  color: #ffe09b;
}

.light-copy {
  color: rgba(255,248,242,0.72);
}

.star-field {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border-radius: 25px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12) 0 1px, transparent 2px),
    radial-gradient(circle at 75% 25%, rgba(255,255,255,0.15) 0 1px, transparent 2px),
    radial-gradient(circle at 35% 80%, rgba(255,255,255,0.12) 0 1px, transparent 2px),
    linear-gradient(160deg, rgba(79,48,101,0.45), rgba(19,12,28,0.5));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.memory-star {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  color: #ffe09b;
  background: transparent;
  filter: drop-shadow(0 0 10px rgba(255,224,155,0.38));
  font-size: 2rem;
  cursor: pointer;
  animation: star-twinkle 2.8s ease-in-out infinite;
}

.memory-star.is-open {
  animation: none;
  color: #fff;
  filter: drop-shadow(0 0 16px rgba(255,231,176,0.9));
  transform: scale(1.22);
}

.star-field.all-open .memory-star {
  animation: star-burst 900ms ease-in-out both;
}

.star-1 { top: 8%; left: 10%; animation-delay: -0.4s; }
.star-2 { top: 13%; right: 12%; animation-delay: -1.1s; }
.star-3 { top: 37%; left: 28%; animation-delay: -1.8s; }
.star-4 { top: 47%; right: 16%; animation-delay: -0.7s; }
.star-5 { bottom: 16%; left: 10%; animation-delay: -2.2s; }
.star-6 { bottom: 9%; right: 12%; animation-delay: -1.4s; }
.star-7 { top: 66%; left: 46%; animation-delay: -0.2s; }

.wish-bubble {
  position: absolute;
  pointer-events: none;
  left: 50%;
  bottom: 18px;
  width: min(84%, 390px);
  min-height: 70px;
  display: grid;
  place-items: center;
  padding: 15px 18px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  color: #fff8f2;
  background: rgba(28,18,39,0.72);
  box-shadow: 0 14px 32px rgba(0,0,0,0.22);
  transform: translateX(-50%);
  font-weight: 760;
}

.light-success {
  color: #ffe09b;
}

.prep-icon {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 3.4rem;
  animation: letter-float 3s ease-in-out infinite;
}

.finale-scene {
  min-height: 100svh;
  padding-top: calc(var(--safe-top) + 30px);
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,0.8), transparent 24%),
    linear-gradient(160deg, #fff6ef 0%, #ffdce5 48%, #f2dfff 100%);
  overflow-y: auto;
}

.finale-content {
  width: min(100%, 670px);
  margin: auto;
  padding: clamp(10px, 3vw, 20px) 0;
  text-align: center;
}

.final-line {
  opacity: 0;
  transform: translateY(18px);
}

.final-line.is-visible {
  animation: final-reveal 760ms cubic-bezier(.2,.75,.2,1) forwards;
}

.final-kicker {
  margin-bottom: 22px;
  color: var(--rose-700);
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 850;
}

.final-love {
  margin: 34px 0 18px;
  color: var(--rose-700);
  font-size: clamp(2.5rem, 12vw, 5rem);
}

.final-food {
  max-width: 34rem;
  margin: 0 auto 28px;
  color: var(--ink);
  font-size: clamp(1.08rem, 4.8vw, 1.4rem);
  font-weight: 760;
}

.final-actions {
  display: grid;
  gap: 12px;
  margin: 30px 0;
}

.personal-card {
  margin-top: 36px;
  padding: 26px;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.66);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.personal-card p {
  color: var(--muted);
}

.personal-card strong {
  color: var(--rose-700);
}

.particle-layer,
.ambient-hearts {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
}

.ambient-hearts {
  z-index: 0;
}

.float-heart,
.confetti-piece,
.rain-heart {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
}

.float-heart {
  color: var(--rose-500);
  animation: float-up 1300ms ease-out forwards;
}

.confetti-piece {
  width: 8px;
  height: 12px;
  border-radius: 3px;
  background: var(--gold);
  animation: confetti-pop 900ms ease-out forwards;
}

.rain-heart {
  top: -12vh;
  color: var(--rose-500);
  animation: heart-rain var(--fall-duration, 2500ms) linear forwards;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: rgba(35, 22, 30, 0.44);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.modal-card {
  width: min(100%, 470px);
  padding: 28px;
  border: 1px solid rgba(255,255,255,0.74);
  border-radius: var(--radius-xl);
  background: rgba(255,250,247,0.94);
  box-shadow: 0 24px 80px rgba(38,21,29,0.28);
  text-align: center;
  animation: modal-in 380ms cubic-bezier(.2,.8,.2,1.15) both;
}

.modal-card p {
  color: var(--muted);
}

.modal-icon {
  display: block;
  margin-bottom: 8px;
  font-size: 2.4rem;
}

@keyframes scene-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes breathe {
  0%, 100% { transform: scale(0.94); opacity: 0.8; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes button-bounce {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(0.94); }
  72% { transform: scale(1.045); }
}

@keyframes heart-grow {
  0% { transform: scale(1); filter: saturate(1); }
  100% { transform: scale(1.16); filter: saturate(1.18); }
}

@keyframes heart-complete {
  0% { transform: scale(1.14); }
  55% { transform: scale(1.28); }
  100% { transform: scale(1.08); }
}

@keyframes chef-wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-9deg) scale(1.08); }
  50% { transform: rotate(8deg) scale(1.12); }
  75% { transform: rotate(-5deg) scale(1.06); }
}

@keyframes orb-float {
  0%,100% { transform: translateY(-3px) rotate(-4deg); }
  50% { transform: translateY(5px) rotate(5deg); }
}

@keyframes pop-heart {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes heart-idle {
  from { transform: translateY(-2px) rotate(-3deg); }
  to { transform: translateY(3px) rotate(3deg); }
}

@keyframes caught-heart {
  to { transform: scale(1.8); opacity: 0; }
}

@keyframes star-twinkle {
  0%,100% { opacity: 0.62; filter: drop-shadow(0 0 8px rgba(255,224,155,0.3)); }
  50% { opacity: 1; filter: drop-shadow(0 0 15px rgba(255,224,155,0.72)); }
}

@keyframes star-burst {
  0% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255,224,155,0.5)); }
  50% { transform: scale(1.45); filter: drop-shadow(0 0 22px rgba(255,244,213,1)); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 14px rgba(255,224,155,0.9)); }
}

@keyframes letter-float {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes final-reveal {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float-up {
  0% { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.65) rotate(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift, 0px), -150px, 0) scale(1.2) rotate(var(--spin, 12deg)); }
}

@keyframes confetti-pop {
  0% { opacity: 1; transform: translate3d(0,0,0) rotate(0); }
  100% { opacity: 0; transform: translate3d(var(--x, 0), var(--y, 80px), 0) rotate(300deg); }
}

@keyframes heart-rain {
  0% { opacity: 0; transform: translate3d(0,-10vh,0) rotate(0); }
  10% { opacity: 0.9; }
  100% { opacity: 0; transform: translate3d(var(--rain-drift, 0px), 120vh, 0) rotate(var(--rain-spin, 180deg)); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 380px) {
  body { font-size: 16px; }
  .scene { padding-left: 12px; padding-right: 12px; }
  .scene-card { padding: 22px 17px; border-radius: 25px; }
  .reason-card { min-height: 150px; }
  .reason-back { font-size: 0.82rem; }
  .game-field { min-height: 285px; }
  .star-field { min-height: 360px; }
}

@media (min-width: 700px) {
  .reasons-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .reason-card { min-height: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}


/* iPhone layout reliability patch v2
   Dynamic content may grow freely; every active scene remains vertically scrollable. */
.scene {
  height: 100dvh;
  min-height: 100dvh;
  justify-content: flex-start;
  scroll-padding-top: calc(var(--safe-top) + 94px);
  scroll-padding-bottom: calc(var(--safe-bottom) + 34px);
}

.scene-card {
  flex: 0 0 auto;
  min-width: 0;
  margin: 0 auto;
  overflow: visible;
}

/* The old hidden overflow clipped long oracle text and controls in Mobile Safari. */
.oracle-card {
  overflow: visible;
}

.oracle-output,
.inline-message,
.status-line,
.success-message,
.verdict,
.food-celebration,
.personal-card,
.modal-card,
.reason-back,
.wish-bubble {
  min-width: 0;
  max-width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: normal;
}

.oracle-output {
  display: block;
  min-height: 0;
  padding: 20px;
  line-height: 1.48;
}

.oracle-card .button,
.game-card .button,
.question-card .button,
.cooking-card .button,
.prep-card .button {
  max-width: 100%;
}

/* Dynamic status fields no longer reserve a rigid box or cut off multiple lines. */
.inline-message,
.status-line,
.success-message {
  min-height: 0;
  line-height: 1.45;
}

/* Long reason texts get a readable one-column layout on iPhones. */
@media (max-width: 479px) {
  .reasons-grid {
    grid-template-columns: 1fr;
  }

  .reason-card {
    min-height: 132px;
  }

  .reason-front,
  .reason-back {
    padding: 18px 20px;
  }

  .reason-back {
    font-size: 0.98rem;
    line-height: 1.38;
  }

  .oracle-orb {
    width: 88px;
    margin-bottom: 14px;
  }

  .oracle-card h2 {
    font-size: clamp(1.75rem, 8vw, 2.35rem);
  }

  .game-stats {
    flex-wrap: wrap;
  }
}

@media (min-width: 480px) and (max-width: 699px) {
  .reason-card {
    min-height: 190px;
  }
}

@media (min-width: 700px) {
  .reason-card {
    min-height: 220px;
  }
}

/* Dialogs can scroll on compact iPhones and in landscape mode. */
.modal-backdrop {
  overflow-x: hidden;
  overflow-y: auto;
  align-items: flex-start;
}

.modal-card {
  flex: 0 0 auto;
  margin: auto 0;
}

/* Fallback for older Safari versions without dynamic viewport units. */
@supports not (height: 100dvh) {
  .scene {
    height: 100svh;
    min-height: 100svh;
  }
}
