:root {
  --bg-1: #fff3e9;
  --bg-2: #ffdcca;
  --bg-3: #f8d8e5;
  --panel: rgba(255, 250, 244, 0.82);
  --panel-strong: rgba(255, 247, 239, 0.95);
  --text: #513739;
  --muted: #735a5d;
  --accent: #e67b92;
  --accent-deep: #cb5a77;
  --accent-soft: #ffd3dc;
  --leaf: #b6d4a8;
  --gold: #f4c66a;
  --shadow: 0 24px 60px rgba(122, 71, 81, 0.16);
  --shadow-soft: 0 16px 34px rgba(122, 71, 81, 0.12);
  --transition: 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.82), transparent 32%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 52%, var(--bg-3));
  overflow: hidden;
  transition: background 900ms ease, color 400ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.3), transparent 22%),
    radial-gradient(circle at 80% 14%, rgba(255, 255, 255, 0.18), transparent 20%),
    radial-gradient(circle at 50% 85%, rgba(255, 247, 200, 0.24), transparent 28%);
  pointer-events: none;
  z-index: -2;
}

body.theme-puzzle {
  --bg-1: #f9f0dc;
  --bg-2: #dceccb;
  --bg-3: #f4d7c5;
  --panel: rgba(251, 247, 237, 0.84);
  --panel-strong: rgba(255, 251, 243, 0.95);
  --text: #4e4137;
  --muted: #6f6157;
  --accent: #dd8f7b;
  --accent-deep: #b87068;
  --accent-soft: #f7e5d7;
  --leaf: #99ba88;
  --gold: #edc96f;
}

body.theme-romantic {
  --bg-1: #ffe3ea;
  --bg-2: #ffd2c8;
  --bg-3: #ffc3dc;
  --panel: rgba(255, 244, 248, 0.84);
  --panel-strong: rgba(255, 245, 249, 0.96);
  --text: #572c3f;
  --muted: #754a5a;
  --accent: #f26d93;
  --accent-deep: #d74d76;
  --accent-soft: #ffdce8;
  --leaf: #f3b0c8;
  --gold: #ffd78a;
}

body.celebration-mode {
  background:
    linear-gradient(-45deg, #ffc3d2, #ffe2b8, #ffcfe4, #ffe8f6, #f7d2ff);
  background-size: 400% 400%;
  animation: gradientDance 12s ease infinite;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.glow {
  position: absolute;
  width: 40vmax;
  height: 40vmax;
  border-radius: 50%;
  filter: blur(16px);
  opacity: 0.45;
  mix-blend-mode: screen;
  animation: floatGlow 14s ease-in-out infinite;
}

.glow-left {
  left: -12vmax;
  top: 12vh;
  background: radial-gradient(circle, rgba(255, 217, 176, 0.82), transparent 62%);
}

.glow-center {
  left: 28vw;
  top: -12vmax;
  background: radial-gradient(circle, rgba(255, 242, 194, 0.72), transparent 58%);
  animation-delay: -4s;
}

.glow-right {
  right: -10vmax;
  bottom: 8vh;
  background: radial-gradient(circle, rgba(255, 194, 221, 0.78), transparent 60%);
  animation-delay: -8s;
}

body.celebration-mode .glow {
  opacity: 0.75;
  animation-duration: 7s;
}

body.app-locked .app-shell,
body.app-locked #toast,
body.app-locked #celebration-modal {
  filter: blur(10px) saturate(0.88);
  pointer-events: none;
  user-select: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.24), transparent 22%),
    radial-gradient(circle at 80% 14%, rgba(255, 255, 255, 0.18), transparent 20%),
    linear-gradient(145deg, rgba(89, 45, 62, 0.34), rgba(255, 230, 238, 0.2));
  backdrop-filter: blur(16px);
  z-index: 90;
}

.auth-overlay[hidden] {
  display: none !important;
}

.auth-panel {
  width: min(92vw, 460px);
  display: grid;
  gap: 0.9rem;
  padding: clamp(1.35rem, 4vw, 2rem);
  background: rgba(255, 248, 250, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 2rem;
  box-shadow: 0 24px 60px rgba(82, 40, 55, 0.22);
  text-align: center;
}

.auth-copy,
.auth-meta,
.auth-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 0.8rem;
  text-align: left;
}

