@font-face {
  font-family: 'Inter';
  src: url(/fonts/inter-latin-wght-normal.woff2) format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  src: url(/fonts/inter-latin-ext-wght-normal.woff2) format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --black: #000000;
  --snow: #F3F1EC;
  --ash: #8E8B85;
  --dim: #3A3833;
  --line: rgba(255, 255, 255, .14);
  --line-2: rgba(255, 255, 255, .3);
  --surface: rgba(255, 255, 255, .05);
  --surface-2: rgba(255, 255, 255, .1);
  --gold: #E8C77B;
  --gold-2: #F4DDA6;
  --glow: rgba(232, 199, 123, .9);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; scroll-padding-bottom: 120px; background: var(--black); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-feature-settings: 'cv11' 1;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--snow);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  /* a column, so the footer sits at the bottom of short pages */
  display: flex; flex-direction: column;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- The wordmark: "Magic" with a gold sparkle for the dot on the i ---- */
.wordmark {
  display: inline-block; margin: 0;
  font-weight: 650; letter-spacing: -0.065em; line-height: 1; white-space: nowrap;
  padding-right: .065em; /* give back the tracking after the last letter so it centres */
  color: var(--snow);
}
.wm-i { position: relative; }
.tittle {
  position: absolute; left: calc(50% - .155em); top: .02em;
  width: .34em; height: .34em; overflow: visible;
  fill: url(#spark-fill);
  filter: drop-shadow(0 0 .05em var(--glow)) drop-shadow(0 0 .22em rgba(232, 199, 123, .45));
  transform-origin: 50% 50%;
  animation: twinkle 6s ease-in-out 2s infinite;
}
/* Rests most of the time, then a quick glint */
@keyframes twinkle {
  0%, 82%, 100% { transform: scale(1) rotate(0deg); }
  89% { transform: scale(1.35) rotate(45deg); }
}

/* On the landing page: a glint sweeps across the letters once, then the sparkle lights up. */
.wordmark-hero {
  font-size: clamp(4.25rem, 22vw, 7rem);
  /* bottom padding keeps the g's tail inside the painted area */
  padding-bottom: .16em;
  margin-bottom: 14px;
  /* the band must sit between 38.5% and 61.5% so the letters rest on plain white before and after */
  background: linear-gradient(100deg, var(--snow) 0 40%, #F7E2AE 46%, var(--gold) 50%, #F7E2AE 54%, var(--snow) 60% 100%);
  background-size: 260% 100%;
  background-position: 0 0;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: glint 1.6s cubic-bezier(.35, .55, .25, 1) .2s both;
}
@keyframes glint { from { background-position: 100% 0; } to { background-position: 0 0; } }
.wordmark-hero .tittle { animation: ignite .8s cubic-bezier(.2, 1.5, .4, 1) 1.15s both, twinkle 6s ease-in-out 3s infinite; }
@keyframes ignite {
  from { transform: scale(0) rotate(-120deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ---- Layout ---- */
.top, .shell, .progress { width: 100%; max-width: 680px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.top { padding-top: 20px; padding-bottom: 4px; display: flex; align-items: center; }
body[data-screen="intro"] .top { display: none; }
.brand { color: var(--snow); text-decoration: none; border-radius: 8px; padding: 4px 2px 2px; }
.brand .wordmark { font-size: 1.75rem; }
.brand .tittle { width: .42em; height: .42em; left: calc(50% - .195em); top: -.04em; }
.top, .progress, .foot { flex: none; }
.shell { flex: 1 0 auto; padding-bottom: 32px; }
body[data-screen="intro"] .shell { display: flex; flex-direction: column; padding-bottom: 0; }

/* Landing: logo, one line, the button. Nothing else competes with Start. */
.intro {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  flex: 1 0 auto; padding: 24px 0 6vh;
}
.intro h1 {
  font-size: clamp(1.3rem, 5vw, 1.65rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.25;
  margin: 0 0 6px;
}
.lede { color: var(--ash); font-size: 1.1rem; margin: 0 0 30px; }
.note { font-size: .92rem; color: var(--ash); margin: 16px 0 0; }

/* ---- Progress: one star per question, lit as you go ---- */
.constellation { display: block; width: 100%; max-width: 230px; height: auto; overflow: visible; }
.constellation .base { stroke: #FFFFFF; stroke-opacity: .2; stroke-width: 1; stroke-dasharray: 2 5; }
.constellation .lit {
  stroke: var(--gold); stroke-opacity: .8; stroke-width: 1.4; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .5s ease;
}
.constellation .lit[data-on="true"] { stroke-dashoffset: 0; }
.star use { fill: var(--dim); transition: fill .3s ease .3s; }
.star .halo { fill: url(#halo); opacity: 0; transition: opacity .4s ease .3s; }
.star[data-state="done"] use { fill: var(--gold); }
.star[data-state="done"] .halo { opacity: .35; }
.star[data-state="current"] use { fill: var(--snow); animation: glimmer 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.star[data-state="current"] .halo { opacity: .8; }
@keyframes glimmer { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

.progress { padding-top: 12px; }
.progress[hidden] { display: none; }
.progress-count { margin: 4px 0 0; font-size: .9rem; color: var(--ash); }

/* ---- Type ---- */
h1 {
  font-weight: 600; letter-spacing: -0.03em; line-height: 1.1;
  font-size: clamp(1.65rem, 6.2vw, 2.25rem);
  margin: 18px 0 8px; text-wrap: balance;
}
h1:focus { outline: none; }
h2 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; font-size: 1.2rem; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.hint { color: var(--ash); margin-bottom: 20px; }

/* ---- Buttons ---- */
.btn {
  font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2;
  min-height: 50px; padding: 12px 26px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s, box-shadow .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .brand:focus-visible, .x:focus-visible, .foot a:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}
.btn-primary { background: var(--gold); color: var(--black); }
.btn-primary:hover { background: var(--gold-2); box-shadow: 0 0 32px rgba(232, 199, 123, .35); }
.btn-quiet { background: transparent; color: var(--snow); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--line-2); }
.btn-big { min-height: 58px; min-width: 220px; padding: 14px 52px; font-size: 1.125rem; }
.btn[disabled] { opacity: .6; cursor: progress; }

.actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 12px; align-items: center;
  margin: 28px -20px 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.actions .next { margin-left: auto; min-width: 150px; }

/* ---- Answer chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font: inherit; font-size: .98rem; font-weight: 500; line-height: 1.2;
  min-height: 46px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--snow);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-align: left;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--line-2); background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--snow); border-color: var(--snow); color: var(--black); }
/* Every chip carries a 14px icon (plus, or a tick when picked), so picking one never changes its width. */
.chip::before {
  content: ''; width: 14px; height: 14px; flex: none; background: currentColor; opacity: .5; margin-left: -4px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3v10M3 8h10' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3v10M3 8h10' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chip[aria-pressed="true"]::before {
  opacity: 1;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chip.is-off { opacity: .4; }
.group { font-size: .95rem; font-weight: 600; color: var(--ash); margin: 22px 0 10px; letter-spacing: 0; }
.group:first-child { margin-top: 0; }
.limit-msg { min-height: 1.5em; margin: 12px 0 0; color: var(--gold); font-weight: 500; }

/* ---- Title search ---- */
.picked { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 14px; }
.picked:empty { display: none; }
.pick {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  background: var(--snow); color: var(--black); font-weight: 600;
  border-radius: 999px; padding: 3px 3px 3px 15px; min-height: 42px;
}
.pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick small { font-weight: 500; font-size: .82rem; color: #66625B; margin-left: 2px; flex: none; }
.x {
  font: inherit; font-size: 1.2rem; line-height: 1; width: 36px; height: 36px; border-radius: 50%; flex: none;
  border: 0; background: rgba(0, 0, 0, .07); color: var(--black); cursor: pointer;
}
.x:hover { background: rgba(0, 0, 0, .15); }
.search { position: relative; }
.search input {
  width: 100%; font: inherit; font-size: 1.0625rem; color: var(--snow);
  min-height: 54px; padding: 12px 16px 12px 46px; border-radius: 16px;
  border: 1px solid var(--line); background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%238E8B85' stroke-width='2'/%3E%3Cpath d='M15.5 15.5L20 20' stroke='%238E8B85' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 16px 50%; background-size: 20px;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--ash); }
.search input:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.results {
  list-style: none; margin: 8px 0 0; padding: 6px;
  background: #121212; border: 1px solid var(--line); border-radius: 16px;
}
.results[hidden] { display: none; }
.opt {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 46px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 500;
}
.opt small { font-weight: 400; color: var(--ash); flex: none; }
.opt[aria-selected="true"], .opt:hover { background: var(--surface-2); }
.opt-add { color: var(--gold); }
.quick { margin-top: 24px; }
.quick[hidden] { display: none; }
.full-msg {
  margin: 0; padding: 14px 16px; border-radius: 16px; font-weight: 500;
  background: var(--surface); border: 1px dashed var(--line-2);
}

/* ---- Wishes text box ---- */
.field-label { display: block; font-weight: 600; margin: 26px 0 8px; }
.field-label span { font-weight: 400; color: var(--ash); }
textarea {
  width: 100%; font: inherit; color: var(--snow); resize: vertical; min-height: 96px;
  padding: 12px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
}
textarea::placeholder { color: var(--ash); }
textarea:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.counter { font-size: .88rem; color: var(--ash); text-align: right; margin-top: 4px; }
.counter.at-limit { color: var(--gold); font-weight: 600; }
.wish-note { font-size: .92rem; color: var(--gold); margin: 4px 0 0; }
.wish-note:empty { display: none; }

/* ---- End: thank you, plus an optional email ---- */
.done h1 { font-size: clamp(2rem, 8vw, 2.75rem); margin-top: 22px; }
.done .lede { margin-bottom: 34px; }
.signup { padding: 24px 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.signup h2 { font-size: 1.2rem; }
.signup p { color: var(--ash); }
.signup label { display: block; font-weight: 600; margin: 16px 0 8px; }
.signup label span { font-weight: 400; color: var(--ash); }
.signup .row { display: flex; gap: 10px; flex-wrap: wrap; }
.signup input[type="email"] {
  flex: 1 1 220px; min-width: 0; font: inherit; font-size: 1.0625rem; color: var(--snow);
  min-height: 52px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--black);
}
.signup input::placeholder { color: var(--ash); }
.signup input[type="email"]:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.signup input[aria-invalid="true"] { border-color: #FF8F8F; }
.signup .btn-primary { flex: 0 0 auto; }
.signup .error { color: #FFA3A3; font-weight: 500; margin: 10px 0 0; }
.signup .error:empty { display: none; }
.signup .fine { font-size: .86rem; margin: 14px 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Footer: on the landing page and the end screen ---- */
.foot {
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom));
  text-align: center; font-size: .88rem; line-height: 1.4; color: var(--ash);
}
body:not([data-screen="intro"]):not([data-screen="done"]) .foot { display: none; }
.foot p { margin: 6px 0 0; }
.foot a { color: var(--snow); text-decoration: none; border-radius: 6px; }
.foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.foot-x { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; padding: 6px 4px; }
.foot-x svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.foot .legal { font-size: .78rem; margin-top: 8px; }

/* Screen change */
.enter { animation: enter .3s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Short screens (small phones, landscape): tighten the top so more of each question fits. */
@media (max-height: 700px) {
  .top { padding-top: 12px; padding-bottom: 0; }
  .brand .wordmark { font-size: 1.5rem; }
  .progress { padding-top: 6px; }
  .constellation { max-width: 190px; }
  .progress-count { font-size: .85rem; }
  h1 { font-size: clamp(1.45rem, 6vw, 1.9rem); margin: 10px 0 4px; }
  .hint { margin-bottom: 14px; }
  .chips { gap: 8px; }
  .chip { min-height: 44px; padding: 8px 14px; }
  .group { margin: 16px 0 8px; }
  .btn { min-height: 46px; }
  .wordmark-hero { margin-bottom: 8px; }
  .lede { margin-bottom: 22px; }
  .foot { padding-top: 4px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .wordmark-hero { background: none; -webkit-text-fill-color: currentColor; color: var(--snow); }
}
