@font-face {
  font-family: Vazirmatn;
  src: url("assets/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #1e102e;
  --text: #f8f2ff;
  --muted: #c2afcf;
  --violet: #7941ed;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
}
* { box-sizing: border-box; }
body {
  margin: 0; min-width: 320px; min-height: 100svh;
  display: flex; flex-direction: column;
  color: var(--text); background: var(--bg);
  font: 16px/1.8 Vazirmatn, Tahoma, sans-serif;
}
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
button { border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #d7b5ff; outline-offset: 5px; }
.header {
  display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center;
  padding: 22px clamp(24px, 4.5vw, 76px) 8px;
}
.wordmark { font-size: 31px; font-weight: 850; letter-spacing: -1.6px; }
.wordmark span { margin-inline-start: 4px; color: #bd8aff; font-size: .56em; letter-spacing: 0; }
.coming {
  font-size: 14px; font-weight: 600; color: #f1e4ff; display: flex; align-items: center; gap: 9px;
  padding: 5px 14px; border-radius: 999px; background: #7941ed2e; border: 1px solid #bd8aff55;
}
.coming i { width: 7px; height: 7px; background: #d7b0ff; border-radius: 50%; box-shadow: 0 0 10px #d1a0ffaa; }
main { flex: 1; display: flex; align-items: center; flex-direction: column; justify-content: center; padding-top: 12px; }
.intro { text-align: center; padding-inline: 20px; position: relative; z-index: 2; }
h1 { font-size: clamp(34px, 4.2vw, 64px); font-weight: 800; line-height: 1.48; letter-spacing: -.035em; text-wrap: balance; }
.intro p { color: #decfe9; font-size: clamp(16px, 1.6vw, 22px); margin-top: 14px; }
.scene {
  width: min(620px, 100%); aspect-ratio: 620 / 350;
  position: relative; direction: ltr; isolation: isolate; flex: 0 0 auto;
  margin-block: 7px 0; pointer-events: none; overflow: clip;
}
.ambient {
  position: absolute; inset: -12% 8% -13%;
  background: radial-gradient(ellipse at 54% 58%, #8e3dd02b, #7941ed0a 42%, transparent 70%);
}
.floor {
  position: absolute; left: -25%; right: -25%; top: 77%; height: 46%;
  background: radial-gradient(ellipse at 50% 35%, #9655e92b, #9655e909 42%, transparent 70%);
}
.light-spill {
  position: absolute; left: 34%; top: 83%; width: 43%; height: 28%;
  background: radial-gradient(ellipse at 50% 12%, #f4b5ff99, #a25be744 32%, #8b48ca12 55%, transparent 72%);
  transform: scaleX(.4); opacity: .35;
  transition: transform 1000ms var(--ease-out), opacity 1000ms var(--ease-out);
}
.threshold {
  position: absolute; left: 38.3%; top: 88%; width: 26%; height: 1%;
  background: #eeb9ff; border-radius: 50%;
  box-shadow: 0 0 14px 4px #e7adff55, 0 0 50px 8px #b263ff44;
}
.portal {
  position: absolute; left: 38%; top: 6%; width: 26%; height: 83%;
  border-radius: 46% 46% 0 0 / 24% 24% 0 0;
  background: #ba7ad5;
  box-shadow: 1px 0 2px #efc4ff, 6px 0 18px #db8efa55, 0 0 65px #ad57dc22;
  perspective: 750px;
}
.room {
  position: absolute; inset: 2px 3px 0 2px; overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(100deg, #633f84, #dda5ed 48%, #f5c8ff 90%, #fff0ff);
  box-shadow: inset 8px 0 15px #47295355;
}
.robot {
  position: absolute; width: 118%; aspect-ratio: 633 / 760; left: 8%; top: 25%;
  transform: translateX(-15%) rotate(-9deg); transform-origin: 55% 85%;
  transition: transform 1000ms var(--ease-out);
}
.robot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.robot-head { position: absolute; inset: 0; transform-origin: 49% 44%; transition: transform 250ms var(--ease-out); }
.door {
  position: absolute; inset: 0; border-radius: inherit;
  transform-origin: 0% 50%; transform: rotateY(-8deg);
  background: linear-gradient(100deg, #28163a 0%, #301b42 60%, #452751 100%);
  box-shadow: inset 1px 1px 2px #9c6c9b66, inset -2px 0 2px #f5a4df66, 7px 3px 7px #2a103559;
  transition: transform 1100ms var(--ease-out);
}
.door-edge {
  position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset -5px 0 5px #c486b333;
}
.handle {
  position: absolute; right: 10%; top: 62%; width: 10%; aspect-ratio: .82;
  border-radius: 50%;
  background: radial-gradient(ellipse at 30% 25%, #f3cf8d, #b37a37 35%, #674022 70%);
  box-shadow: 2px 3px 4px #0007, inset 1px 0 1px #fff5;
}
body.ready .door { transform: rotateY(-63deg); }
body.ready .robot { transform: translateX(5%) rotate(-7deg); }
body.ready .light-spill { transform: scaleX(1); opacity: .8; }
body.listening .door { transform: rotateY(-66deg); transition-duration: 500ms; }
body.listening .robot { transform: translateX(8%) translateY(-3%) rotate(-4deg); transition-duration: 500ms; }
body.listening .light-spill { transform: scaleX(1.14); opacity: 1; transition-duration: 500ms; }
body.delivered .door { transform: rotateY(-73deg); }
body.delivered .robot { transform: translateX(12%) translateY(-3%) rotate(0deg); }
body.delivered .room { background: linear-gradient(100deg, #76508e, #e7b4e9 50%, #ffe1ef); }
.letter {
  position: absolute; z-index: 4; width: 58px; height: 43px; left: calc(54% - 29px); top: 57%;
  border-radius: 4px; background: #fff1dc; box-shadow: 0 4px 15px #190c2e44;
  padding: 10px 9px; opacity: 0;
}
.letter span { display: block; height: 2px; margin-bottom: 4px; background: #bfa6ce; border-radius: 2px; }
.letter span:nth-child(2) { width: 75%; margin-left: auto; }
.letter span:nth-child(3) { width: 45%; margin-left: auto; }
.letter i { position: absolute; left: 6px; bottom: 1px; font: 15px Georgia, serif; color: #8c55c8; }
.bubble {
  position: absolute; z-index: 3; left: 66%; top: 14%; padding: 6px 14px; white-space: nowrap;
  border-radius: 16px 16px 16px 4px; background: #fbf4ff; color: #4a2b66;
  font-size: 15px; font-weight: 700; box-shadow: 0 8px 24px #12052055;
  opacity: 0; transform: translateY(6px) scale(.85); transform-origin: 0% 100%;
  transition: opacity 200ms ease, transform 200ms var(--ease-out);
  white-space: normal; width: max-content; max-width: 34%; line-height: 1.7;
}
.bubble b { color: #7439df; }
/* Shown and re-worded from JS so each line of the robot's reply gets its own entrance. */
.bubble.show { opacity: 1; transform: none; transition: opacity 260ms ease, transform 420ms var(--ease-out); }
.invitation { position: relative; z-index: 2; width: min(780px, calc(100% - 48px)); margin-top: 0; text-align: center; }
.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 6px;
  background: #f5eafd; border: 1px solid #f3deff;
  border-radius: 36px; box-shadow: 0 6px 45px #9d4fde0c;
  transition: box-shadow 180ms ease;
}
.composer:focus-within { box-shadow: 0 0 0 4px #ba84ef33; }
.writing { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
textarea {
  /* Height follows content from JS; overflow scrolls only past the max height. */
  width: 100%; height: 56px; min-height: 56px; max-height: 148px; padding: 21px 19px 3px 7px;
  background: transparent; border: 0; border-radius: 24px; color: #362047;
  line-height: 1.8; font-size: 18px; resize: none; caret-color: #7941ed;
  overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #bda2cf transparent;
}
textarea.scrolls { overflow-y: auto; }
textarea:focus-visible { outline: none; }
/* The sentence start stays visible while writing: it floats up as a small label. */
.prompt {
  position: absolute; right: 19px; left: 5px; top: 12px; pointer-events: none;
  color: #705287; font-size: 18px; line-height: 1.8; white-space: nowrap; text-align: right;
  transform-origin: 100% 0;
  transition: transform 200ms var(--ease-out), color 200ms ease;
}
.writing:focus-within .prompt, .writing.has-value .prompt { transform: translateY(-9px) scale(.66); color: #6a4e80; }
.writing:focus-within .cursor, .writing.has-value .cursor { visibility: hidden; }
.cursor { display: inline-block; font-family: sans-serif; font-weight: 600; }
.primary {
  min-height: 54px; padding: 12px 27px; border-radius: 28px;
  color: white; background: #7439df; font-weight: 650; font-size: 16px;
  display: inline-flex; gap: 12px; align-items: center; justify-content: center;
  flex: 0 0 auto; box-shadow: inset 0 1px 0 #ffffff26;
  transition: background-color 160ms ease, transform 160ms var(--ease-out);
}
.primary svg { width: 19px; height: 19px; }
.primary:active { transform: scale(.97); }
.primary:disabled { background: #8463b2; }
.ideas-heading { margin-top: 10px; color: #decfe9; font-size: 13px; font-weight: 650; }
.ideas { display: flex; justify-content: center; gap: 8px; margin-top: 5px; }
.ideas button {
  min-height: 36px; padding: 4px 14px; border-radius: 18px; font-size: 14px; white-space: nowrap;
  color: #e3d1f3; background: #ffffff0d; border: 1px solid #d9b9ff33;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out);
}
.ideas button:active { transform: scale(.97); }
.invitation-copy { margin-top: 14px; color: #d7c5e4; font-size: clamp(14px, 1.4vw, 18px); text-wrap: balance; }
.error { margin: 10px 10px 0; color: #ffbecb; text-align: right; font-size: 14px; }
/* The receipt takes the invitation line's place instead of pushing the page down. */
.receipt { margin-top: 4px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 4px; }
.receipt p { color: #e8dbf5; font-size: 15px; }
.text-button {
  background: transparent; color: #d9b9ff; font-size: 14px;
  text-underline-offset: 5px; text-decoration: underline; min-height: 44px; padding: 8px;
}
footer {
  padding: 27px 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: #ac91bf; font-size: 12px;
}
footer small { font-size: 12px; color: #b29cbd; }
.footer-domain { color: #e8dbf5; letter-spacing: .06em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Chosen examples sit inside the composer as removable pills, above the free text. */
.writing { flex-wrap: wrap; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; padding: 30px 14px 0 6px; }
.picked:empty { display: none; }
/* Only when pills exist: an empty, hidden row must not change the field's spacing. */
.picked:not(:empty) + textarea { padding-top: 4px; min-height: 44px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 12px 2px 8px;
  border-radius: 16px; background: #7439df; color: white; font-size: 14px;
}
.pill span { font: 17px/1 Arial, sans-serif; opacity: .8; }
.ideas { flex-wrap: wrap; }
.ideas button[aria-pressed="true"] { background: #ffffff20; border-color: #d9b9ff; }
/* Email step replaces the wish composer in place; no modal covers the scene. */
#email-form { text-align: center; }
#email-form:focus { outline: none; }
.contact-method { border: 0; padding: 0; margin: 0 0 8px; }
.contact-method legend { margin: 0 auto 4px; font-weight: 700; }
.contact-method label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-inline: 8px; cursor: pointer; }
.contact-method input { accent-color: #bd8aff; }
.contact-method svg { width: 18px; height: 18px; color: #d9b9ff; }
.summary { color: #d7c5e4; font-size: 14px; margin-bottom: 8px; display: flex; justify-content: center; align-items: center; gap: 4px; }
.summary bdi { max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f1e4ff; }
.summary .text-button { min-height: 32px; padding: 4px; }
.email-writing .prompt { pointer-events: auto; top: 6px; transform: scale(.72); color: #6a4e80; }
.email-writing .prompt span { color: #8a6aa3; }
#email {
  width: 100%; height: 56px; padding: 22px 19px 4px 7px; border: 0; background: transparent;
  color: #35213f; font-size: 17px; text-align: right;
}
#email:placeholder-shown { text-align: right; }
#email::placeholder { color: #9a87a6; }
#email:focus-visible { outline: none; }
.email-foot { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; column-gap: 10px; margin-top: 4px; color: #ac91bf; font-size: 12px; }
.invitation.step-email > :not(#email-form):not(#announce) { display: none !important; }
.invitation.step-done > :not(#done):not(#announce) { display: none !important; }
.done {
  padding: 18px 24px 8px; border-radius: 28px; background: #ffffff0b; border: 1px solid #d9b9ff33;
}
.done:focus { outline: none; }
.done-title { font-size: 20px; font-weight: 750; color: #f8f2ff; }
.done-title b { color: #bd8aff; }
.done-line { color: #d7c5e4; font-size: 15px; margin-top: 4px; overflow-wrap: anywhere; }
.done-line bdi { color: #f1e4ff; }
#done-email { font-weight: 600; }
.done .text-button { min-height: 36px; padding: 4px 8px; margin-top: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .invitation.step-email #email-form { animation: step-in 180ms var(--ease-out); }
  @keyframes step-in { from { opacity: .55; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (hover: hover) and (pointer: fine) {
  .primary:hover:not(:disabled) { background: #844be9; }
  .text-button:hover { color: #a979eb; }
  .ideas button:hover { background: #ffffff17; border-color: #d9b9ff66; }
  .pill:hover { background: #844be9; }
}
@media (prefers-reduced-motion: no-preference) {
  .cursor { animation: cursor 1.15s step-end 4; }
  @keyframes cursor { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .robot-head { transform: none !important; }
}
@media (max-width: 600px) {
  .header { padding: 18px 24px 8px; }
  .wordmark { font-size: 27px; }
  .coming { font-size: 12px; }
  main { padding-top: 16px; }
  h1 { font-size: clamp(30px, 7.3vw, 43px); line-height: 1.6; }
  .intro p { font-size: 15px; margin-top: 10px; }
  .scene { width: 100%; aspect-ratio: 420 / 280; margin-top: 12px; overflow: clip; }
  .portal { left: 34%; width: 32%; top: 5%; height: 84%; }
  .threshold { left: 34%; width: 32%; }
  .light-spill { left: 28%; width: 55%; }
  .invitation { width: calc(100% - 36px); }
  .bubble { left: 66%; top: 6%; font-size: 13px; padding: 5px 11px; max-width: 33%; }
  .composer { border-radius: 23px; flex-direction: column; padding: 7px; gap: 5px; }
  .writing { width: 100%; }
  textarea { font-size: 16px; padding-right: 13px; }
  .prompt { font-size: 16px; right: 13px; top: 13px; }
  .ideas { justify-content: center; flex-wrap: wrap; }
  .ideas button { font-size: 13px; min-height: 34px; flex: 0 0 auto; }
  .composer .primary { width: 100%; min-height: 48px; border-radius: 16px; }
  .invitation-copy { margin-top: 18px; max-width: 300px; margin-inline: auto; line-height: 2; }
  footer { padding-top: 24px; }
  .picked { padding: 28px 8px 0; }
  #email { padding-right: 13px; font-size: 16px; }
  .summary bdi { max-width: 22ch; }
}
@media (min-width: 601px) {
  .scene { width: min(620px, 90%, max(120px, calc((100svh - 545px) * 1.77))); }
  footer { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 6px 16px; }
}
@media (min-width: 601px) and (max-height: 960px) {
  .header { padding-top: 14px; }
  main { padding-top: 2px; }
  h1 { font-size: clamp(34px, 4vw, 51px); line-height: 1.4; }
  .intro p { margin-top: 10px; font-size: 18px; }
  .scene { width: min(540px, 90%, max(120px, calc((100svh - 585px) * 1.77))); }
  .ideas-heading { margin-top: 6px; }
  footer { padding-block: 12px 10px; }
}
@media (min-width: 601px) and (max-height: 650px) {
  .header { padding-block: 8px 4px; }
  h1 { font-size: clamp(29px, 4vw, 40px); line-height: 1.3; }
  .intro p { margin-top: 6px; }
}