.auth-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.auth-input {
  width: 100%;
  border: 1px solid rgba(203, 90, 119, 0.18);
  border-radius: 1rem;
  padding: 0.95rem 1rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.auth-input:focus {
  border-color: rgba(203, 90, 119, 0.6);
  box-shadow:
    0 0 0 4px rgba(230, 123, 146, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.auth-input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.auth-button {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff9fb;
  background: linear-gradient(135deg, #ff7ea5, #ff5f8f);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.auth-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.04);
}

.auth-button:active {
  transform: translateY(0);
}

.auth-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.auth-status {
  min-height: 1.5rem;
  font-weight: 700;
}

.auth-status.error {
  color: #b93d60;
}

.auth-status.success {
  color: #3d7a5e;
}

.auth-meta {
  font-size: 0.92rem;
}

.app-shell {
  position: relative;
  min-height: 100vh;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 3vw, 2rem);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition:
    opacity var(--transition),
    transform var(--transition);
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

#question-screen {
  overflow: hidden;
  isolation: isolate;
}

#question-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.2), transparent 24%),
    radial-gradient(circle at 82% 20%, rgba(255, 255, 255, 0.14), transparent 22%),
    linear-gradient(180deg, rgba(255, 238, 244, 0.2), rgba(255, 229, 238, 0.36));
  opacity: 1;
  transform: scale(1.04);
  pointer-events: none;
  z-index: 0;
}

#question-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.12), transparent 20%),
    linear-gradient(180deg, rgba(255, 244, 248, 0.14), rgba(255, 230, 239, 0.36));
  pointer-events: none;
  z-index: 0;
}

.intro-stack {
  display: grid;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}

.intro-tagline {
  margin: 0;
  max-width: 18ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.5vw, 4rem);
  line-height: 1.08;
  letter-spacing: 0.02em;
  text-shadow: 0 10px 20px rgba(255, 255, 255, 0.35);
}

.intro-tagline span {
  color: var(--accent-deep);
}

.gift-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding-top: 1rem;
}

.hover-hand {
  position: absolute;
  top: -0.8rem;
  right: -1.2rem;
  font-size: clamp(2.8rem, 7vw, 4rem);
  filter: drop-shadow(0 12px 16px rgba(84, 52, 52, 0.14));
  animation: handHover 2s ease-in-out infinite;
  transform-origin: bottom center;
}

.gift-box {
  position: relative;
  width: min(62vw, 17rem);
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  isolation: isolate;
  transition: transform 220ms ease;
}

.gift-box::before,
.gift-box::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.gift-box::before {
  inset: 12% 12% 16%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 249, 223, 0.96) 0, rgba(255, 220, 144, 0.65) 28%, rgba(255, 160, 192, 0.28) 54%, transparent 72%);
  filter: blur(12px);
  transform: scale(0.28);
  z-index: 0;
}

.gift-box::after {
  inset: 14% 18% 18%;
  border-radius: 50%;
  border: 2px solid rgba(255, 246, 196, 0.8);
  box-shadow: 0 0 28px rgba(255, 228, 168, 0.38);
  transform: scale(0.35);
  z-index: 0;
}

.gift-box:hover {
  transform: translateY(-4px);
}

.gift-box:active {
  transform: translateY(0);
}

.gift-shadow {
  position: absolute;
  inset: auto 14% 3%;
  height: 16%;
  border-radius: 50%;
  background: rgba(103, 72, 73, 0.18);
  filter: blur(10px);
  z-index: 0;
}

.box-base,
.box-lid {
  position: absolute;
  left: 11%;
  right: 11%;
  background:
    linear-gradient(135deg, #ff9fb0, #ff859e 44%, #ff7591 100%);
  box-shadow: var(--shadow);
}

.box-base {
  bottom: 10%;
  height: 48%;
  border-radius: 0 0 2rem 2rem;
  overflow: hidden;
  transform-origin: center bottom;
  z-index: 1;
}

.box-base::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: -18%;
  height: 68%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 249, 229, 0.94) 0, rgba(255, 222, 153, 0.58) 42%, transparent 76%);
  filter: blur(8px);
  opacity: 0;
  transform: translateY(14px) scale(0.72);
}

.box-lid {
  top: 17%;
  height: 23%;
  border-radius: 1.5rem;
  transform-origin: center 88%;
  z-index: 4;
}

