:root {
  --bg-top: #f9e2e9;
  --bg-mid: #f3d6e0;
  --bg-bottom: #f6e1e7;

  --card-bg: #fcfaf6;
  --card-shadow: 0 22px 54px rgba(128, 52, 82, 0.13), 0 4px 14px rgba(128, 52, 82, 0.06);
  --card-radius: 28px;

  --ink-heading: #5f1d36;
  --ink-body: #6d4f5c;
  --ink-muted: #937480;

  --pink: #dc6891;
  --pink-hover: #d81b76;
  --pink-disabled: #e3a2b8;
  --pink-shadow: 0 8px 22px rgba(220, 104, 145, 0.34);
  --pink-shadow-hover: 0 10px 26px rgba(216, 27, 118, 0.42);

  --purple: #a56abe;
  --purple-shadow: 0 8px 20px rgba(165, 106, 190, 0.32);

  --border-soft: #d9b7c4;
  --border-focus: #d85a88;
  --tile-bg: #f5eeee;
  --tile-selected-bg: #f7e2e9;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.22, 1.28, 0.36, 1);

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Lora', Georgia, 'Times New Roman', serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink-body);
  background: radial-gradient(circle at 20% 15%, #fcebf0 0%, transparent 48%),
              radial-gradient(circle at 82% 85%, #f0c9d8 0%, transparent 50%),
              linear-gradient(160deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(20px + env(safe-area-inset-top, 0px))
           calc(16px + env(safe-area-inset-right, 0px))
           calc(56px + env(safe-area-inset-bottom, 0px))
           calc(16px + env(safe-area-inset-left, 0px));
  overflow-x: hidden;
  position: relative;
}

/* Ambient floating petals & hearts */
.ambient-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.ambient-particle {
  position: absolute;
  bottom: -40px;
  opacity: 0;
  user-select: none;
  will-change: transform, opacity;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: var(--p-opacity, 0.55);
  }
  85% {
    opacity: var(--p-opacity, 0.55);
  }
  100% {
    transform: translate3d(var(--p-drift, 28px), calc(-100vh - 80px), 0) rotate(var(--p-rot, 180deg));
    opacity: 0;
  }
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

/* Stage & Cards */
.stage {
  position: relative;
  z-index: 5;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 448px;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 42px 36px 38px;
  text-align: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.75);
}

.card-wide {
  max-width: 540px;
}

.step {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out);
}

.step.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.step[hidden] {
  display: none;
}

/* Hero image (Step 1) */
.hero-media {
  width: 132px;
  height: 132px;
  margin: 0 auto 24px;
  border-radius: 22px;
  overflow: hidden;
  background: #e9e6e4;
  box-shadow: 0 10px 24px rgba(95, 29, 54, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-media.is-embed {
  width: 100%;
  max-width: 280px;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  background: #1a1518;
  isolation: isolate;
}

.hero-embed {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 18px;
  display: block;
  pointer-events: none;
}

.hero-emoji-fallback {
  font-size: 64px;
  line-height: 1;
}

/* Step 2 red sponge reaction badge */
.reaction-badge {
  width: 112px;
  height: 112px;
  margin: 0 auto 24px;
  border-radius: 24px;
  background: linear-gradient(145deg, #d72222 0%, #b51515 100%);
  box-shadow: 0 12px 26px rgba(181, 21, 21, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  line-height: 1;
  user-select: none;
}

.step-icon {
  font-size: 46px;
  line-height: 1.1;
  margin-bottom: 14px;
  user-select: none;
}

.icon-paws {
  font-size: 30px;
  margin-left: 2px;
  vertical-align: top;
}

.card-emoji {
  font-size: 42px;
}

/* Typography */
.heading {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-heading);
  margin: 0 0 14px;
  line-height: 1.24;
  letter-spacing: -0.01em;
}

.ask-heading {
  font-size: clamp(1.62rem, 4.6vw, 2.02rem);
  margin-bottom: 30px;
}

.yes-heading {
  font-size: clamp(1.55rem, 4.4vw, 1.95rem);
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}

.confirm-heading {
  font-size: clamp(1.58rem, 4.4vw, 2.05rem);
  margin-bottom: 16px;
}

.subtitle {
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink-body);
  margin: 0 0 28px;
}

.food-subtitle {
  margin-bottom: 24px;
  color: var(--ink-muted);
}

.fee-subtitle {
  max-width: 340px;
  margin: 0 auto 24px;
  font-size: 0.96rem;
}

.ps-note {
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 420px;
  margin: 0 auto 20px;
}

.heart-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--pink);
  font-size: 1.05rem;
  margin-bottom: 26px;
  letter-spacing: 2px;
  user-select: none;
}

/* Buttons */
button,
a,
[role="button"] {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.05rem;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 140ms var(--ease-out),
              background-color 180ms ease,
              box-shadow 180ms ease,
              opacity 180ms ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-yes {
  background-color: var(--pink);
  color: #ffffff;
  box-shadow: var(--pink-shadow);
}

@media (hover: hover) and (pointer: fine) {
  .btn-yes:not(:disabled):hover {
    background-color: var(--pink-hover);
    box-shadow: var(--pink-shadow-hover);
    transform: translateY(-1px);
  }

  .btn-yes:not(:disabled):active {
    transform: scale(0.97);
  }
}

.btn-yes:disabled {
  background-color: var(--pink-disabled);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.82;
}

.btn-no {
  background-color: var(--purple);
  color: #ffffff;
  box-shadow: var(--purple-shadow);
  padding: 13px 26px;
  font-size: 1rem;
  white-space: nowrap;
}

.btn-no.is-escaping {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  transition: transform 240ms var(--ease-spring);
}

.btn-pill-wide {
  min-width: 196px;
}

.btn-full {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.06rem;
}

.ask-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 54px;
}

.no-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 102px;
  min-height: 48px;
}

