/* =====================================================================
   POSTCARD SIGNUP · STYLES
   Layout idea: a fixed 16:9 "stage" (the stationery room) scales as one
   piece on desktop. Every size inside is in em, and the stage's font-size
   is 1/90th of its width, so the whole scene zooms together.
   On phones / portrait screens the stage turns into a normal scrolling
   column (see "SMALL SCREENS" at the bottom).
   ===================================================================== */

:root {
  color-scheme: light;

  /* Palette (sampled from the artwork) */
  --ink: #4a3266;          /* deep plum: main text */
  --ink-soft: #7a6390;     /* labels, hints */
  --lav: #b39cdd;          /* lavender lines */
  --lav-deep: #7159b5;     /* focus, links */
  --gold: #e2a62d;
  --gold-soft: #f3c466;
  --peach: #f2b98f;
  --paper: #fff6e6;
  --paper-glow: rgba(255, 251, 242, .72);
  --wood: #9a6328;
  --berry: #b03a5b;        /* errors */
  --wall: #f1dcbc;         /* page colour behind the scene */

  /* Type */
  --font-ui: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Patrick Hand", "Comic Neue", "Segoe Print", cursive;

  /* Sizes used by the stage layout */
  --stage-w: min(100vw, calc(100vh * 16 / 9));
  --card-w: 46em;
  --prompt-w: 40em;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@supports (height: 100dvh) {
  :root { --stage-w: min(100vw, calc(100dvh * 16 / 9)); }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }

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

/* ---------------------------------------------------------------------
   STAGE
   --------------------------------------------------------------------- */
.backdrop {
  position: fixed; inset: -60px;
  background: var(--wall) url("../assets/room-tiny.webp") center / cover no-repeat;
  filter: blur(28px) saturate(1.05);
}
.stage {
  position: absolute; left: 50%; top: 50%;
  width: var(--stage-w);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  font-size: calc(var(--stage-w) / 90);
  background: var(--wall) url("../assets/room.webp") center / cover no-repeat;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(111, 69, 31, .25);
}
.scene-fg {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: url("../assets/foreground.webp") center / 100% 100% no-repeat;
}
.ui {
  position: absolute; inset: 1.6em 0 1.1em; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: .7em;
}
.demo-badge {
  position: absolute; z-index: 5; top: 1em; left: 1em; margin: 0;
  padding: .35em .9em; border-radius: 99px;
  background: var(--lav-deep); color: #fff8e8;
  font-size: .85em; font-weight: 500; letter-spacing: .02em;
  box-shadow: 0 .2em .5em rgba(74, 50, 102, .3);
}

/* ---------------------------------------------------------------------
   PROGRESS (rail + stars)
   --------------------------------------------------------------------- */
.progress { width: 36em; max-width: 100%; flex: none; }
.progress__list {
  --node: 2.5em;
  position: relative; list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, 1fr);
}
.progress__list::before {           /* the rail */
  content: ""; position: absolute; z-index: 0;
  left: calc(100% / 12 - .6em); right: calc(100% / 12 - .6em);
  top: calc(var(--node) * .55 - .55em); height: 1.1em;
  background: url("../assets/06c-progress-rail.svg") center / 100% 100% no-repeat;
}
.pnode { position: relative; z-index: 1; display: flex; justify-content: center; }
.pnode__btn {
  display: flex; flex-direction: column; align-items: center; gap: .15em;
  padding: 0; border: 0; background: none; cursor: default;
  color: var(--ink-soft); border-radius: .6em;
}
.pnode__icon {
  width: var(--node); height: calc(var(--node) * 1.1);
  background: url("../assets/06d-progress-upcoming.svg") center / contain no-repeat;
  filter: drop-shadow(0 .15em .15em rgba(111, 69, 31, .25));
  transition: transform .25s var(--ease);
}
.pnode__label {
  font-size: .78em; font-weight: 500; letter-spacing: .02em;
  padding: .05em .55em; border-radius: 99px;
  background: var(--paper-glow);
}
.pnode[data-state="complete"] .pnode__icon { background-image: url("../assets/06f-progress-complete.svg"); }
.pnode[data-state="active"] .pnode__icon {
  background-image: url("../assets/06e-progress-active.svg");
  transform: scale(1.18);
}
.pnode[data-state="active"] .pnode__label { color: var(--ink); background: #fff8ea; font-weight: 600; }
.pnode[data-state="complete"] .pnode__label { color: var(--ink); }
.pnode__btn[data-jump] { cursor: pointer; }
.pnode__btn[data-jump]:hover .pnode__icon { transform: translateY(-.12em); }
.progress__caption { display: none; }

/* ---------------------------------------------------------------------
   PROMPT BOX (speech box)
   The PNG is "9-sliced": corners stay crisp, the middle stretches
   if a prompt wraps to two lines.
   --------------------------------------------------------------------- */
.prompt-box {
  --pk: calc(var(--prompt-w) / 1100);
  width: var(--prompt-w); max-width: 100%; flex: none;
  border-style: solid; border-width: 0;
  border-image-source: url("../assets/prompt-box.webp");
  border-image-slice: 142 130 68 150 fill;   /* 4px clean strip in the middle stretches */
  border-image-width: calc(142 * var(--pk)) calc(130 * var(--pk)) calc(68 * var(--pk)) calc(150 * var(--pk));
  min-height: calc(214 * var(--pk));
  padding: calc(54 * var(--pk)) calc(150 * var(--pk)) calc(66 * var(--pk)) calc(160 * var(--pk));
  display: flex; align-items: center;
}
.prompt {
  margin: 0; width: 100%;
  font-size: 1.45em; font-weight: 500; line-height: 1.2;
  color: var(--ink); text-wrap: balance;
}
.prompt:focus { outline: none; }

/* ---------------------------------------------------------------------
   CARD AREA
   --------------------------------------------------------------------- */
.card-area {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.signup { display: contents; }
.signup__fields { border: 0; margin: 0; padding: 0; min-width: 0; display: contents; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.shell { width: var(--card-w); max-width: 100%; }

/* Envelope paper (address, postcard, error screen): 9-sliced */
.paper {
  --k: calc(var(--card-w) / 1504);
  position: relative;
  border-style: solid; border-width: 0;
  border-image-source: url("../assets/envelope-paper.webp");
  border-image-slice: 110 120 125 120 fill;
  border-image-width: calc(110 * var(--k)) calc(120 * var(--k)) calc(125 * var(--k)) calc(120 * var(--k));
  min-height: calc(688 * var(--k));
  padding: calc(88 * var(--k)) calc(140 * var(--k)) calc(135 * var(--k));
  filter: drop-shadow(0 .5em .7em rgba(111, 69, 31, .28));
}
.paper__stamp {
  position: absolute; right: calc(60 * var(--k)); top: calc(48 * var(--k));
  width: calc(430 * var(--k)); height: auto; pointer-events: none;
}

/* Envelope front (name) keeps its exact proportions */
.envelope-front {
  position: relative; aspect-ratio: 1573 / 716; width: 100%;
  background: url("../assets/envelope-front.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 .5em .7em rgba(111, 69, 31, .28));
}
.envelope-front__content {
  position: absolute; left: 21%; right: 21%; top: 56%; bottom: 17%;
  display: flex; flex-direction: column; justify-content: center; gap: .2em;
}
.shell--front > .field-hint,
.shell--front > .field-error { text-align: center; margin-inline: auto; max-width: 34em; }
.shell--front > .field-hint {
  margin-top: .6em; width: fit-content; padding: .2em .8em; border-radius: 99px;
  background: var(--paper-glow);
}

/* ---------------------------------------------------------------------
   FIELDS
   --------------------------------------------------------------------- */
.field-label {
  display: block;
  font-size: .82em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft);
}
.opt {
  font-weight: 500; text-transform: none; letter-spacing: .01em;
  color: #9c86b8; font-size: .92em;
}
.opt::before { content: "· "; }

.ink-input {
  display: block; width: 100%;
  border: 0; border-bottom: .16em solid var(--lav);
  border-radius: .25em .25em 0 0;
  background: transparent;
  padding: .05em .3em .02em;
  font-family: var(--font-hand); font-size: 1.55em; line-height: 1.25;
  color: var(--ink);
  transition: border-color .2s, background-color .2s;
}
.ink-input::placeholder { color: #b5a3c9; opacity: 1; }
.ink-input:hover { background: rgba(255, 255, 255, .35); }
.ink-input:focus {
  outline: none; border-bottom-color: var(--gold);
  background: rgba(255, 255, 255, .6);
  box-shadow: 0 .18em 0 -.02em rgba(226, 166, 45, .35);
}
.ink-input[aria-invalid="true"] { border-bottom-color: var(--berry); }

.field-hint { margin: .3em 0 0; font-size: .85em; color: var(--ink-soft); }
.field-error {
  margin: .25em 0 0; font-size: .85em; font-weight: 500; color: var(--berry);
  min-height: 0;
}
.field-error:empty { display: none; }
.field-error::before {
  content: "!"; display: inline-grid; place-items: center;
  width: 1.15em; height: 1.15em; margin-right: .35em; border-radius: 50%;
  background: var(--berry); color: #fff; font-size: .8em; font-weight: 600;
  vertical-align: .1em;
}

/* Address grid (envelope back) */
.address-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .55em 1.2em;
  width: calc(100% - 14em);
}
.field--wide { grid-column: 1 / -1; }
.address-grid .ink-input { font-size: 1.35em; }
.address-grid .field-label { font-size: .74em; }
.field-hint--paper { margin-top: .7em; }

/* Handle inputs (u/ and @) */
.handle { display: flex; align-items: flex-end; gap: .1em; margin-top: .25em; }
.handle__prefix {
  font-family: var(--font-hand); font-size: 1.7em; line-height: 1.25;
  color: var(--lav-deep); padding-bottom: .08em;
}
.handle .ink-input { font-size: 1.7em; }

/* Lined note (from the answer field kit) */
.note {
  position: relative; margin-top: .35em;
  border: .14em solid #b392dc; border-top: .22em solid var(--gold);
  background:
    linear-gradient(transparent calc(1.6em - 1px), rgba(179, 156, 221, .55) calc(1.6em - 1px), rgba(179, 156, 221, .55) 1.6em, transparent 1.6em) 0 .35em / 100% 1.6em,
    linear-gradient(#fffbf0, #fdeedb);
  box-shadow: 0 .2em 0 rgba(111, 69, 31, .08);
}
.note::after {                      /* folded pink corner */
  content: ""; position: absolute; top: -.22em; right: -.14em;
  width: 2.2em; height: 2.2em;
  background: linear-gradient(225deg, transparent 50%, #f6d3dc 50%, #f8dde3 70%, #f6d3dc 100%);
  clip-path: polygon(0 0, 100% 100%, 100% 0);
  box-shadow: inset 0 0 0 1px rgba(226, 150, 160, .5);
  pointer-events: none;
}
.note::before {                     /* pencil */
  content: ""; position: absolute; right: .3em; bottom: .3em;
  width: 1.5em; height: 1.45em; opacity: .9; pointer-events: none;
  background: url("../assets/pencil.webp") center / contain no-repeat;
}
.note__input {
  display: block; width: 100%; resize: none; border: 0; background: transparent;
  padding: .35em 2.4em .35em .7em;
  font-family: var(--font-hand); font-size: 1.32em; line-height: 1.212em; /* matches the 1.6em ruled lines */
  color: var(--ink); height: calc(4 * 1.212em + .7em);
}
.note__input::placeholder { color: #b5a3c9; opacity: 1; }
.note__input:focus { outline: none; }
.note:focus-within { border-color: var(--lav-deep); box-shadow: 0 0 0 .2em rgba(113, 89, 181, .2); }
.note[data-invalid="true"] { border-color: var(--berry); }
.note__meta { display: flex; justify-content: space-between; gap: 1em; align-items: baseline; }
.note__count { margin: .3em 0 0; font-size: .78em; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------------
   POSTCARD LAYOUT
   --------------------------------------------------------------------- */
.postcard {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.6em; min-height: 100%;
}
.postcard__message { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.postcard__address {
  position: relative; min-width: 0;
  padding-left: 1.4em;
  border-left: .14em dashed rgba(179, 156, 221, .9);
  display: flex; flex-direction: column;
}
.postcard__stamp { align-self: flex-end; width: 9.5em; height: auto; margin: -.6em -.6em .2em 0; }
.addr-lines {
  font-style: normal; font-family: var(--font-hand); font-size: 1.15em; line-height: 1.5;
  color: var(--ink); margin-top: auto;
}
.addr-lines span {
  display: block; min-height: 1.5em; padding-inline: .2em;
  border-bottom: .12em solid rgba(179, 156, 221, .85);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.addr-lines span.is-empty { color: transparent; }
.postcard__edit-addr { align-self: flex-end; margin-top: .4em; }

/* Review list */
.review { margin: 0; display: grid; gap: .45em; }
.review__row {
  display: grid; grid-template-columns: 6.6em minmax(0, 1fr) auto; gap: .2em .8em;
  align-items: baseline; padding-bottom: .4em;
  border-bottom: .1em dashed rgba(179, 156, 221, .7);
}
.review dt { font-size: .76em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.review dd { margin: 0; min-width: 0; font-family: var(--font-hand); font-size: 1.25em; line-height: 1.25; overflow-wrap: anywhere; }
.review dd.is-none { font-family: var(--font-ui); font-size: .9em; color: #9c86b8; font-style: italic; }
.review__topic { max-height: 3.9em; overflow-y: auto; white-space: pre-wrap; }
.review__topic:focus-visible { outline: .14em solid var(--lav-deep); outline-offset: .15em; border-radius: .2em; }
.review dd.review__edit { font-family: var(--font-ui); font-size: 1em; }

.text-btn {
  border: 0; background: none; padding: .15em .45em; border-radius: .5em; cursor: pointer;
  font-size: .82em; font-weight: 600; color: var(--lav-deep);
  text-decoration: underline; text-decoration-thickness: .1em; text-underline-offset: .2em;
}
.text-btn:hover { background: rgba(179, 156, 221, .2); }

/* ---------------------------------------------------------------------
   BUTTONS (SVG artwork + live text)
   --------------------------------------------------------------------- */
.nav { display: flex; gap: 1.6em; align-items: center; justify-content: center; flex: none; }
.btn {
  position: relative; border: 0; padding: 0; cursor: pointer;
  background: center / 100% 100% no-repeat;
  display: flex; align-items: center;
  font-family: var(--font-ui); font-weight: 600; color: var(--ink);
  filter: drop-shadow(0 .32em .25em rgba(111, 69, 31, .3));
  transition: transform .18s var(--ease), filter .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn--next {
  background-image: url("../assets/06a-primary-next-button.svg");
  width: 15em; aspect-ratio: 300 / 104;
  padding: 0 5.2em .5em 2.1em;
}
.btn--back {
  background-image: url("../assets/06b-secondary-back-button.svg");
  width: 12.5em; aspect-ratio: 250 / 92;
  padding: 0 1.4em .55em 3.6em;
}
.btn__label {
  flex: 1; text-align: center; font-size: 1.22em; line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn:hover { transform: translateY(-.12em); filter: drop-shadow(0 .45em .3em rgba(111, 69, 31, .3)) brightness(1.03); }
.btn:active { transform: translateY(.1em); filter: drop-shadow(0 .15em .15em rgba(111, 69, 31, .3)); }
.btn:focus-visible, .text-btn:focus-visible, .pnode__btn:focus-visible {
  outline: .18em solid var(--lav-deep); outline-offset: .18em;
}
.btn:focus-visible { border-radius: 99px; outline-offset: -.05em; }
.btn.is-invisible { visibility: hidden; }
.btn[aria-disabled="true"] { cursor: progress; transform: none; }
.btn.is-loading .btn__label::before {
  content: "✦"; display: inline-block; margin-right: .35em; color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.signup.is-sending .shell { opacity: .78; transition: opacity .3s; }

.privacy {
  margin: 0; flex: none; max-width: 38em; text-align: center;
  font-size: .8em; line-height: 1.35; color: var(--ink);
  padding: .35em 1em; border-radius: 99px;
  background: rgba(255, 249, 236, .82);
  box-shadow: 0 .1em .4em rgba(111, 69, 31, .12);
}

/* ---------------------------------------------------------------------
   SCREENS (error / success / closed)
   --------------------------------------------------------------------- */
.screen { width: var(--card-w); max-width: 100%; }
.screen__heading { margin: 0; font-size: 1.6em; font-weight: 600; line-height: 1.15; text-wrap: balance; color: var(--ink); }
.screen__heading:focus { outline: none; }
.screen__text { margin: .45em 0 0; font-size: 1.05em; line-height: 1.45; color: var(--ink); max-width: 36em; }
.screen__actions { display: flex; gap: 1.2em; justify-content: center; flex-wrap: wrap; margin-top: 1em; }

.screen--error .screen__body { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.screen--error .screen__heading, .screen--error .screen__text { max-width: calc(100% - 13em); }
.screen--error .screen__actions { justify-content: flex-start; margin-top: 1.4em; }
.screen--error .btn--back { width: 15em; }

/* Confirmation frame: 9-sliced from the confirmation panel */
.frame {
  --fk: calc(var(--card-w) / 1026);
  border-style: solid; border-width: 0;
  border-image-source: url("../assets/confirm-frame.webp");
  border-image-slice: 80 80 80 80 fill;
  border-image-width: calc(80 * var(--fk));
  padding: calc(52 * var(--fk)) calc(72 * var(--fk)) calc(76 * var(--fk));
  text-align: center;
}
.frame__art { display: block; width: 21em; height: auto; margin: 0 auto .5em; }
.success__grid {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.4em;
  text-align: left; align-items: center;
  padding-top: .8em; border-top: .14em dotted rgba(179, 156, 221, .9);
}
.exchange { display: flex; flex-direction: column; align-items: flex-start; gap: .25em; }
.exchange__card {
  width: 100%; font-style: normal;
  font-family: var(--font-hand); font-size: 1.22em; line-height: 1.4;
  padding: .55em .8em; border-radius: .4em;
  background: #fffaf0; border: .12em dashed var(--gold);
  white-space: pre-line;
}
.exchange__card strong { font-weight: 400; color: var(--lav-deep); font-size: 1.12em; }
.exchange__copy { padding-left: 0; }
.screen--success .screen__actions { margin-top: 1.1em; }
.screen--closed { min-height: 14em; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.screen--closed .screen__text { margin-inline: auto; }

/* ---------------------------------------------------------------------
   TRANSITIONS
   (JS adds these; prefers-reduced-motion turns them off)
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .fx-petals, .fx-dust { display: none; }
}

/* =====================================================================
   SMALL SCREENS: phones, portrait tablets, short landscape windows.
   The stage becomes a normal scrolling column.
   ===================================================================== */
@media (max-width: 860px), (max-height: 520px), (orientation: portrait) and (max-width: 1100px) {
  body { overflow: auto; }
  .backdrop { display: none; }
  .stage {
    position: relative; left: auto; top: auto; transform: none;
    width: 100%; min-height: 100%; aspect-ratio: auto;
    font-size: 16px;
    background-position: 50% 30%;
    background-attachment: scroll;
    box-shadow: none; overflow: visible;
    padding-block: 14px 28px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .scene-fg { display: none; }  /* foreground + ambient motion are desktop-only */
  .ui {
    position: relative; inset: auto; gap: 14px;
    container-type: inline-size;
    --card-w: min(100cqw, 600px);
    --prompt-w: min(100cqw, 600px);
  }
  .demo-badge { position: static; margin: 0 auto 10px; width: fit-content; }

  .progress { width: min(100%, 440px); }
  .progress__list { --node: 34px; }
  .progress__list::before { height: 14px; top: calc(var(--node) * .55 - 7px); }
  .pnode__label { display: none; }
  .progress__caption {
    display: block; width: fit-content; margin: 8px auto 0; padding: 2px 12px;
    border-radius: 99px; background: var(--paper-glow);
    font-size: 14px; font-weight: 600; color: var(--ink);
  }
  .progress__caption span { font-weight: 500; color: var(--ink); }

  .prompt { font-size: 18px; }
  .card-area { flex: none; }

  .envelope-front__content { left: 13%; right: 13%; top: 53%; bottom: 13%; }
  .envelope-front .ink-input { font-size: 22px; }
  .envelope-front .field-label { font-size: 11px; }

  .paper { padding: calc(88 * var(--k) + 6px) calc(140 * var(--k)) calc(135 * var(--k) + 6px); }
  .shell--back .paper__stamp { width: 96px; right: 12px; top: 10px; }
  .address-grid { width: 100%; grid-template-columns: 1fr; gap: 8px; padding-top: 52px; }
  .address-grid .ink-input { font-size: 20px; }

  .postcard { grid-template-columns: 1fr; gap: 14px; }
  .postcard__address { border-left: 0; border-top: 2px dashed rgba(179, 156, 221, .9); padding: 12px 0 0; }
  .postcard__stamp { position: absolute; right: -6px; top: 6px; width: 92px; margin: 0; }
  .addr-lines { font-size: 18px; margin-top: 0; padding-right: 96px; }
  .addr-lines span { white-space: normal; }
  .handle .ink-input, .handle__prefix { font-size: 24px; }
  .note__input { font-size: 19px; }
  .review__row { grid-template-columns: 1fr auto; }
  .review dt { grid-column: 1 / -1; }

  .nav { gap: 12px; width: 100%; max-width: 600px; }
  .btn--next { width: min(56%, 230px); }
  .btn--back { width: min(44%, 180px); }
  .btn__label { font-size: 16px; }
  .privacy { border-radius: 14px; font-size: 13px; }

  .screen--error .paper__stamp { width: 90px; right: 10px; top: 10px; }
  .screen--error .screen__body { width: 100%; padding-top: 56px; }
  .screen--error .screen__heading, .screen--error .screen__text { max-width: none; }
  .screen--error .btn--back { width: min(48%, 200px); }
  .screen--error .btn--back .btn__label { font-size: 14px; }
  .screen__heading { font-size: 22px; }
  .screen__text { font-size: 16px; }
  .screen__actions { gap: 10px; }
  .frame { padding: 22px 22px 30px; }
  .frame__art { width: min(100%, 300px); }
  .success__grid { grid-template-columns: 1fr; gap: 14px; }
  .exchange__card { font-size: 19px; }
}

/* =====================================================================
   AMBIENT MOTION
   The foreground is split into pieces that each move on their own:
   vines sway, charms swing (the star and moon tags swing again from
   their own hooks), loose petals bob, new petals drift down, dust
   sparkles in the window light, and the lamp glows softly.
   Positions are % of the 1672×941 artwork, so they stay locked to it.
   ===================================================================== */
.fg { position: absolute; display: block; pointer-events: none; will-change: transform; }
.fg > img:first-child { display: block; width: 100%; height: auto; }
.fg-star, .fg-moon { display: block; height: auto; will-change: transform; }

.fg-vine {
  left: 0; top: 0; width: 25.478%;
  transform-origin: 0 0;
  animation: vine-sway 7.5s ease-in-out infinite alternate;
}
@keyframes vine-sway { from { transform: skewX(-1deg); } to { transform: skewX(.45deg); } }

.fg-tag {
  left: 86.962%; top: 0; width: 8.911%;
  transform-origin: 61.7% 0;
  animation: swing-a 5.6s ease-in-out -1.4s infinite alternate;
}
.fg-star {
  position: absolute; left: 22.8%; top: 100%; width: 53.7%;
  transform-origin: 48.8% 0;
  animation: swing-b 3.3s ease-in-out -.6s infinite alternate;
}
.fg-ribbon {
  left: 95.455%; top: 0; width: 4.545%;
  transform-origin: 31.6% 0;
  animation: swing-c 6.6s ease-in-out -3s infinite alternate;
}
.fg-moon {
  position: absolute; left: -63.2%; top: 100%; width: 163.2%;
  transform-origin: 59.7% 0;
  animation: swing-b 4.1s ease-in-out -2.2s infinite alternate-reverse;
}
@keyframes swing-a { from { transform: rotate(-2.2deg); } to { transform: rotate(2deg); } }
@keyframes swing-b { from { transform: rotate(5deg); } to { transform: rotate(-4.5deg); } }
@keyframes swing-c { from { transform: rotate(-1deg); } to { transform: rotate(1.1deg); } }

.fg-float { animation: bob 5.8s ease-in-out infinite alternate; }
.fg-f4  { left: 85.227%; top: 4.463%;  width: 2.033%; animation-duration: 6.4s; animation-delay: -2s; }
.fg-f14 { left: 12.919%; top: 10.84%;  width: 2.273%; animation-duration: 5.2s; animation-delay: -1s; }
.fg-f21 { left: 7.656%;  top: 21.467%; width: 3.17%;  animation-duration: 6.9s; animation-delay: -4s; }
.fg-f23 { left: 6.22%;   top: 38.257%; width: 2.811%; animation-duration: 5.6s; animation-delay: -3s; }
.fg-f24 { left: 96.77%;  top: 41.126%; width: 2.572%; animation-duration: 7.2s; animation-delay: -1.5s; }
.fg-f26 { left: 93.002%; top: 46.227%; width: 3.05%;  animation-duration: 6.1s; animation-delay: -5s; }
@keyframes bob {
  from { transform: translate(-.15em, -.3em) rotate(-7deg); }
  to   { transform: translate(.2em, .35em) rotate(6deg); }
}

/* Petals drifting down. Each lane is stage-sized, so its % moves are % of the scene */
.fx-petals { position: absolute; inset: 0; overflow: hidden; }
.petal-lane {
  position: absolute; inset: 0; opacity: 0;
  animation: petal-fall var(--dur, 18s) linear var(--delay, 0s) infinite;
}
@keyframes petal-fall {
  0%   { transform: translate(var(--x), -5%); opacity: 0; }
  8%   { opacity: .95; }
  82%  { opacity: .9; }
  100% { transform: translate(calc(var(--x) + var(--drift)), 100%); opacity: 0; }
}
.petal {
  position: absolute; left: 0; top: 0; width: var(--size, 2em); height: auto;
  filter: drop-shadow(0 .2em .15em rgba(111, 69, 31, .18));
  animation: petal-flutter var(--spin, 3.4s) ease-in-out infinite alternate;
}
@keyframes petal-flutter {
  from { transform: translateX(-1.4em) rotate(calc(var(--tilt) * -1)) rotateY(0deg); }
  to   { transform: translateX(1.4em) rotate(var(--tilt)) rotateY(65deg); }
}

/* Window light + dust */
.fx-light {
  position: absolute; inset: 0;
  background:
    radial-gradient(55% 70% at 7% 16%, rgba(255, 233, 180, .6), transparent 70%),
    linear-gradient(118deg, transparent 24%, rgba(255, 238, 196, .28) 36%, transparent 50%);
  mix-blend-mode: soft-light;
  animation: light-breathe 9s ease-in-out infinite alternate;
}
@keyframes light-breathe { from { opacity: .5; } to { opacity: 1; } }

.fx-lamp {
  position: absolute; left: 1%; top: 26%; width: 16%; height: 30%;
  background: radial-gradient(closest-side, rgba(255, 228, 156, .6), rgba(255, 212, 125, .2) 55%, transparent);
  mix-blend-mode: screen;
  animation: lamp-glow 4.8s ease-in-out infinite alternate;
}
@keyframes lamp-glow { from { opacity: .4; transform: scale(.96); } to { opacity: .85; transform: scale(1.04); } }

.fx-dust { position: absolute; inset: 0; mix-blend-mode: screen; }
.mote {
  position: absolute; width: var(--size); height: var(--size); border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgba(255, 249, 228, 1), rgba(255, 228, 165, .6) 45%, transparent 72%);
  animation: mote var(--dur, 10s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes mote {
  0%   { transform: translate(0, 0) scale(.5); opacity: 0; }
  25%  { opacity: .95; }
  50%  { transform: translate(var(--dx), calc(var(--dy) * .5)) scale(1); opacity: .55; }
  75%  { opacity: 1; }
  100% { transform: translate(calc(var(--dx) * -.4), var(--dy)) scale(.6); opacity: 0; }
}

/* Small UI life: the current progress star twinkles, the sent envelope floats */
.pnode[data-state="active"] .pnode__icon { animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle {
  0%, 100% { transform: scale(1.18) rotate(0deg); }
  50% { transform: scale(1.26) rotate(10deg); filter: drop-shadow(0 0 .35em rgba(243, 196, 102, .9)) drop-shadow(0 .15em .15em rgba(111, 69, 31, .25)); }
}
.frame__art { animation: art-float 3.4s ease-in-out infinite alternate; }
@keyframes art-float { from { transform: translateY(-.25em) rotate(-.8deg); } to { transform: translateY(.3em) rotate(.8deg); } }

.no-ambient .fg, .no-ambient .fg-star, .no-ambient .fg-moon,
.no-ambient .fx-light, .no-ambient .fx-lamp { animation: none; }

/* =====================================================================
   LANDING SCREEN
   Showcase (frame + ribbon + badge) on the left, Aly + dialogue on the
   right. While the stage has .is-landing, the form chrome is hidden.
   ===================================================================== */
.landing { display: none; }
.stage.is-landing .landing { display: grid; }
.stage.is-landing .progress,
.stage.is-landing #prompt-box,
.stage.is-landing .card-area,
.stage.is-landing .nav,
.stage.is-landing .privacy { display: none; }

.landing {
  flex: 1 1 auto; min-height: 0; width: 100%;
  grid-template-columns: 27em 34em;
  grid-template-rows: minmax(0, 1fr);
  justify-content: center; align-items: center;
  gap: 1em 3em;
  padding-block: 1em 3.2em;
}

/* Showcase */
.showcase {
  position: relative; display: flex; flex-direction: column; align-items: center;
  animation: enter-left .7s cubic-bezier(.2,.7,.2,1) both;
}
.showcase__frame {
  position: relative; width: 100%; aspect-ratio: 1000 / 700;
  filter: drop-shadow(0 .6em .8em rgba(111, 69, 31, .28));
}
.showcase__photo {
  position: absolute; left: 14.3%; top: 10.1%; width: 71.6%;
  aspect-ratio: 4 / 3; overflow: hidden; border-radius: .4em;
  background: #fff8ec;
}
.showcase__photo img {
  display: block; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: 50% 50%;   /* focal point set from config */
}
.showcase__border { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.status-badge {
  position: absolute; top: -.5em; right: -.4em; margin: 0;
  width: 7.4em; aspect-ratio: 210 / 82;
  display: flex; align-items: center;
  padding: 0 .5em .3em 2em;
  background: url("../assets/badge-open.webp") center / 100% 100% no-repeat;
  font-size: 1.05em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #4f7a32;
  transform: rotate(5deg);
  filter: drop-shadow(0 .2em .25em rgba(111, 69, 31, .25));
  animation: badge-bob 3.2s ease-in-out infinite alternate;
}
.status-badge[data-status="full"] { background-image: url("../assets/badge-full.webp"); color: #a35c16; }
.status-badge[data-status="closed"] { background-image: url("../assets/badge-closed.webp"); color: #6a5591; }
@keyframes badge-bob { from { transform: rotate(5deg) translateY(0); } to { transform: rotate(3deg) translateY(-.18em); } }

.ribbon {
  position: relative; z-index: 1;
  width: 112%; aspect-ratio: 650 / 118; margin-top: -2.4em;
  background: url("../assets/title-ribbon.webp") center / 100% 100% no-repeat;
  display: flex; align-items: center;
  padding: 0 10% 2.8% 10%;   /* centres the title in the band (ribbon has a drop shadow below) */
  font-size: 1.3em;
}
.ribbon__title {
  margin: 0; width: 100%;
  text-align: center; white-space: nowrap; overflow: hidden;
  font-weight: 600; color: var(--ink); line-height: 1;
}
.showcase__count {
  margin: .5em 0 0; padding: .2em .9em; border-radius: 99px;
  background: var(--paper-glow); font-size: .9em; font-weight: 500; color: var(--ink);
}

/* Aly + dialogue */
.host {
  position: relative; display: flex; flex-direction: column; align-items: center;
  align-self: stretch; justify-content: flex-end;   /* buttons stay put; Aly rides on the box */
  animation: enter-right .7s .08s cubic-bezier(.2,.7,.2,1) both;
}
.host__portrait {
  position: relative; z-index: 0;
  width: 16em; aspect-ratio: 1;
  align-self: flex-start; margin: 0 0 -3.6em .6em;
}
.host__portrait img {
  display: block; width: 100%; height: 100%;
  /* the PNGs already fade out at the bottom; this just cleans the last edge */
  -webkit-mask-image: linear-gradient(#000 70%, rgba(0,0,0,.6) 84%, transparent 97%);
  mask-image: linear-gradient(#000 70%, rgba(0,0,0,.6) 84%, transparent 97%);
  transform-origin: 50% 100%;
  animation: breathe 4.2s ease-in-out infinite alternate;
}
@keyframes breathe { from { transform: translateY(0) scale(1); } to { transform: translateY(-.18em) scale(1.012); } }

.dialogue { --prompt-w: 34em; position: relative; z-index: 1; cursor: default; }
.dialogue__body { width: 100%; }
.dialogue__text { cursor: pointer; }
.dialogue__line { margin: 0 0 .4em; font-size: 1.1em; line-height: 1.38; font-weight: 500; color: var(--ink); }
.dialogue__line:last-child { margin-bottom: 0; }
.dialogue__line--theme { margin: .1em 0 .5em; }
.dialogue__line--theme mark {
  color: var(--lav-deep); font-weight: 600; font-size: 1.16em;
  background: linear-gradient(transparent 58%, rgba(243, 196, 102, .6) 58%, rgba(243, 196, 102, .6) 92%, transparent 92%);
  padding: 0 .15em; border-radius: .1em;
}

.landing__actions { display: flex; gap: 1.2em; justify-content: center; margin-top: .9em; }
.landing .btn--back { width: 15em; }
.landing .btn--next { width: 15em; }
.landing .btn--wide { width: 19.5em; }
.landing .btn__label { font-size: 1.15em; }
.landing .btn[aria-disabled="true"] { pointer-events: none; opacity: .7; }
.landing__again { margin-top: .5em; }

@keyframes enter-left  { from { opacity: 0; transform: translateX(-1.5em); } to { opacity: 1; transform: none; } }
@keyframes enter-right { from { opacity: 0; transform: translateX(1.5em); } to { opacity: 1; transform: none; } }


/* Landing on small screens */
@media (max-width: 860px), (max-height: 520px), (orientation: portrait) and (max-width: 1100px) {
  .landing { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; width: 100%; max-width: 560px; gap: 22px; padding-block: 0 8px; justify-items: center; }
  .showcase { width: min(100%, 360px); padding-top: 10px; }
  .status-badge { font-size: 14px; }
  .ribbon { font-size: 16px; margin-top: -26px; }
  .host { width: 100%; }
  .host__portrait { width: 190px; margin: 0 0 -44px 6px; }
  .dialogue { --prompt-w: min(100cqw, 560px); }
  .dialogue__line { font-size: 16px; }
  .landing__actions { gap: 8px; width: 100%; flex-direction: column; align-items: center; }
  .landing .btn--back, .landing .btn--next, .landing .btn--wide { width: min(100%, 236px); }
  .landing .btn__label { font-size: 15px; }
}

/* =====================================================================
   INSTAGRAM PILL (floating, top right)
   ===================================================================== */
.ig-pill {
  /* Inside the scene: sized in em so it scales with the room artwork.
     At full size: 20px corners, 40px icon, 11px space around it. */
  position: absolute; z-index: 6;
  top: 1.1em; right: 1.3em;
  display: inline-flex; align-items: center; gap: .75em;
  padding: .69em 1.15em .69em .69em;
  border-radius: 1.25em;
  background: linear-gradient(#fffaf0, #fdf0dc);
  border: .125em solid var(--gold);
  color: var(--ink);
  font-family: var(--font-ui); font-weight: 600; font-size: 1em; letter-spacing: .01em;
  text-decoration: none; white-space: nowrap;
  filter: drop-shadow(0 .32em .25em rgba(111, 69, 31, .3));   /* same raised shadow as Back/Next */
  transition: transform .18s var(--ease), filter .18s;
}
.ig-pill__icon { width: 2.5em; height: 2.5em; display: block; flex: none; border-radius: .55em; }
.ig-pill__handle { font-size: 1.05em; }
.ig-pill:hover { transform: translateY(-.18em); filter: drop-shadow(0 .5em .4em rgba(111, 69, 31, .3)); }
.ig-pill:active { transform: translateY(.06em); filter: drop-shadow(0 .12em .12em rgba(111, 69, 31, .3)); }
.ig-pill:focus-visible { outline: .18em solid var(--lav-deep); outline-offset: .18em; }

/* Smaller screens: icon only */
@media (max-width: 860px), (max-height: 520px), (orientation: portrait) and (max-width: 1100px) {
  .ig-pill {
    position: fixed; font-size: 16px; padding: 10px; gap: 0; border-radius: 18px;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
  }
  .ig-pill__handle { display: none; }
  .stage { padding-top: calc(70px + env(safe-area-inset-top, 0px)); }   /* room for the icon */
}