.ribbon-vertical,
.ribbon-horizontal {
  position: absolute;
  background:
    linear-gradient(180deg, #ffeeb6, #ffd46e 62%, #eab348);
  box-shadow: 0 8px 18px rgba(224, 164, 55, 0.25);
  z-index: 2;
}

.ribbon-vertical {
  top: 17%;
  bottom: 10%;
  left: 50%;
  width: 14%;
  transform: translateX(-50%);
  border-radius: 999px;
}

.ribbon-horizontal {
  top: 32%;
  left: 11%;
  right: 11%;
  height: 12%;
  border-radius: 999px;
}

.ribbon-bow {
  position: absolute;
  top: 7%;
  width: 20%;
  height: 13%;
  background: linear-gradient(135deg, #ffdf88, #f8c258);
  border-radius: 100% 12% 100% 12%;
  box-shadow: 0 10px 16px rgba(224, 164, 55, 0.22);
  z-index: 5;
}

.ribbon-bow-left {
  left: 31%;
  transform: rotate(-24deg);
}

.ribbon-bow-right {
  right: 31%;
  transform: rotate(114deg);
}

.gift-box.opening {
  animation: giftLift 1020ms cubic-bezier(0.2, 1, 0.24, 1) forwards;
}

.gift-box.opening::before {
  animation: giftCoreGlow 980ms ease-out forwards;
}

.gift-box.opening::after {
  animation: giftShockwave 980ms ease-out forwards;
}

.gift-box.opening .box-lid {
  animation: lidOpen 1020ms cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.gift-box.opening .box-base {
  animation: giftPulse 1020ms ease-out forwards;
}

.gift-box.opening .box-base::before {
  animation: boxGlow 980ms ease-out forwards;
}

.gift-box.opening .gift-shadow {
  animation: shadowBurst 980ms ease-out forwards;
}

.gift-box.opening .ribbon-vertical,
.gift-box.opening .ribbon-horizontal,
.gift-box.opening .ribbon-bow {
  opacity: 0;
  transition: opacity 180ms ease;
}

.tap-hint {
  margin: 0;
  color: var(--accent-deep);
  font-size: clamp(1rem, 2.8vw, 1.3rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: hintBlink 1s ease-in-out infinite;
}

.panel {
  width: min(94vw, 1060px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.puzzle-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(18rem, 1.15fr);
  align-items: center;
  gap: clamp(1.2rem, 3vw, 2.25rem);
  padding: clamp(1.15rem, 3vw, 2rem);
}

.panel-copy {
  display: grid;
  gap: 0.85rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.panel h1,
.celebration-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.02;
}

.panel-text,
.surprise-caption,
.love-message,
.celebration-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.55;
}

.puzzle-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.puzzle-meta span {
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.52);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.puzzle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.skip-button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent-deep);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.skip-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.94);
}

.skip-button:active {
  transform: translateY(0);
}

.puzzle-wrap {
  display: grid;
  place-items: center;
}

.puzzle-board {
  width: min(88vw, 74vh, 720px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 6px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.26)),
    rgba(255, 250, 243, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 1.8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow);
}

.puzzle-tile {
  border: 0;
  border-radius: 0.72rem;
  background-color: rgba(255, 255, 255, 0.82);
  background-repeat: no-repeat;
  position: relative;
  display: grid;
  place-items: start;
  box-shadow: 0 8px 18px rgba(82, 60, 63, 0.12);
  cursor: default;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.puzzle-tile.movable {
  cursor: pointer;
  box-shadow:
    0 10px 22px rgba(82, 60, 63, 0.14),
    0 0 0 2px rgba(255, 255, 255, 0.44);
}

.puzzle-tile.movable:hover {
  transform: translateY(-2px) scale(1.01);
}

.puzzle-tile.empty {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.26), transparent 60%),
    rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.tile-number {
  margin: 0.35rem;
  min-width: 1.8rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 250, 244, 0.82);
  color: var(--accent-deep);
  font-size: clamp(0.8rem, 2vw, 1rem);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  box-shadow: 0 6px 14px rgba(82, 60, 63, 0.12);
  backdrop-filter: blur(6px);
}

.reveal-panel,
.love-panel {
  position: relative;
  width: min(92vw, 680px);
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: clamp(1.5rem, 4vw, 2.2rem);
  text-align: center;
}

.surprise-popup {
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
  color: var(--accent-deep);
}

.surprise-image-button {
  position: relative;
  width: min(82vw, 460px);
  padding: 0;
  border: 0;
  border-radius: 2rem;
  background: transparent;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 220ms ease, filter 220ms ease;
}

.surprise-image-button:hover {
  transform: translateY(-4px) scale(1.01);
  filter: saturate(1.04);
}

.surprise-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition:
    opacity 260ms ease,
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.surprise-image-button.is-swapping .surprise-image {
  opacity: 0.4;
  transform: scale(0.94);
}

.surprise-sticker {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  width: clamp(5.5rem, 24vw, 8.5rem);
  max-width: 34%;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 8px 14px rgba(84, 51, 65, 0.18));
  z-index: 2;
}

