/* ============ Tokens ============ */
:root {
  --copy-size: 26px;       /* main text on screens 2–5 */
  --ink: #4a1d3a;          /* headings, deep plum */
  --text: #7a4d66;         /* body */
  --muted: #b08ea1;
  --pink: #ff5fa2;
  --pink-soft: #ff8cc0;
  --pink-deep: #e8438d;
  --lilac: #cfa9ff;
  --glass: rgba(255, 255, 255, 0.64);
  --glass-border: rgba(255, 255, 255, 0.9);
  --shadow: 0 30px 60px -24px rgba(232, 67, 141, 0.38), 0 10px 24px -14px rgba(110, 40, 85, 0.18);
  --radius: 34px;
  --font-display: "Playfair Display", Georgia, serif;
  --font-script: "Dancing Script", cursive;
  --font-body: "Quicksand", -apple-system, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: #fff6fa;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* dreamy pastel backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(70% 45% at 10% 6%, #ffc8e0 0%, transparent 65%),
    radial-gradient(60% 40% at 96% 28%, #ead5ff 0%, transparent 65%),
    radial-gradient(80% 50% at 40% 106%, #ffd2e6 0%, transparent 62%),
    radial-gradient(55% 38% at 88% 92%, #f9dcf3 0%, transparent 60%),
    linear-gradient(180deg, #fff5f9 0%, #ffeaf3 100%);
}

.sad-tint {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(70% 45% at 50% 0%, #e9ecf5 0%, transparent 70%),
    linear-gradient(180deg, #f4f2f7 0%, #e5e8f0 100%);
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
body[data-screen="sad"] .sad-tint { opacity: 1; }

/* floating flowers & sparkles */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 1.2s ease, filter 1.2s ease;
}
body[data-screen="sad"] .ambient { opacity: 0.25; filter: grayscale(1); }

.float-item {
  position: absolute;
  bottom: -40px;
  opacity: 0;
  animation: rise var(--dur) linear var(--delay) infinite;
}
.float-item svg, .burst svg, .dust svg { display: block; width: 100%; height: 100%; fill: currentColor; }

@keyframes rise {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: var(--o); }
  50%  { transform: translate3d(var(--sway), -55vh, 0) rotate(18deg); }
  90%  { opacity: var(--o); }
  100% { transform: translate3d(0, -115vh, 0) rotate(-12deg); opacity: 0; }
}

/* ============ Layout ============ */
.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: max(28px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(22px) scale(0.98);
  transition:
    opacity 0.55s ease,
    transform 0.7s var(--ease-out),
    visibility 0s linear 0.7s;
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition:
    opacity 0.7s ease 0.18s,
    transform 0.9s var(--ease-out) 0.18s,
    visibility 0s;
}
.screen.is-leaving { transform: translateY(-18px) scale(0.98); }

/* ============ Content column (no card box) ============ */
.card {
  position: relative;
  width: 100%;
  margin: auto 0;
  padding: 8px 0;
  text-align: center;
}

/* ============ Type ============ */
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pink-deep);
  margin-bottom: 12px;
}
.title, .line {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(31px, 9vw, 38px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.screen:not(#s-intro) .title,
.line {
  font-size: var(--copy-size);
  line-height: 1.2;
}
#s-final { --copy-size: 22px; } /* "See you" */
.title em, .line em {
  font-style: italic;
  color: var(--pink-deep);
}

.sub {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.label {
  margin: 22px 4px 9px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.label.center {
  margin-top: 30px;
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--text);
}

/* animated lines */
.line + .line { margin-top: 16px; }
.line, .title, .sub { text-wrap: balance; }

.line .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px);
  filter: blur(6px);
}
.line.play .w {
  animation: wordIn 0.75s var(--ease-out) forwards;
  animation-delay: calc(var(--base, 0ms) + var(--i) * var(--stagger, 62ms));
}
.screen.instant .line .w {
  animation: wordIn 0.3s ease forwards !important;
  animation-delay: 0s !important;
}
@keyframes wordIn { to { opacity: 1; transform: none; filter: blur(0); } }

[data-after] {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.7s var(--ease-out);
}
[data-after].show { opacity: 1; transform: none; pointer-events: auto; }

/* ============ Buttons ============ */
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 58px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.18s ease, box-shadow 0.3s ease, background 0.3s ease, opacity 0.3s ease;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 3px solid rgba(255, 95, 162, 0.45); outline-offset: 3px; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #ff93c4 0%, #ff5fa2 52%, #ec3f8a 100%);
  box-shadow: 0 16px 30px -12px rgba(236, 63, 138, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  text-shadow: 0 1px 2px rgba(170, 30, 95, 0.25);
}
.btn-primary:disabled {
  cursor: default;
  background: linear-gradient(135deg, #f8d6e5, #f4c6da);
  box-shadow: none;
  text-shadow: none;
}
.btn-primary:disabled:active { transform: none; }

.btn-sad {
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  color: #a1969c;
  background: #efe9ec;
  box-shadow: inset 0 1px 2px rgba(60, 30, 45, 0.06);
  filter: saturate(0.6);
}

.btn-ghost {
  width: auto;
  height: 48px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 600;
  color: #6f6a7d;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 24px -14px rgba(70, 70, 110, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s var(--ease-out);
}
.btn-ghost.show { opacity: 1; transform: none; pointer-events: auto; }

/* ============ Picker ============ */
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.day, .time {
  border: 0;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1.5px rgba(255, 170, 205, 0.45), 0 6px 14px -10px rgba(200, 70, 135, 0.45);
  transition: transform 0.25s var(--ease-out), background 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}
.day {
  padding: 11px 0 10px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.day .dow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.day .dnum { font-size: 19px; font-weight: 700; color: var(--ink); }

.times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.time {
  height: 52px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.time .ic { font-size: 17px; }

.day[aria-checked="true"], .time[aria-checked="true"] {
  background: linear-gradient(155deg, #ff93c4 0%, #ff5fa2 55%, #ec3f8a 100%);
  box-shadow: 0 12px 22px -10px rgba(236, 63, 138, 0.8);
  transform: translateY(-3px);
}
.day[aria-checked="true"] .dow,
.day[aria-checked="true"] .dnum,
.time[aria-checked="true"] { color: #fff; }
.day:active, .time:active { transform: scale(0.94); }

.picked {
  min-height: 22px;
  margin-top: 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.3s ease;
}
.picked.ok { color: var(--pink-deep); }

/* ============ Allergies ============ */
.field {
  display: block;
  width: 100%;
  min-height: 104px;
  margin-top: 22px;
  padding: 15px 18px;
  border: 1.5px solid rgba(255, 160, 200, 0.55);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  resize: none;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.field::placeholder { color: #cbb0bf; }
.field:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 5px rgba(255, 95, 162, 0.14);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.chip {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--pink-deep);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 95, 162, 0.35);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.18s ease;
}
.chip:active { transform: scale(0.94); }

/* ============ Final ============ */
.when {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 160, 200, 0.4), 0 10px 22px -14px rgba(232, 67, 141, 0.6);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.when-dot { color: var(--pink); }
.when-time { color: var(--pink-deep); }

.cal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn-cal {
  height: 58px;
  padding: 0 14px;
  font-size: 17px;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 140, 192, 0.5), 0 10px 20px -12px rgba(236, 63, 138, 0.5);
}
.btn-cal svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--pink-deep);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ Sad ============ */
.screen.sad {
  justify-content: center;
  gap: 40px;
}
.sad-emoji {
  font-size: 150px;
  line-height: 1;
  filter: drop-shadow(0 24px 30px rgba(80, 90, 130, 0.25));
}
.sad-emoji.play {
  animation: sadIn 0.9s cubic-bezier(0.2, 1.5, 0.4, 1) both, sway 3.2s ease-in-out 0.9s infinite;
}
@keyframes sadIn {
  from { transform: scale(0.3) translateY(40px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg) translateY(4px); }
}

.rain { /* falls behind the big emoji */
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.rain span {
  position: absolute;
  top: -80px;
  line-height: 1;
  animation: fall var(--dur) cubic-bezier(0.45, 0.05, 0.7, 0.55) var(--delay) both;
}
@keyframes fall {
  from { transform: translateY(0) rotate(0deg); }
  to   { transform: translateY(calc(100vh + 160px)) rotate(var(--rot)); }
}

/* ============ Scratch cover ============ */
.scratch {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: linear-gradient(160deg, #ffcfe4 0%, #ffaad2 38%, #e9b5ff 70%, #b9d0ff 100%);
  transition: opacity 0.9s ease, transform 1s var(--ease-out);
}
.scratch.ready { background: transparent; }
.scratch canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}
.scratch.gone { opacity: 0; transform: scale(1.06); }
.scratch.gone canvas { pointer-events: none; }

.scratch-hint {
  position: absolute;
  left: 50%;
  top: 58%;
  font-size: 42px;
  pointer-events: none;
  filter: drop-shadow(0 8px 12px rgba(180, 40, 110, 0.35));
  animation: hintMove 2.4s ease-in-out infinite;
  transition: opacity 0.4s ease;
}
.scratch-hint.hide { opacity: 0; }
@keyframes hintMove {
  0%, 100% { transform: translate(-110%, 0) rotate(-14deg); }
  50%      { transform: translate(10%, -12px) rotate(10deg); }
}

/* particles */
.dust, .burst {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.9));
}
.dust { animation: dust 0.9s ease-out forwards; }
@keyframes dust {
  from { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  to   { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2) rotate(120deg); opacity: 0; }
}
.burst { animation: burst 1.2s cubic-bezier(0.15, 0.7, 0.3, 1) forwards; }
@keyframes burst {
  0%   { transform: translate(-50%, -50%) scale(0.2) rotate(0deg); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1) rotate(var(--r)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .float-item, .scratch-hint { animation: none; }
}
