/* ---------- floating hearts background (10 elements, transform/opacity only) ---------- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.sky i {
  position: absolute;
  bottom: -40px;
  width: var(--s, 18px);
  height: var(--s, 18px);
  left: var(--x, 50%);
  opacity: 0;
  background: var(--c, var(--pink));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: float var(--d, 16s) linear var(--delay, 0s) infinite;
  will-change: transform, opacity;
}
.sky i:nth-child(1) { --x: 6%; --s: 14px; --d: 17s; --delay: -2s; }
.sky i:nth-child(2) { --x: 18%; --s: 22px; --d: 21s; --delay: -11s; --c: var(--peach); }
.sky i:nth-child(3) { --x: 31%; --s: 12px; --d: 15s; --delay: -6s; --c: var(--lilac); }
.sky i:nth-child(4) { --x: 44%; --s: 18px; --d: 19s; --delay: -15s; }
.sky i:nth-child(5) { --x: 57%; --s: 26px; --d: 24s; --delay: -4s; --c: var(--lilac); }
.sky i:nth-child(6) { --x: 68%; --s: 13px; --d: 16s; --delay: -9s; --c: var(--peach); }
.sky i:nth-child(7) { --x: 79%; --s: 20px; --d: 20s; --delay: -17s; }
.sky i:nth-child(8) { --x: 90%; --s: 15px; --d: 18s; --delay: -1s; --c: var(--lilac); }
.sky i:nth-child(9) { --x: 25%; --s: 10px; --d: 23s; --delay: -19s; --c: var(--peach); }
.sky i:nth-child(10) { --x: 72%; --s: 11px; --d: 22s; --delay: -13s; }

@keyframes float {
  0% { transform: translate3d(0, 0, 0) rotate(-8deg); opacity: 0; }
  10% { opacity: 0.45; }
  50% { transform: translate3d(14px, -55vh, 0) rotate(8deg); }
  90% { opacity: 0.35; }
  100% { transform: translate3d(-10px, -110vh, 0) rotate(-6deg); opacity: 0; }
}

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding: 8px 6px 4px;
  animation: rise 0.7s var(--ease) both;
}
.title {
  margin: 0;
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, var(--pink-deep), #c879b8 55%, var(--lilac-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  margin: 10px auto 0;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 16px;
}

/* ---------- chat reaction ---------- */
.chat {
  position: sticky;
  top: calc(8px + var(--safe-t));
  z-index: 5;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.avatar {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--pink-pale), #fff);
  box-shadow: var(--shadow-sm);
  border: 2px solid #fff;
}
.bubble {
  position: relative;
  max-width: 100%;
  padding: 11px 15px;
  border-radius: 20px 20px 20px 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  font-size: 15.5px;
  overflow-wrap: anywhere;
  white-space: pre-line;
  transform-origin: 0 100%;
}
.bubble.pop {
  animation: pop 0.45s var(--spring) both;
}
.bubble.tone-error {
  background: #fff3f4;
  color: #a4475b;
}
.bubble.tone-busy {
  background: #fff6f0;
}
@keyframes pop {
  0% { opacity: 0; transform: translateY(6px) scale(0.85); }
  100% { opacity: 1; transform: none; }
}

/* ---------- loading / fatal ---------- */
.loading {
  text-align: center;
  color: var(--ink-soft);
}
.loading p {
  margin: 10px 0 0;
}
.dots {
  display: inline-flex;
  gap: 6px;
}
.dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pink);
  animation: blink 1.2s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; background: var(--peach); }
.dots i:nth-child(3) { animation-delay: 0.3s; background: var(--lilac); }
@keyframes blink {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}
.fatal {
  display: grid;
  place-items: center;
  padding: 30px 0;
}

/* ---------- picker ---------- */
.label {
  margin: 0 0 10px 2px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: lowercase;
}
.label:not(:first-child) {
  margin-top: 18px;
}

