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

:root {
  /* the comparison page's background, so the designs sit on what they were
     drawn against — Trails in particular fades toward exactly this colour */
  --bg: #08040a;
  --cream: #fdf6ec;
  --rose: #ff2d6f;
  --rose-deep: #c81e5a;
  --gold-light: #ffd9a8;
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--cream);
  font-family: 'Poppins', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* No vignette. The comparison page had none, and a rose glow behind the
   canvas tints every design that does not paint its own background. */

#stage { position: fixed; inset: 0; z-index: 1; display: block; touch-action: none; }

/* ---------------- overlay text ---------------- */
.overlay-ui {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: clamp(2.5rem, 12vh, 7rem);
  text-align: center;
}
.tagline {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: clamp(1.05rem, 3.4vw, 1.6rem);
  color: rgba(253, 246, 236, 0.85);
  opacity: 0; transform: translateY(12px);
  transition: opacity 1.1s ease, transform 1.1s ease;
  text-shadow: 0 0 30px rgba(255, 45, 111, 0.4);
  max-width: 88vw;
}
.tagline.show { opacity: 1; transform: none; }
.hint {
  margin-top: 1.4rem;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(253, 246, 236, 0.32);
  opacity: 0; transition: opacity 1.2s ease 0.4s;
}
.hint.show { opacity: 1; }

/* ---------------- customise button ---------------- */
.edit-fab {
  position: fixed; top: 1rem; right: 1rem; z-index: 60;
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: rgba(12, 6, 10, 0.6); backdrop-filter: blur(10px);
  border: 1px solid rgba(253, 246, 236, 0.18); border-radius: 50px;
  color: var(--cream); font-family: 'Poppins', sans-serif; font-size: 0.82rem;
  padding: 0.55rem 1.1rem; cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  animation: editPulse 2.8s ease-in-out infinite;
}
.edit-fab[hidden] { display: none; }
.edit-fab:hover { background: rgba(255, 45, 111, 0.45); transform: translateY(-1px); }
.edit-fab__ico { color: var(--gold-light); }
@keyframes editPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 45, 111, 0); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 45, 111, 0.10); }
}

