/* ============================================================
   Caroline  -  a very cute second date proposal
   Mobile first. Everything scales up from a 320px phone.
   ============================================================ */

:root {
  --pink-bg: #ffeff4;
  --pink-bg-2: #ffe4ec;
  --card: #fffafb;
  --brown: #6b4636;
  --brown-soft: #8a6553;
  --brown-faint: #b09184;
  --rose: #ea8fa9;
  --rose-deep: #d96f8d;
  --rose-pale: #ffd7e2;
  --gold: #e8b56a;

  --radius: 20px;
  --shadow: 0 6px 20px rgba(180, 120, 130, 0.14);
  --shadow-lift: 0 14px 32px rgba(180, 120, 130, 0.26);

  --font-display: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--pink-bg);
  background-image:
    radial-gradient(120% 60% at 50% 0%, #fff6f9 0%, var(--pink-bg) 45%, var(--pink-bg-2) 100%);
  background-attachment: fixed;
  color: var(--brown);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.page {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 20px)
    calc(env(safe-area-inset-right) + 18px)
    calc(env(safe-area-inset-bottom) + 28px)
    calc(env(safe-area-inset-left) + 18px);
}

/* ---------- floating hearts in the background ---------- */
.floaties {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.floaty {
  position: absolute;
  bottom: -40px;
  font-size: 18px;
  opacity: 0.5;
  animation: floatUp linear forwards;
  will-change: transform, opacity;
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 0; }
  12%  { opacity: 0.55; }
  85%  { opacity: 0.4; }
  100% { transform: translateY(-105dvh) rotate(28deg) scale(1.05); opacity: 0; }
}

/* ---------- banner ---------- */
.banner {
  position: relative;
  z-index: 1;
  text-align: center;
  margin: 4px 0 26px;
  animation: dropIn 0.7s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.banner-hearts {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 6px;
  animation: beat 1.9s ease-in-out infinite;
}
.banner h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 7.6vw, 2.5rem);
  line-height: 1.15;
  margin: 0;
  color: var(--brown);
  text-shadow: 0 2px 0 #fff, 0 3px 10px rgba(214, 140, 160, 0.22);
  text-wrap: balance;
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.18); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- steps ---------- */
.step {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 2px solid #ffe1ea;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px 20px;
  margin-bottom: 18px;
}
.step[hidden] { display: none; }
.step.is-entering { animation: stepIn 0.55s cubic-bezier(0.2, 1.1, 0.4, 1) both; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.15rem, 5vw, 1.5rem);
  line-height: 1.25;
  margin: 0 0 16px;
  color: var(--brown);
  text-wrap: balance;
}
.section-title.verified {
  text-align: center;
  color: var(--rose-deep);
}

/* ---------- the checklists ---------- */
.checklist {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}
.item {
  display: none;
  margin-bottom: 10px;
}
.item.is-revealed {
  display: block;
  animation: popIn 0.45s cubic-bezier(0.2, 1.35, 0.45, 1) both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.check {
  touch-action: manipulation;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px 10px 12px;
  background: #fff;
  border: 2px solid var(--rose-pale);
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
  user-select: none;
}
.check:active { transform: scale(0.985); }
.check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.box {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 2.5px solid var(--rose);
  background: #fff;
  position: relative;
  transition: background 0.22s, border-color 0.22s, transform 0.22s;
}
.box::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 7px;
  height: 13px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.22s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.label {
  font-weight: 600;
  color: var(--brown);
  font-size: 0.98rem;
  line-height: 1.35;
}
.check:has(input:checked) {
  background: #fff4f7;
  border-color: var(--rose);
}
.check:has(input:checked) .box {
  background: var(--rose);
  border-color: var(--rose);
  transform: scale(1.05);
}
.check:has(input:checked) .box::after { transform: rotate(45deg) scale(1); }
.check:has(input:checked) .label { color: var(--brown-soft); }
.check:has(input:focus-visible) { outline: 3px solid var(--rose-deep); outline-offset: 2px; }

/* Fallback for browsers without :has() -- app.js mirrors the state as a class */
.check.is-checked { background: #fff4f7; border-color: var(--rose); }
.check.is-checked .box { background: var(--rose); border-color: var(--rose); transform: scale(1.05); }
.check.is-checked .box::after { transform: rotate(45deg) scale(1); }
.check.is-checked .label { color: var(--brown-soft); }

/* ---------- buttons ---------- */
.btn {
  touch-action: manipulation;
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 14px 20px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  background: #d9cdc9;
  box-shadow: 0 4px 0 #c3b5b0;
  cursor: not-allowed;
  transition: background 0.3s, box-shadow 0.3s, transform 0.12s, color 0.3s;
  -webkit-appearance: none;
  appearance: none;
}
.btn:disabled { opacity: 0.85; }
.btn.is-ready {
  cursor: pointer;
  background: linear-gradient(180deg, var(--rose) 0%, var(--rose-deep) 100%);
  box-shadow: 0 5px 0 #c15c7b, 0 10px 22px rgba(217, 111, 141, 0.4);
  animation: glow 1.8s ease-in-out infinite;
}
.btn.is-ready:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #c15c7b, 0 4px 12px rgba(217, 111, 141, 0.35);
}
@keyframes glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.09); }
}
.btn:focus-visible { outline: 3px solid var(--brown); outline-offset: 3px; }