.single-action {
  display: flex;
  justify-content: center;
}

.link-back {
  margin-top: 16px;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  transition: color 160ms ease, transform 120ms var(--ease-out);
}

.link-back:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .link-back:hover {
    color: var(--ink-heading);
  }
}

/* Step 3: Date & Time Form */
.date-form {
  text-align: left;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink-heading);
}

input[type="date"],
select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px; /* Prevents iOS Safari auto-zoom */
  color: var(--ink-heading);
  background: #fdfbf8;
  border: 1.5px solid var(--border-soft);
  border-radius: 13px;
  padding: 13px 15px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

select {
  cursor: pointer;
}

select:invalid {
  color: var(--ink-muted);
}

input[type="date"] {
  min-height: 50px;
}

input[type="date"]:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(220, 104, 145, 0.16);
}

.date-form .btn-full {
  margin-top: 6px;
}

/* Step 4: Food Grid */
.food-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.food-tile {
  background: var(--tile-bg);
  border: 1.5px solid transparent;
  border-radius: 18px;
  padding: 20px 10px 17px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink-heading);
  opacity: 0;
  transform: translateY(8px);
  transition: background-color 160ms ease,
              border-color 160ms ease,
              transform 150ms var(--ease-out),
              box-shadow 160ms ease;
}

.step.is-active .food-tile {
  animation: tileIn 260ms var(--ease-out) forwards;
}

@keyframes tileIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.food-tile:active {
  transform: scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  .food-tile:hover {
    background: var(--tile-selected-bg);
    border-color: var(--pink);
    box-shadow: 0 6px 18px rgba(220, 104, 145, 0.15);
  }
}

.food-tile.is-selected {
  background: var(--tile-selected-bg);
  border-color: var(--pink);
  box-shadow: 0 6px 18px rgba(220, 104, 145, 0.22);
}

.food-emoji {
  font-size: 36px;
  line-height: 1;
}

.food-label {
  font-size: 0.98rem;
  font-weight: 500;
}

/* Step 6: Fee Box */
.fee-box {
  border: 1.5px solid var(--border-soft);
  border-radius: 16px;
  background: #f9f3f4;
  padding: 18px 20px;
  margin-bottom: 24px;
  text-align: left;
}

.fee-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.fee-item {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--ink-heading);
}

.fee-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.42rem;
  color: #d6356b;
}

.fee-fine-print {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
  text-align: center;
}

/* Step 7: Receipt */
.final-subtitle {
  margin-bottom: 22px;
  font-size: 0.95rem;
}

.receipt-card {
  border: 1.5px dashed var(--border-soft);
  border-radius: 16px;
  background: #faf4f5;
  padding: 18px 20px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.95rem;
}

.receipt-label {
  color: var(--ink-muted);
}

.receipt-value {
  color: var(--ink-heading);
  font-weight: 600;
  text-align: right;
}

.receipt-divider {
  border-top: 1px solid #e6cfd7;
  margin: 2px 0;
}

.receipt-strike {
  color: var(--ink-muted);
  font-weight: 400;
  margin-right: 6px;
}

.receipt-free {
  color: #d6356b;
}

.final-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.toast-msg {
  min-height: 22px;
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--pink-hover);
  font-weight: 500;
}

.link-back-subtle {
  margin-top: 6px;
  font-size: 0.85rem;
  opacity: 0.85;
}

.cheeky-alert {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #f9e6ed;
  border: 1px solid #ecc4d3;
  color: var(--ink-heading);
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.45;
  animation: alertPop 220ms var(--ease-out);
}

.cheeky-alert[hidden] {
  display: none;
}

@keyframes alertPop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Gentle shake animation for invalid submission */
@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.is-shaking {
  animation: gentleShake 260ms ease-in-out;
}

/* Footer */
.site-footer {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(109, 79, 92, 0.72);
  z-index: 4;
  pointer-events: none;
}

/* Responsive adjustments for mobile phones */
@media (max-width: 520px) {
  .card {
    padding: 34px 22px 30px;
    border-radius: 24px;
  }

  .hero-media {
    width: 118px;
    height: 118px;
  }

  .reaction-badge {
    width: 98px;
    height: 98px;
    font-size: 50px;
  }

  .food-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
  }

  .food-tile {
    padding: 15px 6px 13px;
    border-radius: 15px;
    gap: 7px;
  }

  .food-emoji {
    font-size: 30px;
  }

  .food-label {
    font-size: 0.85rem;
  }

  .ask-actions {
    gap: 12px;
  }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  .ambient-particle {
    animation: none;
    display: none;
  }

  .step,
  .btn,
  .food-tile {
    transition-duration: 120ms;
  }

  .step {
    transform: none;
  }

  .step.is-active .food-tile {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