/* The ribbon scrolls inside the card; the card's padding is cancelled with negative
   margins so items can scroll edge to edge without causing page-level overflow. */
.days {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  margin: 0 -18px;
  padding: 4px 18px 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.days::-webkit-scrollbar {
  display: none;
}
.day {
  flex: none;
  scroll-snap-align: center;
  width: 62px;
  min-height: 80px;
  padding: 8px 4px;
  border: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.35s var(--spring), background 0.25s, color 0.25s, box-shadow 0.25s;
  touch-action: manipulation;
}
.day .wd {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: lowercase;
}
.day .num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.day .rel {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--pink-deep);
  min-height: 14px;
}
.day.no-free {
  opacity: 0.5;
}
.day:active {
  transform: scale(0.94);
}
.day[aria-selected='true'] {
  background: linear-gradient(150deg, var(--pink-deep), var(--pink) 65%, var(--peach));
  color: #fff;
  box-shadow: 0 8px 18px rgba(226, 114, 143, 0.38);
  transform: translateY(-3px) scale(1.04);
}
.day[aria-selected='true'] .wd,
.day[aria-selected='true'] .rel {
  color: rgba(255, 255, 255, 0.92);
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 9px;
}
.slot {
  min-height: 48px;
  border: 1.5px solid transparent;
  border-radius: 16px;
  background: #fff;
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(214, 112, 140, 0.1);
  transition: transform 0.35s var(--spring), background 0.2s, color 0.2s, box-shadow 0.2s;
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 25ms);
  touch-action: manipulation;
}
.slot:active {
  transform: scale(0.93);
}
.slot.busy {
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink-faint);
  box-shadow: none;
  text-decoration: line-through;
  text-decoration-color: rgba(185, 162, 173, 0.6);
  cursor: not-allowed;
}
.slot.selected {
  background: linear-gradient(140deg, var(--lilac-deep), var(--pink) 80%);
  color: #fff;
  transform: scale(1.06);
  box-shadow: 0 8px 18px rgba(169, 139, 214, 0.4);
}
.slot.shake {
  animation: shake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px) rotate(-1deg); }
  20%, 80% { transform: translateX(3px) rotate(2deg); }
  30%, 50%, 70% { transform: translateX(-5px) rotate(-3deg); }
  40%, 60% { transform: translateX(5px) rotate(3deg); }
}
.empty {
  margin: 4px 0 0;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- form ---------- */
.picked {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--pink-pale);
  color: var(--ink-soft);
  font-size: 15px;
}
.picked strong {
  color: var(--ink);
}
.counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.counter.over {
  color: var(--danger);
  font-weight: 800;
}
.form .btn.big {
  margin-top: 18px;
}

/* ---------- success ---------- */
.done {
  text-align: center;
  padding-top: 28px;
}
.done-heart {
  width: 74px;
  height: 74px;
  margin: 0 auto;
  background: linear-gradient(140deg, var(--pink-deep), var(--pink) 60%, var(--peach));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: heartbeat 1.6s var(--ease) 0.3s infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.14); }
  30% { transform: scale(0.97); }
  45% { transform: scale(1.08); }
}
.done-title {
  margin: 14px 0 4px;
  font-size: 26px;
  font-weight: 800;
}
.done-slot {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--pink-deep);
}
.done-bubble {
  display: inline-block;
  margin: 18px 0 20px;
  text-align: left;
  border-radius: 20px;
}
.done .btn {
  width: 100%;
}

.burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}
.burst i {
  position: absolute;
  left: 50%;
  top: 45%;
  width: var(--s);
  height: var(--s);
  background: var(--c);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: burst 1.6s var(--ease) var(--delay) forwards;
  opacity: 0;
}
@keyframes burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--r)) scale(1); }
}

.footer {
  margin-top: 26px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
}
.footer:empty {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .sky,
  .burst {
    display: none;
  }
}