.love-panel {
  overflow: hidden;
  z-index: 1;
  isolation: isolate;
  background: rgba(255, 244, 248, 0.28);
  border-color: rgba(255, 255, 255, 0.38);
  backdrop-filter: none;
}

.love-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 238, 244, 0.1), rgba(255, 229, 238, 0.24)),
    url("rain.gif") center center / cover no-repeat;
  opacity: 0.88;
  pointer-events: none;
  z-index: 0;
}

.love-panel::after {
  content: "";
  position: absolute;
  inset: -10% -12% auto;
  height: 50%;
  background:
    radial-gradient(circle at 15% 25%, rgba(255, 255, 255, 0.48), transparent 22%),
    radial-gradient(circle at 78% 20%, rgba(255, 255, 255, 0.4), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 240, 245, 0.1));
  pointer-events: none;
  z-index: 1;
}

.love-panel > * {
  position: relative;
  z-index: 2;
}

.choice-area {
  position: relative;
  width: min(92vw, 560px);
  height: min(48vh, 300px);
  margin-top: 0.5rem;
}

.choice-button {
  --button-scale: 1;
  position: absolute;
  min-width: 7rem;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.6rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transform: scale(var(--button-scale));
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 260ms ease;
  touch-action: manipulation;
}

.choice-button:hover {
  transform: translateY(-2px) scale(var(--button-scale));
}

.choice-button:active {
  transform: scale(var(--button-scale));
}

.yes-button {
  --button-scale: var(--yes-grow, 1);
  background: linear-gradient(135deg, #ff7ea5, #ff5f8f);
  color: #fff9fb;
  z-index: 2;
}

.yes-button.growing {
  animation: yesGrowPop 320ms ease;
}

.no-button {
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
}

.no-button.dodging {
  animation: dodgeBounce 320ms ease;
}

.flash-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
}

.flash-overlay.active {
  animation: flashBurst 760ms ease-out forwards;
}

.ribbon-burst,
.petal-layer,
.confetti-layer,
.sparkle-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ribbon-burst {
  z-index: 32;
}

.petal-layer,
.confetti-layer,
.sparkle-layer {
  z-index: 32;
}

.ribbon-piece,
.gift-petal-piece,
.gift-flower-piece,
.gift-spark-piece,
.petal,
.confetti-piece,
.sparkle {
  position: absolute;
  will-change: transform, opacity;
}

.ribbon-piece {
  width: var(--size, 14px);
  height: calc(var(--size, 14px) * 3);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0ad, #f4c861 60%, #db9d29);
  box-shadow: 0 6px 14px rgba(221, 157, 43, 0.22);
  left: var(--x);
  top: var(--y);
}