/* ---------------- design switcher ----------------
   The comparison page's bar, kept as it was: pill row along the bottom,
   scrolls sideways on a phone, wraps on a desktop. */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(8, 4, 10, 0), rgba(8, 4, 10, 0.92) 45%);
  display: flex; flex-direction: column; gap: 9px; align-items: center;
}
.bar[hidden] { display: none; }
.opts { display: flex; gap: 7px; overflow-x: auto; max-width: 100%; padding: 3px; scrollbar-width: none; }
.opts::-webkit-scrollbar { display: none; }
@media (min-width: 761px) { .opts { flex-wrap: wrap; justify-content: center; max-width: 1000px; overflow: visible; } }
.opt {
  flex: none; min-height: 44px; padding: 0 15px; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(244, 235, 224, 0.22); border-radius: 999px;
  background: rgba(12, 6, 16, 0.85); color: #c9b8d6;
  font-family: 'Poppins', sans-serif; font-size: 12.5px; letter-spacing: 0.04em;
  cursor: pointer; white-space: nowrap; transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.opt:hover { color: #fff; border-color: rgba(255, 90, 140, 0.55); }
.opt.on { background: #f4ebe0; color: #1b0d14; border-color: #f4ebe0; font-weight: 500; }
.opt b { font-weight: 600; opacity: 0.5; }
.note { font-size: 12px; color: #b6a4c6; text-align: center; max-width: 48ch; line-height: 1.5; }
.note strong { color: #ff8fb0; font-weight: 500; }
/* her message sits at the bottom too — lift it clear of the bar */
body.has-bar .overlay-ui { padding-bottom: clamp(11rem, 26vh, 15rem); }
body.on-light .note { color: #6b4a5c; }
body.on-light .bar { background: linear-gradient(180deg, rgba(246, 238, 240, 0), rgba(246, 238, 240, 0.92) 45%); }

/* ---------------- editor ---------------- */
.ed-screen {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% -10%, #2a0f1a 0%, #140b11 60%, #0c070a 100%);
}
.ed-screen[hidden] { display: none; }
.ed-wrap { max-width: 640px; margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) clamp(1.1rem, 5vw, 2rem) 5rem; }
.ed-head { text-align: center; margin-bottom: 2.2rem; }
.ed-kicker { font-size: 0.7rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold-light); margin-bottom: 0.9rem; }
.ed-title { font-family: 'Playfair Display', serif; font-weight: 600; font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1.06; color: var(--cream); }
.ed-sub { margin: 1rem auto 0; max-width: 32rem; font-size: 0.95rem; line-height: 1.7; font-weight: 300; color: rgba(253, 246, 236, 0.6); }

.ed-card {
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(253, 246, 236, 0.08);
  border-radius: 18px; padding: clamp(1.2rem, 4vw, 1.8rem); margin-bottom: 1.4rem;
}
.ed-field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.1rem; }
.ed-field > span { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(253, 246, 236, 0.5); }
.ed-field input {
  width: 100%; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(253, 246, 236, 0.12);
  border-radius: 10px; color: var(--cream); font-family: 'Poppins', sans-serif; font-size: 0.95rem;
  padding: 0.7rem 0.85rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.ed-field input:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(255, 45, 111, 0.18); }
.ed-field input::placeholder { color: rgba(253, 246, 236, 0.3); }

.ed-flabel { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(253, 246, 236, 0.5); margin-bottom: 0.7rem; }
.ed-themes { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.ed-theme { width: 42px; height: 42px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; opacity: 0.7; transition: opacity 0.2s, transform 0.2s, border-color 0.2s; }
.ed-theme:hover { opacity: 1; transform: translateY(-2px); }
.ed-theme.sel { opacity: 1; border-color: var(--cream); }

/* ---------------- design picker ---------------- */
.ed-flabel--gap { margin-top: 1.6rem; }
.ed-styles {
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}
.ed-style {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.3rem 0.5rem; cursor: pointer;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(253, 246, 236, 0.1); border-radius: 12px;
  color: rgba(253, 246, 236, 0.6);
  font-family: 'Poppins', sans-serif; font-size: 0.72rem; letter-spacing: 0.02em;
  transition: border-color 0.2s, color 0.2s, transform 0.2s, background 0.2s;
}
.ed-style:hover { color: var(--cream); border-color: rgba(255, 45, 111, 0.5); transform: translateY(-2px); }
.ed-style.sel { border-color: var(--cream); color: var(--cream); background: rgba(255, 255, 255, 0.07); }
.ed-style__img {
  width: 100%; height: auto; aspect-ratio: 1; display: block; border-radius: 8px;
  background: #0b0509; pointer-events: none;
}
.ed-style.sel .ed-style__img { box-shadow: 0 0 0 1px rgba(253, 246, 236, 0.28); }
.ed-hint { margin-top: 0.75rem; font-size: 0.76rem; color: rgba(253, 246, 236, 0.38); }

/* Ink floods the canvas with a pale wash, so cream overlay text vanishes */
body.on-light .tagline { color: rgba(46, 10, 26, 0.9); text-shadow: 0 0 26px rgba(255, 255, 255, 0.65); }
body.on-light .hint { color: rgba(46, 10, 26, 0.5); }

.ed-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-top: 1.6rem; }
.ed-btn { font-family: 'Poppins', sans-serif; font-size: 0.95rem; font-weight: 500; border-radius: 50px; padding: 0.85rem 1.8rem; cursor: pointer; border: none; transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s; }
.ed-btn--solid { background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%); color: var(--cream); box-shadow: 0 8px 26px rgba(255, 45, 111, 0.32); }
.ed-btn--solid:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(255, 45, 111, 0.42); }
.ed-btn--ghost { background: transparent; color: var(--cream); border: 1px solid rgba(253, 246, 236, 0.2); }
.ed-btn--ghost:hover { background: rgba(255, 255, 255, 0.06); }
.ed-foot { margin-top: 2rem; text-align: center; font-size: 0.8rem; color: rgba(253, 246, 236, 0.35); }
.ed-foot a { color: var(--gold-light); text-decoration: none; }
.ed-foot a:hover { text-decoration: underline; }

/* ---------------- share modal ---------------- */
.ed-share { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.ed-share[hidden] { display: none; }
.ed-share-backdrop { position: absolute; inset: 0; background: rgba(8, 4, 7, 0.72); backdrop-filter: blur(4px); }
.ed-share-box { position: relative; z-index: 1; width: 100%; max-width: 30rem; background: linear-gradient(180deg, #241019 0%, #1a0d13 100%); border: 1px solid rgba(253, 246, 236, 0.1); border-radius: 20px; padding: 2rem 1.6rem 1.8rem; text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.ed-share-x { position: absolute; top: 0.8rem; right: 0.9rem; background: none; border: none; color: rgba(253, 246, 236, 0.5); font-size: 1rem; cursor: pointer; }
.ed-share-box h3 { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--cream); margin-bottom: 0.5rem; }
.ed-share-box > p { font-size: 0.88rem; color: rgba(253, 246, 236, 0.6); line-height: 1.6; margin-bottom: 1.2rem; }
.ed-share-row { display: flex; gap: 0.5rem; }
.ed-share-link { flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(253, 246, 236, 0.12); border-radius: 10px; color: var(--gold-light); font-family: ui-monospace, monospace; font-size: 0.8rem; padding: 0.7rem 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-share-open { display: inline-block; margin-top: 1rem; color: var(--rose); font-size: 0.85rem; text-decoration: none; }
.ed-share-open:hover { text-decoration: underline; }
.ed-share-note { margin: 0.9rem 0 0; font-size: 0.75rem; color: rgba(253, 246, 236, 0.4); }

/* ---------------------------------------------------------------------------
   prefers-reduced-motion
   The heart itself is the gift, so it still plays. What goes is everything
   that loops for decoration: the pulsing "customise" button, the UI fades,
   and (in app.js) the heartbeat's scale pulse.
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}


/* ---------------- a link that arrived broken ----------------
   Messaging apps shorten long links, and a shortened one can't be decoded.
   This used to fall through to the sample gift, so she was shown something
   addressed to a placeholder name and had no way to know. Say what happened
   instead. */
.broken {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 28px; background: var(--bg);
}
.broken[hidden] { display: none; }
.broken div { max-width: 30em; }
.broken h2 {
  font-family: 'Playfair Display', serif; font-weight: 400; color: var(--cream);
  font-size: clamp(21px, 5vw, 29px); margin: 0 0 12px; line-height: 1.25;
}
.broken p { color: rgba(253,246,236,.62); font-size: 15px; line-height: 1.7; margin: 0; }
