:root {
  --pink-50: #fff5f9;
  --pink-100: #ffe4ef;
  --pink-200: #ffd6e5;
  --pink-300: #ffb3cd;
  --pink-400: #ff8ab3;
  --pink-500: #ff5c8a;
  --pink-600: #e93d72;
  --cream: #fff8ef;
  --lavender: #e6dcff;
  --lavender-500: #b9a3ff;
  --ink: #5a2a43;
  --ink-soft: #8d5b74;
  --yes-scale: 1;
  --font: "Fredoka", "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --script: "Pacifico", "Fredoka", cursive;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(135deg, #fff1b8 0%, #ffd9cf 25%, #cdf3e6 55%, #cfe0ff 80%, #e6d8ff 100%);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ───── Background ───── */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
  animation: blob 18s ease-in-out infinite alternate;
}
.blob--1 { width: 55vmax; height: 55vmax; background: #ffc48a; top: -20vmax; left: -15vmax; }
.blob--2 { width: 45vmax; height: 45vmax; background: #7fb4ff; bottom: -18vmax; right: -12vmax; opacity: .35; animation-delay: -6s; }
.blob--3 { width: 30vmax; height: 30vmax; background: #7fe0c3; top: 40%; left: 55%; opacity: .45; animation-delay: -12s; }

@keyframes blob {
  to { transform: translate(6vmax, 4vmax) scale(1.12); }
}

.floaties { position: absolute; inset: 0; }
.floaty {
  position: absolute;
  bottom: -10vh;
  font-size: var(--size, 22px);
  opacity: var(--op, .6);
  animation: floatUp var(--dur, 14s) linear var(--delay, 0s) infinite;
}
@keyframes floatUp {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(var(--sway, 20px), -30vh) rotate(15deg); }
  50%  { transform: translate(calc(var(--sway, 20px) * -1), -60vh) rotate(-10deg); }
  75%  { transform: translate(var(--sway, 20px), -90vh) rotate(12deg); }
  100% { transform: translate(0, -125vh) rotate(0deg); }
}

/* ───── Layout ───── */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(max(16px, env(safe-area-inset-bottom)) + var(--yes-room, 0px));
  transition: padding .45s cubic-bezier(.3, 1.3, .5, 1);
}

.card {
  position: relative;
  width: min(560px, 100%);
  padding: 34px 28px 32px;
  text-align: center;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 3px solid #fff;
  border-radius: 40px;
  box-shadow:
    0 2px 0 rgba(255,255,255,.9) inset,
    0 24px 60px -18px rgba(58, 134, 255, .3),
    0 10px 24px -12px rgba(90, 42, 67, .18);
  animation: pop .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
.card::before, .card::after {
  content: "✦";
  position: absolute;
  color: var(--pink-400);
  font-size: 22px;
  animation: twinkle 2.4s ease-in-out infinite;
}
.card::before { top: 18px; left: 24px; color: #ffb703; }
.card::after  { bottom: 20px; right: 26px; color: #3a86ff; animation-delay: -1.2s; }

@keyframes twinkle { 50% { transform: scale(.6) rotate(45deg); opacity: .5; } }
@keyframes pop { from { transform: scale(.85) translateY(20px); opacity: 0; } }

.card__ribbon {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  padding: 7px 20px;
  background: var(--pink-500);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .04em;
  border-radius: 999px;
  box-shadow: 0 6px 0 color-mix(in srgb, #1a9488, #7a0010 calc(var(--anger) * 100%)), 0 12px 20px -8px rgba(46,196,182,.6);
  white-space: nowrap;
}

/* ───── Mascot ───── */
.mascot { position: relative; width: 150px; margin: 6px auto 4px; }
.mascot__svg { width: 100%; height: auto; display: block; overflow: visible; animation: bob 3s ease-in-out infinite; }
.mascot__heart { transform-origin: 100px 156px; animation: beat 1.2s ease-in-out infinite; }
.mascot .eyes, .mascot .eyes-happy, .mascot .mouth { transition: opacity .3s, d .3s; }
.mascot__tear {
  position: absolute; left: 34%; top: 52%;
  font-size: 18px; opacity: 0; pointer-events: none;
}
.mascot.is-sad .mascot__tear { animation: tear 1.1s ease-in forwards; }
.mascot.is-sad .mouth { d: path("M92 130 Q100 123 108 130"); }
.mascot.is-happy .eyes { opacity: 0; }
.mascot.is-happy .eyes-happy { opacity: 1; }
.mascot.is-happy .mouth { d: path("M88 124 Q100 140 112 124"); }
.mascot.is-happy .mascot__svg { animation: jump .6s cubic-bezier(.3,1.6,.5,1) infinite alternate; }

@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
@keyframes beat { 0%,100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(.95); } 45% { transform: scale(1.1); } }
@keyframes tear { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(30px); } }
@keyframes jump { to { transform: translateY(-14px) scale(1.04); } }

/* ───── Text ───── */
.eyebrow {
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: clamp(14px, 3.6vw, 16px);
}
.question {
  margin: 0;
  font-weight: 700;
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1.2;
  text-wrap: balance;
}
.name {
  font-family: var(--script);
  font-weight: 400;
  font-size: 1.25em;
  color: var(--pink-500);
  background: linear-gradient(90deg, #ff4f7b, #ff9f1c, #2ec4b6, #3a86ff, #8338ec, #ff4f7b);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
  padding: 0 .08em;
}
@keyframes shimmer { to { background-position: 300% 0; } }

.hint {
  margin: 12px 0 0;
  min-height: 1.5em;
  color: var(--ink-soft);
  font-size: clamp(15px, 3.8vw, 17px);
  transition: opacity .25s, transform .25s;
}
.hint.is-swap { opacity: 0; transform: translateY(6px); }

/* ───── Buttons ───── */
.buttons {
  position: relative;
  margin-top: 26px;
  min-height: 72px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 20px;
  min-height: 56px;
  min-width: 132px;
  padding: 12px 26px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
}
.btn:focus-visible { outline: 4px solid var(--lavender-500); outline-offset: 4px; }
.btn__icon { font-size: 1.1em; }

.btn--yes {
  position: relative;
  z-index: 3;
  color: #fff;
  background: linear-gradient(180deg, #ff9a5c, #ff4f7b);
  box-shadow: 0 6px 0 var(--pink-600), 0 16px 30px -10px rgba(233, 61, 114, .7);
  transform: scale(var(--yes-scale));
  transform-origin: center top; /* grows downward: never covers the text above */
  transition: transform .45s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s, filter .2s;
  animation: glow 2s ease-in-out infinite;
}
.btn--yes:hover { filter: brightness(1.06); }
.btn--yes:active { transform: scale(calc(var(--yes-scale) * .96)) translateY(3px); box-shadow: 0 3px 0 var(--pink-600), 0 10px 20px -10px rgba(233,61,114,.7); }
@keyframes glow { 50% { box-shadow: 0 6px 0 var(--pink-600), 0 16px 40px -6px rgba(255, 92, 138, .9); } }

.btn--no {
  z-index: 4;
  color: var(--ink-soft);
  background: #fff;
  box-shadow: 0 5px 0 #f0d3e0, 0 12px 24px -12px rgba(90, 42, 67, .35);
  transition: background .2s;
}
.btn--no:active { transform: translateY(3px); box-shadow: 0 2px 0 #f0d3e0; }
.btn--no.is-runaway {
  position: fixed;
  left: 0; top: 0;
  margin: 0;
  transition: transform .5s cubic-bezier(.3, 1.4, .5, 1), opacity .3s;
  will-change: transform;
}
.btn--no.is-wiggle .btn__icon { animation: wiggle .5s ease; display: inline-block; }
@keyframes wiggle { 25% { transform: rotate(-20deg); } 75% { transform: rotate(20deg); } }

.poof {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  font-size: 22px;
  animation: poof .8s ease-out forwards;
}
@keyframes poof {
  from { transform: translate(-50%, -50%) scale(.6); opacity: 1; }
  to   { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2); opacity: 0; }
}

/* ───── Anger (grows with each "Non") ───── */
:root { --anger: 0; }

.rage {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 120, 110, .25) 0%, rgba(214, 20, 45, .9) 100%),
    linear-gradient(160deg, #ff6b6b, #b3001b);
  opacity: calc(var(--anger) * .9);
  transition: opacity .8s ease;
}
body.is-furious .rage { animation: ragePulse 1.1s ease-in-out infinite; }
@keyframes ragePulse { 50% { filter: brightness(1.25) saturate(1.3); } }

.floaties { transition: filter .8s; filter: saturate(calc(1 + var(--anger) * 2)) hue-rotate(calc(var(--anger) * -25deg)); }

.card {
  border-color: color-mix(in srgb, #fff, #ff2a3d calc(var(--anger) * 100%));
  transition: border-color .6s, box-shadow .6s;
}
body.is-angry .card {
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 24px 60px -18px rgba(200, 0, 30, calc(.35 + var(--anger) * .5)), 0 0 0 calc(var(--anger) * 6px) rgba(255, 42, 61, .25);
}
.card__ribbon { transition: background .6s; background: color-mix(in srgb, #2ec4b6, #d10f2f calc(var(--anger) * 100%)); }
.question__rest, .eyebrow { transition: color .6s; }
.question__rest { color: color-mix(in srgb, var(--ink), #c4001f calc(var(--anger) * 100%)); }
body.is-furious .question__rest { display: inline-block; animation: tremble .15s linear infinite; }
@keyframes tremble { 25% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, 1px); } }

.card.is-shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  20%, 60% { transform: translateX(calc(var(--anger) * -14px)) rotate(calc(var(--anger) * -1.5deg)); }
  40%, 80% { transform: translateX(calc(var(--anger) * 14px)) rotate(calc(var(--anger) * 1.5deg)); }
}

.mascot__flush { opacity: calc(var(--anger) * .55); transition: opacity .6s; }
.mascot .brows { opacity: clamp(0, calc((var(--anger) - .2) * 3), 1); transition: opacity .4s; }
.mascot__steam, .mascot__vein { position: absolute; opacity: 0; pointer-events: none; font-size: 26px; }
.mascot__steam--l { left: -18px; top: 18%; transform: scaleX(-1); }
.mascot__steam--r { right: -18px; top: 18%; }
.mascot__vein { right: 4px; top: 30%; font-size: 30px; }
body.is-angry .mascot__vein { opacity: 1; animation: beat .8s ease-in-out infinite; }
body.is-furious .mascot__steam { animation: steam 1s ease-out infinite; }
body.is-furious .mascot__steam--r { animation-delay: -.5s; }
@keyframes steam {
  0% { opacity: 0; translate: 0 10px; scale: .6; }
  30% { opacity: 1; }
  100% { opacity: 0; translate: 0 -24px; scale: 1.3; }
}
body.is-angry .mascot .mouth { d: path("M90 130 Q100 122 110 130"); }

/* ───── EXTREME anger ───── */
.flames {
  position: absolute;
  left: -5%; right: -5%; bottom: -20px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  font-size: clamp(48px, 9vw, 96px);
  line-height: 1;
  opacity: clamp(0, calc((var(--anger) - .35) * 2.5), 1);
  transform: translateY(calc((1 - var(--anger)) * 110%)) scaleY(calc(.6 + var(--anger) * .8));
  transform-origin: bottom;
  transition: transform .8s cubic-bezier(.3, 1.4, .5, 1), opacity .6s;
}
.flames::before {
  content: ""; position: absolute; inset: 30% 0 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 120, 0, .75), transparent 70%);
}
.flames span { display: inline-block; position: relative; will-change: transform; animation: flicker .5s ease-in-out infinite alternate; }
.flames span:nth-child(2n) { animation-delay: -.25s; font-size: 1.3em; }
.flames span:nth-child(3n) { animation-delay: -.12s; font-size: .8em; }
@keyframes flicker { to { transform: scaleY(1.25) scaleX(.9) translateY(-6px); } }

.flash {
  position: fixed; inset: 0; z-index: 7;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.flash.is-on { animation: flash .35s ease-out; }
@keyframes flash { 0% { opacity: .85; } 30% { opacity: .1; } 45% { opacity: .6; } 100% { opacity: 0; } }

.pow {
  position: fixed;
  z-index: 6;
  pointer-events: none;
  font-weight: 700;
  font-size: clamp(30px, 8vw, 64px);
  color: #ffde00;
  -webkit-text-stroke: 3px #b3001b;
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 #b3001b, 0 0 30px rgba(255, 50, 0, .8);
  white-space: nowrap;
  animation: pow 1.3s cubic-bezier(.3, 1.8, .5, 1) forwards;
}
@keyframes pow {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(var(--r)); opacity: 1; }
  20%  { transform: translate(-50%, -50%) scale(1.15) rotate(var(--r)); }
  30%  { transform: translate(-50%, -50%) scale(1) rotate(var(--r)); }
  75%  { opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(1.05) rotate(var(--r)); opacity: 0; }
}

.mascot { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); transform: scale(calc(1 + var(--anger) * .3)); }
.mascot .eyes ellipse { transition: fill .5s; }
body.is-furious .mascot .eyes ellipse { fill: #d10000; }
body.is-furious .mascot__svg { animation: rageBear .12s linear infinite; }
@keyframes rageBear { 25% { transform: translate(-2px, 1px) rotate(-2deg); } 75% { transform: translate(2px, -1px) rotate(2deg); } }
body.is-furious .mascot__steam { font-size: 40px; }
body.is-furious .mascot__vein { font-size: 40px; }

body.is-furious .stage { animation: quake .25s linear infinite; }
@keyframes quake { 25% { transform: translate(-1.5px, 1px); } 75% { transform: translate(1.5px, -1px); } }
body.is-angry .question__rest.is-ultimatum {
  font-size: .85em;
  letter-spacing: .02em;
  color: #c4001f;
}
body.is-angry .hint { font-weight: 700; color: #b3001b; }

/* ───── Yes explosion ───── */
.btn--yes.is-boom {
  animation: boom .35s ease-in forwards;
  pointer-events: none;
}
@keyframes boom {
  40%  { transform: scale(calc(var(--yes-scale) * 1.25)); filter: brightness(1.3); }
  100% { transform: scale(0); opacity: 0; }
}

/* ───── Pink overlay ───── */
.love {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 40%, #fffdf5 0%, transparent 60%),
    linear-gradient(135deg, #ffe58f 0%, #ffc1b6 30%, #b8f0dc 60%, #b9d3ff 85%, #dccbff 100%);
  animation: fadeIn .7s ease forwards;
}
.love[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }

/* ───── Envelope ───── */
.envelope {
  grid-area: 1 / 1;
  position: relative;
  width: min(320px, 78vw);
  aspect-ratio: 3 / 2;
  perspective: 900px;
  animation: dropIn .8s cubic-bezier(.3, 1.5, .5, 1) .4s both;
  filter: drop-shadow(0 18px 24px rgba(58, 134, 255, .3));
}
@keyframes dropIn { from { transform: translateY(-70vh) rotate(-12deg); } }

.env__back, .env__front, .env__flap { position: absolute; left: 0; right: 0; }
.env__back  { inset: 0; background: #5b9dff; border-radius: 14px; z-index: 1; }
.env__front {
  inset: 0; z-index: 3; border-radius: 14px;
  background: linear-gradient(180deg, #a9cbff, #8db8ff);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
.env__flap {
  top: 0; height: 62%; z-index: 4;
  background: linear-gradient(180deg, #ffd166, #ffb703);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 14px 14px 0 0;
  transform-origin: top center;
  transition: transform .6s cubic-bezier(.5, 0, .3, 1), z-index 0s .3s;
}
.env__seal {
  position: absolute; z-index: 5;
  left: 50%; top: 62%;
  transform: translate(-50%, -60%);
  font-size: 34px;
  animation: beat 1.2s ease-in-out infinite;
  transition: opacity .2s;
}
.env__letter {
  position: absolute; z-index: 2;
  left: 7%; right: 7%; top: 8%; bottom: 6%;
  background: #fffaf3;
  border-radius: 8px;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14px;
  font-family: var(--script);
  color: var(--pink-500);
  font-size: 20px;
  box-shadow: 0 -4px 12px rgba(90, 42, 67, .1);
  transition: transform .8s cubic-bezier(.3, 1.3, .5, 1);
}
.envelope.is-open .env__seal { opacity: 0; }
.envelope.is-open .env__flap { transform: rotateX(180deg); z-index: 0; }
.envelope.is-out .env__letter { transform: translateY(-62%); }
.envelope.is-gone { animation: sink .6s ease-in forwards; }
@keyframes sink { to { transform: translateY(40vh) scale(.8); opacity: 0; } }

/* ───── Note (final letter) ───── */
.note {
  grid-area: 1 / 1;
  position: relative;
  width: min(480px, 100%);
  padding: 34px 26px 26px;
  text-align: center;
  background:
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(58, 134, 255, .15) 33px 34px),
    #fffaf3;
  border-radius: 22px;
  box-shadow: 0 24px 60px -18px rgba(131, 56, 236, .4), 0 0 0 6px rgba(255, 255, 255, .6);
  transform: rotate(-1.5deg);
  animation: unfold .6s cubic-bezier(.3, 1.5, .5, 1) both;
}
.note[hidden] { display: none; }
@keyframes unfold { from { transform: translateY(40px) scale(.4) rotate(6deg); opacity: 0; } }

.note__tape {
  position: absolute; top: -14px; left: 50%;
  width: 110px; height: 28px;
  transform: translateX(-50%) rotate(3deg);
  background: rgba(255, 210, 63, .7);
  border-radius: 4px;
}
.note__text { min-height: 8em; }
.note__line { margin: 0; white-space: pre-wrap; }
.note__line--big {
  font-weight: 700;
  font-size: clamp(38px, 11vw, 58px);
  color: var(--pink-500);
  text-shadow: 0 4px 0 #ffe08a;
  line-height: 1.1;
}
.note__line--mid  { font-weight: 700; font-size: clamp(21px, 5.6vw, 27px); margin-top: 8px; }
.note__line--soft { font-size: clamp(17px, 4.6vw, 20px); color: var(--ink-soft); margin-top: 16px; }
.note__line--tip  {
  font-size: clamp(14px, 3.8vw, 16px);
  margin: 16px auto 0;
  padding: 10px 14px;
  max-width: 34em;
  border-radius: 14px;
  background: #fff3c4;
  color: #7a5a00;
  font-weight: 500;
}
.note__line--ps   { font-size: clamp(14px, 3.8vw, 16px); color: var(--ink-soft); margin-top: 14px; font-style: italic; }

.caret {
  display: inline-block;
  width: 3px; height: 1em;
  margin-left: 2px;
  vertical-align: -0.12em;
  background: var(--pink-500);
  border-radius: 2px;
  animation: blink .8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.note__stamp {
  display: inline-block;
  margin: 20px 0 0;
  padding: 8px 18px;
  border: 2px dashed #3a86ff;
  border-radius: 999px;
  color: #2563d9;
  font-weight: 600;
  font-size: 15px;
  opacity: 0;
}
.note__stamp.is-on { animation: stamp .6s cubic-bezier(.3, 1.8, .5, 1) forwards; }
@keyframes stamp { from { opacity: 0; transform: scale(2) rotate(-12deg); } to { opacity: 1; transform: rotate(-3deg); } }

.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
.love > .fx { z-index: 0; }
.love > .envelope, .love > .note { z-index: 1; }

@media (max-width: 420px) {
  .card { padding: 30px 18px 26px; border-radius: 32px; }
  .mascot { width: 120px; }
  .btn { font-size: 18px; min-width: 120px; padding: 12px 22px; }
}
@media (max-height: 620px) {
  .mascot { width: 96px; }
  .card { padding-top: 26px; }
}

/* ───── Reduced motion ───── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .floaties { display: none; }
  .caret { display: none; }
}