/* ---------- the sentence ---------- */
.step-build { text-align: center; }

.sentence {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 5.4vw, 1.6rem);
  line-height: 1.45;
  margin: 6px 0 14px;
  color: var(--brown);
  text-wrap: balance;
}
.sentence-text { display: inline; }

.slot {
  margin: 12px auto 0;
  min-height: 74px;
  width: 100%;
  padding: 12px 14px;
  border: 3px dashed var(--rose);
  border-radius: 18px;
  background: #fff6f9;
  color: var(--brown-faint);
  font-size: 0.92rem;
  font-family: var(--font-body);
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.slot.is-over {
  background: var(--rose-pale);
  border-color: var(--rose-deep);
  transform: scale(1.03);
  box-shadow: 0 0 0 6px rgba(234, 143, 169, 0.18);
}
.slot.is-filled {
  border-style: solid;
  background: #fff;
  border-color: var(--rose-deep);
  color: var(--brown);
  font-family: var(--font-display);
  font-size: 1.08rem;
  box-shadow: var(--shadow);
  animation: dropBounce 0.5s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes dropBounce {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.slot:focus-visible { outline: 3px solid var(--brown); outline-offset: 3px; }

.hint {
  font-size: 0.88rem;
  color: var(--brown-faint);
  margin: 0 0 14px;
  font-weight: 600;
}

/* ---------- draggable answer chips ---------- */
.tray {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  min-height: 4px;
}

.chip {
  display: block;
  width: 100%;
  padding: 14px 16px;
  min-height: 52px;
  border: 2px solid var(--rose-pale);
  border-radius: 16px;
  background: #fff;
  color: var(--brown);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 3px 0 #ffdde7;
  cursor: grab;
  touch-action: none;            /* let us handle the drag, not the scroller */
  user-select: none;
  -webkit-user-select: none;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.14s, box-shadow 0.14s, border-color 0.2s, opacity 0.2s;
  animation: popIn 0.4s cubic-bezier(0.2, 1.35, 0.45, 1) both;
}
.chip:active { transform: scale(0.98); }
.chip.chip-angry { border-color: #f3d2c4; box-shadow: 0 3px 0 #f6e0d5; }
.chip.is-dragging { opacity: 0.28; }
.chip.is-gone { display: none; }
.chip:focus-visible { outline: 3px solid var(--rose-deep); outline-offset: 3px; }

/* the element that follows your finger */
.chip-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  margin: 0;
  border-color: var(--rose);
  box-shadow: var(--shadow-lift);
  transform: rotate(-2.5deg) scale(1.04);
  opacity: 0.97;
  animation: none;
}

/* the chosen answer sitting inside the slot */
.slot .chosen {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--rose-deep);
}
.send-status {
  margin: 12px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brown-faint);
  min-height: 1.2em;
}

/* ---------- the happy ending ---------- */
.step-finale {
  text-align: center;
  padding: 34px 20px 30px;
}
.finale-heart {
  font-size: 62px;
  line-height: 1;
  animation: beat 1.6s ease-in-out infinite;
}
.finale-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6.5vw, 2rem);
  margin: 10px 0 14px;
  color: var(--rose-deep);
}
.finale-sentence {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4.8vw, 1.35rem);
  line-height: 1.4;
  margin: 0 auto 14px;
  padding: 16px 18px;
  max-width: 26em;
  background: #fff6f9;
  border: 2px solid var(--rose-pale);
  border-radius: 16px;
  color: var(--brown);
  text-wrap: balance;
}
.finale-note {
  margin: 0;
  color: var(--brown-soft);
  font-weight: 600;
}

/* ---------- bigger screens get a touch more room ---------- */
@media (min-width: 560px) {
  body { font-size: 18px; }
  .step { padding: 28px 26px 24px; }
  .tray { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .chip { width: auto; flex: 1 1 46%; }
}

@media (hover: hover) {
  .check:hover { border-color: var(--rose); background: #fff6f9; }
  .chip:hover { transform: translateY(-2px); border-color: var(--rose); box-shadow: 0 5px 0 #ffd0dd; }
  .btn.is-ready:hover { filter: brightness(1.05); }
}

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