:root {
  --accent-50: #EEECFB; --accent-100: #DCD8F7; --accent-200: #BEB6F0; --accent-300: #9D92E8;
  --accent-400: #7C6EE1; --accent-500: #5B4BDB;
  --gray-100: #F3F3F4; --gray-300: #D4D4D8; --gray-500: #717178; --gray-700: #434348;
  --gray-800: #2F2F39; --gray-900: #1D1D24;
  --bg: #FFFBF8; --card: #FFFFFF;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --serif: "EB Garamond", ui-serif, Georgia, serif;
  --script: "Cormorant", ui-serif, Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--gray-900); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--gray-900); }
.top { display: flex; justify-content: center; padding: 20px 16px 4px; }
.logo { height: 28px; display: block; }
.wrap { max-width: 520px; margin: 0 auto; padding: 8px 16px 48px; }
.flourish { font-family: var(--script); font-style: italic; font-weight: 300; font-size: 26px; color: var(--accent-500); text-align: center; margin: 12px 0 0; }
h1, .names { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.1; text-align: center; margin: 4px 0 8px; letter-spacing: -0.01em; }
.lede { text-align: center; color: var(--gray-500); margin: 0 0 24px; }
.meta { text-align: center; color: var(--gray-500); margin: 0 0 20px; }
.muted { color: var(--gray-500); text-align: center; }

