/* Main website: landing page, creator, and status pages.
   Shares its palette and type with the constellation theme. */

:root {
  --night-950: #030814;
  --night-900: #071326;
  --night-800: #0d2140;
  --night-700: #16345c;
  --ivory: #fff7e5;
  --ivory-soft: #e9e2d4;
  --muted: #aebbd0;
  --gold: #f2c970;
  --gold-bright: #ffe4a1;
  --coral: #f49a86;
  --lavender: #aea7ff;
  --danger: #ff9b8f;
  --glass: rgba(13, 33, 64, 0.58);
  --glass-strong: rgba(8, 24, 48, 0.88);
  --line: rgba(255, 247, 229, 0.14);
  --line-strong: rgba(255, 247, 229, 0.24);
  --field: rgba(3, 8, 20, 0.55);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --serif: Iowan Old Style, Baskerville, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --gutter: clamp(1rem, 4vw, 2rem);
  --device-width: 410px;
  --device-height: 820px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--night-950);
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(27, 61, 105, 0.72), transparent 42rem),
    linear-gradient(175deg, var(--night-800), var(--night-950) 48rem);
  background-color: var(--night-950);
  color: var(--ivory);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
}

/* ---------- Ambient sky ---------- */

.sky {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 14% 92%, rgba(244, 154, 134, 0.12), transparent 40%),
    radial-gradient(ellipse at 86% 6%, rgba(174, 167, 255, 0.12), transparent 36%),
    radial-gradient(ellipse at 50% 112%, rgba(44, 121, 170, 0.2), transparent 52%);
}

.sky::before,
.sky::after {
  position: absolute;
  inset: 0;
  content: "";
}

.sky::before {
  opacity: 0.75;
  background-image:
    radial-gradient(1.3px 1.3px at 24px 38px, rgba(255, 242, 202, 0.95), transparent 70%),
    radial-gradient(1px 1px at 142px 92px, rgba(255, 242, 202, 0.7), transparent 70%),
    radial-gradient(1.5px 1.5px at 214px 186px, rgba(255, 242, 202, 0.85), transparent 70%),
    radial-gradient(1px 1px at 78px 222px, rgba(255, 242, 202, 0.55), transparent 70%),
    radial-gradient(1.1px 1.1px at 282px 44px, rgba(255, 242, 202, 0.65), transparent 70%);
  background-size: 307px 263px;
}

.sky::after {
  background-image:
    radial-gradient(1.6px 1.6px at 60px 120px, rgba(255, 228, 161, 0.95), transparent 70%),
    radial-gradient(1.2px 1.2px at 330px 60px, rgba(255, 242, 202, 0.8), transparent 70%),
    radial-gradient(1px 1px at 190px 310px, rgba(255, 242, 202, 0.7), transparent 70%),
    radial-gradient(1.4px 1.4px at 380px 260px, rgba(174, 167, 255, 0.8), transparent 70%);
  background-size: 419px 383px;
  animation: twinkle 5s ease-in-out infinite alternate;
}

/* ---------- Header ---------- */

.skip-link {
  position: absolute;
  z-index: 200;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--gold);
  color: #352508;
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: calc(1rem + env(safe-area-inset-top)) var(--gutter) 1rem;
}

.brand {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  min-height: 44px;
  color: var(--ivory);
  font-weight: 760;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand__mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #173f70, var(--night-900));
  color: var(--gold);
  box-shadow: 0 0 18px rgba(242, 201, 112, 0.32);
}

.site-header__link {
  color: var(--ivory-soft);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration-color: rgba(255, 247, 229, 0.3);
  text-underline-offset: 0.25rem;
}

/* ---------- Shared pieces ---------- */