.ribbon-piece,
.gift-petal-piece,
.gift-flower-piece,
.gift-spark-piece {
  left: var(--x);
  top: var(--y);
  animation: giftBurstArc var(--dur, 1.15s) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gift-petal-piece {
  width: var(--size, 18px);
  height: calc(var(--size, 18px) * 1.55);
  border-radius: 84% 0 84% 0;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.46), transparent 36%),
    linear-gradient(135deg, var(--petal-a, #ffd1df), var(--petal-b, #ff7ea5));
  box-shadow: 0 10px 18px rgba(255, 123, 158, 0.18);
}

.gift-flower-piece {
  width: var(--size, 28px);
  height: var(--size, 28px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #ffd76d 0 18%, transparent 20%),
    radial-gradient(circle at 50% 16%, var(--flower-a, #ffdce8) 0 26%, transparent 28%),
    radial-gradient(circle at 84% 50%, var(--flower-b, #ffc2d5) 0 26%, transparent 28%),
    radial-gradient(circle at 50% 84%, var(--flower-c, #ffe7ef) 0 26%, transparent 28%),
    radial-gradient(circle at 16% 50%, var(--flower-b, #ffc2d5) 0 26%, transparent 28%),
    radial-gradient(circle at 72% 24%, var(--flower-c, #ffe7ef) 0 18%, transparent 20%),
    radial-gradient(circle at 28% 76%, var(--flower-a, #ffdce8) 0 18%, transparent 20%);
  filter: drop-shadow(0 10px 18px rgba(255, 182, 201, 0.22));
}

.gift-spark-piece {
  width: var(--size, 14px);
  height: var(--size, 14px);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 28%, rgba(255, 233, 167, 0.92) 30%, transparent 70%);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 10px rgba(255, 233, 171, 0.6));
}

.petal {
  top: -12vh;
  left: var(--left);
  width: 18px;
  height: 28px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.42), transparent 36%),
    linear-gradient(135deg, #ffbfd1, #ff7b9e);
  border-radius: 80% 0 80% 0;
  opacity: 0.9;
  animation: petalFall var(--duration) linear forwards;
}

.confetti-piece {
  top: -12vh;
  left: var(--left);
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: hsl(var(--hue), 100%, 74%);
  animation: confettiFall var(--duration) linear forwards;
}

.sparkle {
  left: var(--left);
  top: var(--top);
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.92);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: sparklePop 1.2s ease-out forwards;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.3rem;
  transform: translate(-50%, 1rem);
  max-width: min(90vw, 440px);
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(84, 51, 65, 0.88);
  color: #fff9fb;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.celebration-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  z-index: 70;
}

.celebration-modal[hidden] {
  display: none !important;
}

.celebration-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(79, 26, 45, 0.24);
  backdrop-filter: blur(8px);
}

.celebration-modal .petal-layer,
.celebration-modal .confetti-layer,
.celebration-modal .sparkle-layer {
  position: absolute;
  z-index: 1;
}

.celebration-card {
  position: relative;
  z-index: 2;
  width: min(92vw, 580px);
  display: grid;
  gap: 0.9rem;
  padding: clamp(1.4rem, 4vw, 2rem);
  text-align: center;
  background: var(--panel-strong);
  border-radius: 2rem;
  box-shadow: var(--shadow);
}

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

@keyframes hintBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

@keyframes lidOpen {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  22% {
    transform: translateY(-12px) rotate(-4deg);
  }
  56% {
    transform: translate(-4px, -58px) rotate(-18deg);
  }
  100% {
    transform: translate(34px, -138px) rotate(-48deg);
  }
}

@keyframes giftPulse {
  0% {
    transform: scale(1);
  }
  18% {
    transform: translateY(4px) scaleX(0.98) scaleY(0.96);
  }
  42% {
    transform: translateY(-8px) scaleX(1.04) scaleY(1.03);
  }
  100% {
    transform: translateY(-2px) scale(1.01);
  }
}

@keyframes giftLift {
  0% {
    transform: translateY(0) scale(1);
  }
  18% {
    transform: translateY(-10px) scale(1.01);
  }
  34% {
    transform: translateY(8px) scale(0.99);
  }
  100% {
    transform: translateY(-14px) scale(1.02);
  }
}

@keyframes giftCoreGlow {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }
  24% {
    opacity: 0.9;
  }
  68% {
    opacity: 0.75;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes giftShockwave {
  0% {
    opacity: 0;
    transform: scale(0.35);
  }
  20% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes boxGlow {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.72);
  }
  28% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translateY(-32px) scale(1.2);
  }
}

@keyframes shadowBurst {
  0% {
    opacity: 0.18;
    transform: scale(1);
  }
  34% {
    opacity: 0.28;
    transform: scale(1.18);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes flashBurst {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@keyframes giftBurstArc {
  0% {
    opacity: 0;
    transform: translate(-50%, -44%) rotate(var(--rot)) scale(0.2);
  }
  16% {
    opacity: 1;
  }
  58% {
    opacity: 1;
    transform:
      translate(calc(-50% + var(--mx)), calc(-50% + var(--my)))
      rotate(var(--rot-mid))
      scale(1);
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
      rotate(var(--rot-end))
      scale(var(--scale-end, 0.46));
  }
}

@keyframes petalFall {
  0% {
    opacity: 0;
    transform: translate3d(0, -4vh, 0) rotate(0deg);
  }
  10% {
    opacity: 0.95;
  }
  100% {
    opacity: 0.1;
    transform:
      translate3d(var(--drift), 115vh, 0)
      rotate(var(--spin));
  }
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translate3d(0, -4vh, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform:
      translate3d(var(--drift), 115vh, 0)
      rotate(var(--spin));
  }
}

@keyframes sparklePop {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  30% {
    opacity: 1;
    transform: scale(1.1) rotate(25deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.2) rotate(60deg);
  }
}

@keyframes dodgeBounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes yesGrowPop {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes gradientDance {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes floatGlow {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-22px) scale(1.06);
  }
}

@media (max-width: 860px) {
  .puzzle-panel {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .panel-copy {
    justify-items: center;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .gift-box {
    width: min(72vw, 15rem);
  }

  .hover-hand {
    right: -0.4rem;
  }

  .panel {
    border-radius: 1.5rem;
  }

  .puzzle-board {
    gap: 2px;
    padding: 5px;
    border-radius: 1.3rem;
  }

  .puzzle-tile {
    border-radius: 0.5rem;
  }

  .choice-area {
    height: min(46vh, 260px);
  }

  .choice-button {
    min-width: 6rem;
    padding: 0.85rem 1.35rem;
  }
}

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