.card { background: var(--card); border-radius: 20px; padding: 20px; margin: 0 0 16px; box-shadow: 0 1px 2px rgba(29,29,36,.04), 0 8px 24px rgba(29,29,36,.06); }
.card h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 0 0 4px; }
.card .hint { color: var(--gray-500); font-size: 14px; margin: 0 0 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin: 0 0 6px; }
input[type=text], input[type=email], input[type=date] {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--gray-300); border-radius: 12px; background: #fff; color: var(--gray-900); margin: 0 0 12px; -webkit-appearance: none; min-height: 48px;
}
textarea { width: 100%; font: inherit; font-size: 16px; line-height: 1.5; padding: 12px 14px; border: 1px solid var(--gray-300); border-radius: 12px; background: #fff; color: var(--gray-900); resize: vertical; min-height: 128px; -webkit-appearance: none; display: block; }
textarea::placeholder, input::placeholder { color: var(--gray-500); opacity: .8; }
/* An empty date field shows mm/dd/yyyy in the text colour; grey it like the other placeholders. */
input[type=date].empty { color: rgb(113 113 120 / .8); }
textarea:focus { outline: 2px solid var(--accent-300); border-color: transparent; }
.field-error { color: #B42318; font-size: 13px; margin: 6px 0 0; }
.field-error:empty { display: none; }
.detected { font-size: 12px; color: var(--gray-500); margin: 6px 0 0; }
.detected:empty { display: none; }
textarea.invalid { border-color: #B42318; }
/* "Polish with AI": a small sparkle tucked into the story box's corner, shown once there's something to polish. */
.story-box { position: relative; margin-bottom: 16px; }
.story-box textarea { padding-bottom: 44px; resize: none; }
.polish { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 10px; }
.polish .undo { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--gray-700); text-decoration: underline; cursor: pointer; }
.sparkle { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 99px; background: var(--accent-50); color: var(--accent-500); display: grid; place-items: center; cursor: pointer; transition: opacity .15s, background .15s; }
.sparkle:hover { background: var(--accent-100); }
.sparkle:disabled { opacity: 0; pointer-events: none; }
/* Polishing takes ~6 s (the most faithful model): a spinning ring and a word, so it clearly is working. */
.sparkle.busy { opacity: 1; cursor: default; }
.sparkle.busy svg { display: none; }
.sparkle.busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-200); border-top-color: var(--accent-500); animation: spin .8s linear infinite; }
.polishing { font-size: 13px; color: var(--gray-500); }
/* Polish transition: an accent sweep over the fields being rewritten, then the new text settles in with a faint glow. */
textarea.shimmer, input.shimmer { background: linear-gradient(100deg, #fff 30%, var(--accent-100) 50%, #fff 70%) 0 0 / 250% 100%; animation: shimmer 1.2s ease-in-out infinite; color: var(--gray-500); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.flash { animation: flash .8s ease-out; }
@keyframes flash {
  0% { color: var(--gray-500); box-shadow: 0 0 0 2px var(--accent-50); }
  100% { box-shadow: 0 0 0 2px transparent; }
}
@media (prefers-reduced-motion: reduce) { .shimmer, .flash { animation: none; } }
.polish.busy .undo { display: none; }
.our-story { max-width: 360px; margin: 24px auto 0; text-align: center; }
.our-story h2 { font-family: var(--script); font-style: italic; font-weight: 300; font-size: 24px; color: var(--accent-500); margin: 0 0 6px; }
.our-story p { font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--gray-800); margin: 0; white-space: pre-line; }
input:focus { outline: 2px solid var(--accent-300); border-color: transparent; }

.make-cta { max-width: 360px; margin: 28px auto 0; background: var(--accent-50); border-radius: 20px; padding: 20px; text-align: center; }
.make-cta h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 0 0 6px; }
.make-cta p { color: var(--gray-700); font-size: 15px; margin: 0 0 16px; }
.consent { color: var(--gray-500); font-size: 13px; margin: 8px 0 0; }
.tones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tone { border: 1px solid var(--gray-300); border-radius: 14px; padding: 12px 6px; text-align: center; cursor: pointer; background: #fff; font: inherit; color: inherit; }
.tone b { display: block; font-family: var(--serif); font-weight: 500; font-size: 18px; }
.tone span { font-size: 12px; color: var(--gray-500); }
.tone.on { border-color: var(--gray-900); background: var(--accent-50); box-shadow: inset 0 0 0 1px var(--gray-900); }
/* The mood's three colours: small dots under its description. */
.tone .dots { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.tone .dot { position: relative; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.tone .dot::after { content: ""; position: absolute; inset: -4px; } /* bigger tap target, meeting its neighbour's halfway */
.tone .dot.on { box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px var(--gray-900); }

.drop { display: block; border: 1.5px dashed var(--accent-400); border-radius: 16px; padding: 22px 12px; text-align: center; background: var(--accent-50); cursor: pointer; }
.drop b { font-family: var(--serif); font-size: 20px; font-weight: 500; display: block; }
.drop span { font-size: 13px; color: var(--gray-500); }
.drop input { display: none; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.tile { position: relative; aspect-ratio: 9 / 14; border-radius: 12px; overflow: hidden; background: var(--gray-100); }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.off img, .tile.off video { opacity: .25; filter: grayscale(1); }
.tile .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent-400); transition: width .2s; }
.tile .tag { position: absolute; top: 6px; left: 6px; font-size: 11px; background: rgba(29,29,36,.75); color: #fff; padding: 2px 7px; border-radius: 99px; }
.tile .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 99px; border: 0; background: rgba(255,255,255,.9); font-size: 15px; line-height: 28px; padding: 0; cursor: pointer; }
.tile .snd { position: absolute; left: 6px; right: 6px; bottom: 8px; border: 0; border-radius: 99px; font: inherit; font-size: 11px; font-weight: 500; padding: 5px 4px; background: rgba(255,255,255,.9); cursor: pointer; }
.tile .snd.on { background: var(--gray-900); color: #fff; }
.tile .err { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,235,224,.9); font-size: 12px; text-align: center; padding: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 56px; border-radius: 999px; border: 0; background: #000; color: #fff; font: inherit; font-size: 16px; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .3s; }
.btn:hover { background: var(--gray-700); }
.btn:disabled { background: var(--gray-100); color: rgba(29,29,36,.3); cursor: default; }
.btn-light { background: #fff; color: var(--gray-900); box-shadow: inset 0 0 0 1px var(--gray-300); }
.btn-light:hover { background: var(--accent-50); }
.share-ico { margin-left: 8px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-pill { height: 32px; padding: 0 16px; border-radius: 99px; border: 0; background: var(--gray-100); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.error { color: #B42318; font-size: 14px; text-align: center; min-height: 20px; margin: 8px 0; }

.making { text-align: center; padding: 40px 12px; }
.making p { font-family: var(--serif); font-size: 22px; margin: 16px 0 4px; }
.making small { color: var(--gray-500); }
.spinner { width: 44px; height: 44px; margin: 0 auto; border-radius: 99px; border: 3px solid var(--accent-100); border-top-color: var(--accent-500); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.reel { display: block; width: 100%; max-width: 360px; aspect-ratio: 9 / 16; margin: 8px auto 20px; border-radius: 20px; background: #000; box-shadow: 0 12px 40px rgba(29,29,36,.18); }
.reel-wrap { position: relative; max-width: 360px; margin: 0 auto; }
.sound-on { position: absolute; top: 20px; right: 12px; border: 0; border-radius: 99px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 500; background: rgba(255,255,255,.92); color: var(--gray-900); box-shadow: 0 4px 14px rgba(29,29,36,.2); cursor: pointer; }
.sound-on[hidden] { display: none; }
.share-row { display: flex; gap: 10px; }
.share-row .btn { flex: 1; width: auto; min-width: 0; }
.circle-btn { flex: none; width: 56px; height: 56px; border-radius: 99px; border: 0; padding: 0; display: grid; place-items: center; background: #fff; color: var(--gray-900); box-shadow: inset 0 0 0 1px var(--gray-300); cursor: pointer; transition: background .3s; }
.circle-btn:hover { background: var(--accent-50); }
.circle-btn:focus-visible { outline: 2px solid var(--accent-300); outline-offset: 2px; }
.circle-btn svg { fill: none; stroke: currentColor; stroke-width: 1.75; }
.circle-btn svg .dot, .circle-btn svg .solid { fill: currentColor; stroke: none; }
.link-row { display: flex; justify-content: center; align-items: center; gap: 2px; margin: 0; color: var(--gray-300); font-size: 14px; }
.text-link { border: 0; padding: 4px 8px; background: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--gray-700); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-link:focus-visible { outline: 2px solid var(--accent-300); border-radius: 6px; }
.qr-dialog { width: calc(100% - 32px); max-width: 320px; border: 0; border-radius: 20px; padding: 24px; background: #fff; color: var(--gray-900); text-align: center; box-shadow: 0 12px 40px rgba(29,29,36,.25); }
.qr-dialog::backdrop { background: rgba(29,29,36,.55); }
.qr-code svg { display: block; width: 100%; height: auto; }
.qr-dialog p { margin: 16px 0; font-size: 14px; color: var(--gray-700); overflow-wrap: anywhere; }
.actions { display: grid; gap: 10px; max-width: 360px; margin: 0 auto; }
.caption-box { max-width: 360px; margin: 20px auto 0; background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 1px 2px rgba(29,29,36,.06); }
.caption-box p { margin: 0 0 14px; font-size: 16px; line-height: 1.55; white-space: pre-line; }
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.cap-head .cap-tabs { margin-left: auto; }
.icon-btn { flex: none; width: 34px; height: 34px; border-radius: 99px; border: 0; padding: 0; display: grid; place-items: center; background: var(--gray-100); color: var(--gray-900); cursor: pointer; transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--accent-50); }
.icon-btn:focus-visible { outline: 2px solid var(--accent-300); outline-offset: 2px; }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i-check, .icon-btn.done .i-copy { display: none; }
.icon-btn.done .i-check { display: block; }
.icon-btn.done { background: var(--accent-500); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cap-head > span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); }
.cap-tabs { display: flex; gap: 4px; background: var(--gray-100); border-radius: 99px; padding: 3px; }
.cap-tab { border: 0; background: transparent; border-radius: 99px; padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 500; color: var(--gray-700); cursor: pointer; }
.cap-tab.on { background: #fff; color: var(--gray-900); box-shadow: 0 1px 3px rgba(29,29,36,.12); }
.overlay { position: fixed; inset: 0; background: rgba(255,251,248,.96); display: grid; place-items: center; z-index: 10; }
.progress-view { width: 100%; max-width: 420px; margin: 0 auto; padding: 24px 16px; text-align: center; }
.pv-photos { position: relative; width: 180px; aspect-ratio: 9 / 14; margin: 0 auto 18px; border-radius: 18px; overflow: hidden; background: var(--accent-50); box-shadow: 0 12px 32px rgba(29,29,36,.16); display: grid; place-items: center; }
.pv-photos img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity .9s ease, transform 2.4s ease; }
.pv-photos img.on { opacity: 1; transform: scale(1); }
.pv-msg { font-family: var(--serif); font-size: 21px; margin: 6px 0 14px; min-height: 30px; }
.pv-bar { height: 6px; border-radius: 99px; background: var(--accent-100); overflow: hidden; margin: 0 auto 10px; max-width: 320px; }
.pv-bar div { height: 100%; background: var(--accent-500); border-radius: 99px; transition: width .3s linear; }

/* Soundtrack: a row that opens a list of the feel's music, each with its cover */
.music { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin-top: 12px; }
.music[hidden] { display: none; }
.art { width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--accent-100); overflow: hidden; font-size: 16px; color: var(--gray-900); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art img.mark { width: 60%; height: 60%; object-fit: contain; }
.track { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border: 1px solid var(--gray-300); border-radius: 14px; background: #fff; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.track[aria-expanded="true"] { border-color: var(--gray-900); }
.track .who, .song .who { flex: 1; min-width: 0; }
.track small { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track b, .song b { display: block; font-weight: 600; font-size: 15px; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .chev { width: 8px; height: 8px; flex: none; border-right: 1.5px solid var(--gray-500); border-bottom: 1.5px solid var(--gray-500); transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.track[aria-expanded="true"] .chev { transform: translateY(2px) rotate(-135deg); }
.music .play { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--gray-900); cursor: pointer; position: relative; }
.music .play::before { content: ""; position: absolute; left: 17px; top: 14px; border-style: solid; border-width: 8px 0 8px 12px; border-color: transparent transparent transparent #fff; }
.music .play.playing::before { left: 16px; top: 15px; width: 4px; height: 14px; border: 0; border-left: 4px solid #fff; border-right: 4px solid #fff; }
.tracks { grid-column: 1 / -1; display: grid; gap: 4px; padding: 6px; border: 1px solid var(--gray-300); border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(29,29,36,.08); }
.tracks[hidden] { display: none; }
.song { display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 12px 6px 6px; border: 0; border-radius: 12px; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.song small { display: block; font-size: 12px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song.on { background: var(--accent-50); }
.song .eq { display: flex; gap: 2px; align-items: flex-end; height: 16px; width: 14px; flex: none; opacity: 0; }
.song .eq i { width: 3px; background: var(--accent-500); border-radius: 1px; height: 4px; }
.song.on .eq { opacity: 1; }
.song.on .eq i { height: 8px; }
.song.playing .eq i { animation: eq .9s ease-in-out infinite; }
.song.playing .eq i:nth-child(2) { animation-delay: -.3s; }
.song.playing .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 16px; } }
@media (prefers-reduced-motion: reduce) { .song.playing .eq i { animation: none; height: 10px; } }
.optional { font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--gray-500); }
label.gap { margin-top: 14px; }
.turnstile:not(:empty) { margin: 0 0 12px; }