.eyebrow {
  margin: 0 0 1rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  line-height: 1.5;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-wrap: balance;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.button {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.3rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 780;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.button--primary {
  background: linear-gradient(125deg, var(--gold-bright), var(--gold));
  color: #352508;
  box-shadow: 0 12px 34px rgba(242, 201, 112, 0.22);
}

.button--secondary {
  border-color: var(--line-strong);
  background: rgba(8, 24, 48, 0.62);
  color: var(--ivory);
}

.button--ghost {
  background: transparent;
  color: var(--ivory-soft);
  text-decoration: underline;
  text-decoration-color: rgba(255, 247, 229, 0.3);
  text-underline-offset: 0.25rem;
}

.button--danger {
  border-color: rgba(255, 155, 143, 0.45);
  background: transparent;
  color: var(--danger);
}

.button--large {
  min-height: 56px;
  padding: 0.95rem 1.8rem;
  font-size: 1rem;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0) scale(0.98);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.9rem;
  background: rgba(8, 24, 48, 0.78);
  color: var(--ivory-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.notice--error {
  border-color: rgba(255, 155, 143, 0.5);
  background: rgba(80, 22, 30, 0.5);
  color: #ffd8d2;
}

/* ---------- Hero ---------- */

.hero {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: clamp(2.25rem, 8vw, 5.5rem) var(--gutter) clamp(2.5rem, 6vw, 4.5rem);
  text-align: center;
}

.hero__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.45rem, 7.2vw, 5.4rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}

.hero__title em {
  color: var(--gold-bright);
}

.hero__lede {
  max-width: 610px;
  margin: 1.5rem auto 2rem;
  color: var(--ivory-soft);
  font-size: clamp(1.02rem, 2.4vw, 1.2rem);
  line-height: 1.7;
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.hero__points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: center;
  margin: 1.75rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  list-style: none;
}

.hero__points li::before {
  margin-right: 0.45rem;
  color: var(--gold);
  font-size: 0.75em;
  content: "✦";
}

/* ---------- Saved surprises ---------- */

.saved {
  width: min(100%, 1180px);
  margin: 0 auto 2.5rem;
  padding: 0 var(--gutter);
}

.saved__title {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.saved__list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saved__item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--glass);
}

.saved__name {
  display: block;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.saved__meta {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.saved__links {
  display: flex;
  gap: 1.1rem;
}

.saved__links a {
  display: inline-block;
  padding: 0.35rem 0;
  color: var(--gold-bright);
  font-size: 0.9rem;
  font-weight: 700;
  text-underline-offset: 0.25rem;
}

/* ---------- Creator ---------- */

.creator {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 8vw, 5rem);
}

.creator__intro {
  margin-bottom: 1.5rem;
}

.creator__intro .eyebrow {
  margin-bottom: 0.4rem;
}

.creator__layout {
  display: grid;
  gap: 2rem;
  align-items: start;
}

.creator__form {
  min-width: 0;
}

.creator__form.is-loading .creator__steps {
  opacity: 0.45;
  pointer-events: none;
}

.step {
  min-width: 0;
  margin: 0 0 1rem;
  padding: clamp(1.15rem, 3vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.step__title {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0 0 1.1rem;
  padding: 0;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

/* Floating the legend lets it sit inside the card instead of on its border. */
fieldset.step > legend.step__title {
  float: left;
  width: 100%;
}

fieldset.step > legend.step__title + * {
  clear: both;
}

.step__number {
  display: inline-grid;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid rgba(242, 201, 112, 0.45);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0;
}

.step__hint {
  margin: -0.2rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.step--optional summary {
  margin: 0;
  cursor: pointer;
  list-style: none;
}

.step--optional summary::-webkit-details-marker {
  display: none;
}

.step--optional summary::after {
  flex: 0 0 auto;
  width: 0.6rem;
  height: 0.6rem;
  margin: 0 0.35rem 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  transform: rotate(45deg) translateY(-25%);
  transition: transform 200ms ease;
}

.step--optional[open] summary::after {
  transform: rotate(-135deg);
}

.step--optional[open] summary {
  margin-bottom: 1.25rem;
}

.step__aside {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  margin: 0 0 1.1rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field__label {
  color: var(--ivory-soft);
  font-size: 0.87rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.field__label--small {
  color: var(--muted);
  font-size: 0.76rem;
}

.field__input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0.72rem 0.95rem;
  border: 1px solid rgba(255, 247, 229, 0.2);
  border-radius: 0.9rem;
  background: var(--field);
  color: var(--ivory);
  font-size: 1rem;
  line-height: 1.4;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.field__input::placeholder {
  color: rgba(174, 187, 208, 0.6);
  opacity: 1;
}

.field__input:hover {
  border-color: rgba(255, 247, 229, 0.32);
}

.field__input:focus {
  border-color: var(--gold);
  outline: none;
  background: rgba(3, 8, 20, 0.72);
  box-shadow: 0 0 0 3px rgba(242, 201, 112, 0.25);
}

.field__input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 155, 143, 0.16);
}

.field__input--area {
  min-height: 170px;
  line-height: 1.6;
  resize: vertical;
}

.field__input--compact {
  min-height: 44px;
  padding: 0.55rem 0.8rem;
}

.field__input[readonly] {
  color: var(--ivory-soft);
}

input[type="date"].field__input {
  min-height: 48px;
}

.field__error {
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.45;
}

.field__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.field-row {
  display: grid;
  gap: 0 1rem;
}

.field-row .field:last-child {
  margin-bottom: 1.1rem;
}

.choice {
  min-width: 0;
  margin: 0 0 1.4rem;
  padding: 0;
  border: 0;
}

.choice legend {
  margin-bottom: 0.5rem;
  padding: 0;
}

.choice__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice__option {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1.05rem;
  border: 1px solid rgba(255, 247, 229, 0.2);
  border-radius: 999px;
  background: rgba(3, 8, 20, 0.45);
  font-weight: 650;
  cursor: pointer;
}

.choice__option input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--gold);
}

.choice__option:has(input:checked) {
  border-color: var(--gold);
  background: rgba(242, 201, 112, 0.12);
  color: var(--gold-bright);
}

.choice__option:has(input:focus-visible) {
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
}

/* Memory slots */

.memories {
  display: grid;
  gap: 1.1rem;
  margin: 0 0 0.25rem;
  padding: 0;
  list-style: none;
}

.memory-slot {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.memory-slot__fields {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.field--compact {
  gap: 0.3rem;
  margin: 0;
}

.photo {
  position: relative;
  aspect-ratio: 1;
}

.photo__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.photo__target {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  place-items: center;
  border: 1.5px dashed rgba(242, 201, 112, 0.45);
  border-radius: 1.1rem;
  background: rgba(3, 8, 20, 0.45);
  color: var(--gold-bright);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.photo__target:hover {
  border-color: var(--gold);
  background: rgba(242, 201, 112, 0.08);
}

.photo__input:focus-visible + .photo__target {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
}

.photo.is-dragover .photo__target {
  border-color: var(--gold-bright);
  background: rgba(242, 201, 112, 0.16);
  transform: scale(1.03);
}

.photo.is-filled .photo__target {
  border-style: solid;
  border-color: var(--line-strong);
}

.photo.is-invalid .photo__target {
  border-color: var(--danger);
}

.photo__empty {
  display: grid;
  gap: 0.15rem;
  justify-items: center;
  padding: 0.5rem;
  text-align: center;
}

.photo__plus {
  font-size: 1.7rem;
  line-height: 1;
}

.photo__label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.photo__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hint that clicking a chosen photo swaps it. */
.photo__change {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  padding: 0.3rem 0;
  background: linear-gradient(to top, rgba(3, 8, 20, 0.85), rgba(3, 8, 20, 0));
  color: var(--ivory);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.photo.is-filled .photo__target:hover .photo__change,
.photo.is-filled .photo__input:focus-visible + .photo__target .photo__change {
  display: block;
}

.photo__busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 20, 0.62);
}

.photo__busy::after {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255, 228, 161, 0.3);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  content: "";
  animation: spin 800ms linear infinite;
}

.photo__remove {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--night-900);
  color: var(--ivory);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

/* A larger invisible touch target around the small remove button. */
.photo__remove::before {
  position: absolute;
  inset: -6px;
  content: "";
}

.photo__remove:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Submit */

.submit {
  padding: 0.5rem 0 0;
}

.submit__privacy {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.submit__turnstile {
  margin-bottom: 1rem;
}

.submit__turnstile:empty {
  display: none;
}

.submit__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Live preview ---------- */

.preview {
  display: none;
}

.preview__bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.preview__label {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.preview__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7ee2a8;
  box-shadow: 0 0 10px rgba(126, 226, 168, 0.8);
  animation: pulse 2.2s ease-in-out infinite;
}

.preview__close {
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(8, 24, 48, 0.8);
  color: var(--ivory);
  font-size: 0.85rem;
  font-weight: 750;
  cursor: pointer;
}

.preview__stage {
  width: calc(var(--device-width) * var(--preview-scale, 1));
  height: calc(var(--device-height) * var(--preview-scale, 1));
}

.preview__device {
  width: var(--device-width);
  height: var(--device-height);
  padding: 10px;
  border: 1px solid rgba(255, 247, 229, 0.18);
  border-radius: 46px;
  background: linear-gradient(160deg, #10284a, #050c1c);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 70px rgba(242, 201, 112, 0.07);
  transform: scale(var(--preview-scale, 1));
  transform-origin: top left;
}

.preview__device iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 36px;
  background: var(--night-950);
}

.preview__hint {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.preview-toggle {
  position: fixed;
  z-index: 50;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 52px;
  padding: 0 1.3rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(125deg, var(--gold-bright), var(--gold));
  color: #352508;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45), 0 0 24px rgba(242, 201, 112, 0.25);
  cursor: pointer;
  transition:
    opacity 200ms ease,
    transform 200ms ease,
    visibility 200ms;
}

/* Only offered while the form is on screen. */
.preview-toggle.is-offscreen {
  visibility: hidden;
  opacity: 0;
  transform: translateY(1rem);
}

@media (min-width: 1024px) {
  .creator__layout {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(2rem, 4vw, 3.5rem);
  }

  .preview {
    position: sticky;
    top: 1.25rem;
    display: block;
  }

  .preview__close,
  .preview-toggle {
    display: none;
  }
}

@media (max-width: 1023.98px) {
  .creator {
    padding-bottom: 6.5rem;
  }

  .preview.is-open {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: calc(0.75rem + env(safe-area-inset-top)) 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
    background: var(--night-950);
  }

  .preview.is-open .preview__stage {
    flex: 1;
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .preview.is-open .preview__device {
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    background: none;
    box-shadow: none;
    transform: none;
  }

  .preview.is-open .preview__device iframe {
    border-radius: 0;
  }

  .preview.is-open .preview__hint {
    display: none;
  }

  body.preview-open {
    overflow: hidden;
  }
}

/* ---------- Result ---------- */

.result {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 8vw, 5rem);
}

.result:focus {
  outline: none;
}

.result__card {
  padding: clamp(1.5rem, 5vw, 3rem);
  text-align: center;
}

.result__star {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #4b360d;
  font-size: 2rem;
  box-shadow:
    0 0 28px rgba(242, 201, 112, 0.6),
    0 0 90px rgba(242, 201, 112, 0.23);
  animation: star-heartbeat 2.8s ease-in-out infinite;
}

.result__lede {
  max-width: 520px;
  margin: 1rem auto 1.75rem;
  color: var(--ivory-soft);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.link-field {
  display: grid;
  gap: 0.45rem;
  text-align: left;
}

.link-field__row {
  display: flex;
  gap: 0.5rem;
}

.link-field__row .field__input {
  flex: 1;
}

.link-field__row .button {
  flex: 0 0 auto;
  min-width: 6.5rem;
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1rem;
}

.private-link {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px dashed rgba(242, 201, 112, 0.4);
  border-radius: var(--radius-md);
  background: rgba(242, 201, 112, 0.05);
  text-align: left;
}

.private-link__title {
  margin: 0 0 0.35rem;
  color: var(--gold-bright);
  font-size: 1rem;
}

.private-link__copy {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.result__expiry {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.result__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ---------- How it works & FAQ ---------- */

.how,
.faq {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) var(--gutter);
}

.how__steps {
  display: grid;
  gap: 1rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.how__step {
  padding: 1.5rem;
}

.how__number {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(242, 201, 112, 0.14);
  color: var(--gold-bright);
  font-weight: 800;
}

.how__step h3 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1.2;
}

.how__step p {
  margin: 0;
  color: var(--ivory-soft);
  line-height: 1.65;
}

.faq {
  width: min(100%, 880px);
}

.faq .section-title {
  margin-bottom: 1.25rem;
}

.faq__item {
  border-bottom: 1px solid var(--line);
}

.faq__item summary {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 1rem 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

.faq__item summary::after {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 1.35rem;
  line-height: 1;
  content: "+";
  transition: transform 200ms ease;
}

.faq__item[open] summary::after {
  transform: rotate(45deg);
}

.faq__item p {
  margin: 0 0 1.2rem;
  color: var(--ivory-soft);
  line-height: 1.7;
}

.site-footer {
  padding: 2rem var(--gutter) calc(2.5rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

/* Editing an existing surprise keeps the page focused on the form. */
.is-editing .hero,
.is-editing .saved,
.is-editing .how,
.is-editing .faq {
  display: none;
}

.is-editing .creator__intro {
  padding-top: clamp(1rem, 4vw, 2.5rem);
}

/* ---------- Status pages (404) ---------- */

.page-message {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--gutter);
  place-items: center;
}

.message-card {
  width: min(100%, 560px);
  padding: clamp(1.75rem, 6vw, 3rem);
  text-align: center;
}

.message-card h1 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.message-card p:not(.eyebrow) {
  margin: 0 auto 1.75rem;
  color: var(--ivory-soft);
  line-height: 1.7;
}

/* ---------- Utilities ---------- */

.is-hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

@media (min-width: 560px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 820px) {
  .how__steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .submit__actions .button {
    width: 100%;
  }

  .link-field__row {
    flex-direction: column;
  }

  .link-field__row .button,
  .result__actions .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .memory-slot {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 0.8rem;
  }

  .site-header__link {
    font-size: 0.85rem;
  }
}

@keyframes twinkle {
  from { opacity: 0.3; }
  to { opacity: 0.95; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes star-heartbeat {
  0%, 100% { transform: scale(0.96); }
  50% { transform: scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
