:root {
  color-scheme: dark;
  --paper: #151114;
  --paper-deep: #1c1519;
  --ink: #fff7f4;
  --muted: #bdaeb3;
  --line: rgba(255, 232, 238, 0.11);
  --accent: #ff6f91;
  --accent-dark: #ff91aa;
  --accent-soft: #3a202a;
  --surface: rgba(35, 26, 31, 0.82);
  --surface-strong: rgba(43, 31, 37, 0.94);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); scroll-behavior: smooth; }
body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 8%, rgba(123, 43, 69, 0.28), transparent 32rem),
    radial-gradient(circle at 93% 92%, rgba(91, 42, 61, 0.24), transparent 30rem),
    linear-gradient(145deg, #181216 0%, #120f11 56%, #191317 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { display: block; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(2px);
  opacity: .44;
  pointer-events: none;
}
.ambient-one { top: -14rem; right: -8rem; background: #6c263d; }
.ambient-two { bottom: -15rem; left: -10rem; background: #542635; }

.app-shell {
  width: min(100%, 33rem);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 3.5rem;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
}
.brand { justify-self: center; display: flex; align-items: center; gap: .45rem; white-space: nowrap; font-size: .88rem; font-weight: 750; letter-spacing: -.03em; }
.brand-mark { width: 2.1rem; height: 1.7rem; display: grid; place-items: center; }
.brand-mark img { width: 2.1rem; height: 1.65rem; object-fit: contain; filter: drop-shadow(0 4px 7px rgba(222, 155, 29, .28)); }
.step-count { justify-self: end; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.icon-button { width: 2.65rem; height: 2.65rem; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--surface); cursor: pointer; transition: transform .2s ease, background .2s ease; }
.icon-button:active { transform: scale(.94); }
.icon-button svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { opacity: 0; pointer-events: none; }

.progress { height: 2px; border-radius: 99px; background: rgba(238,95,121,.11); overflow: hidden; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s var(--ease); }

.screen { display: none; flex: 1; flex-direction: column; padding: 1.7rem 0 0; opacity: 0; transform: translateY(12px); }
.screen.active { display: flex; animation: screen-in .55s var(--ease) forwards; }
@keyframes screen-in { to { opacity: 1; transform: translateY(0); } }

.memory-card { overflow: hidden; border: 1px solid var(--line); border-radius: 1.8rem; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.memory-photo { aspect-ratio: 4 / 4.25; position: relative; overflow: hidden; background: linear-gradient(145deg, #3a202a, #512536 52%, #3f202b); }
.memory-photo::after { content: ""; position: absolute; inset: auto 0 0; height: 34%; background: linear-gradient(transparent, rgba(31,20,24,.16)); pointer-events: none; }
.memory-photo img { width: 100%; height: 100%; object-fit: contain; object-position: center; background: #2b1d24; animation: photo-in .8s var(--ease) both; transition: opacity .18s ease, transform .28s var(--ease); }
@keyframes photo-in { from { opacity: 0; transform: scale(1.035); } to { opacity: 1; transform: scale(1); } }
.memory-refresh { position: absolute; z-index: 3; top: .9rem; right: .9rem; width: 2.75rem; height: 2.75rem; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; display: grid; place-items: center; color: #fff8f5; background: rgba(23,16,20,.62); box-shadow: 0 8px 20px rgba(0,0,0,.22); backdrop-filter: blur(10px); cursor: pointer; transition: transform .22s var(--ease), background .2s ease; }
.memory-refresh:hover { transform: rotate(14deg) scale(1.04); background: rgba(34,23,29,.82); }
.memory-refresh:active { transform: rotate(45deg) scale(.94); }
.memory-refresh:disabled { cursor: wait; opacity: .65; }
.memory-refresh svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.memory-card.swapping .memory-photo img { opacity: 0; transform: scale(1.025); }
.memory-card.swapping #memoryCaption { opacity: 0; transform: translateY(3px); }
.placeholder-copy { position: absolute; inset: 0; width: 100%; border: 0; display: grid; place-content: center; justify-items: center; gap: .8rem; color: rgba(255,222,231,.72); background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.placeholder-copy:hover { color: rgba(255,235,240,.92); }
.placeholder-copy[hidden] { display: none; }
.placeholder-copy svg { width: 2.4rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.memory-caption { padding: 1.45rem 1.5rem 1.6rem; }
.eyebrow { margin: 0 0 .5rem; color: var(--accent-dark); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 9vw, 2.7rem); line-height: 1.05; letter-spacing: -.055em; }
.memory-caption h1 { font-size: clamp(1.75rem, 7.7vw, 2.35rem); }
.commander-title { display: flex; align-items: center; gap: .2rem; }
.commander-title img { width: 3.8rem; height: 3.65rem; flex: 0 0 auto; object-fit: contain; margin: -.55rem -.45rem -.4rem .05rem; filter: drop-shadow(0 5px 8px rgba(0,0,0,.24)); }
.commander-title span { min-width: 0; }
.memory-caption #memoryCaption { margin: 0 0 1rem; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.section-heading > p:last-child { margin: .7rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }
#memoryCaption { transition: opacity .18s ease, transform .28s var(--ease); }

.primary-button { width: 100%; min-height: 3.65rem; margin-top: auto; border: 0; border-radius: 1rem; display: flex; align-items: center; justify-content: center; gap: .6rem; color: white; background: linear-gradient(135deg, var(--accent), #f07668); box-shadow: 0 12px 26px rgba(225,74,103,.24); font-weight: 800; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, filter .2s ease; }
.screen > .primary-button { margin-top: 1.35rem; }
.primary-button:hover { filter: saturate(1.06); box-shadow: 0 15px 30px rgba(225,74,103,.3); }
.primary-button:active { transform: scale(.985); }
.primary-button svg { width: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-doodle { transform: rotate(-4deg); transition: transform .28s var(--ease); }
.primary-button:hover .button-doodle { transform: rotate(4deg) scale(1.08); }
.spark-doodle { stroke-width: 1.55 !important; }
.review-doodle { transform: rotate(3deg); }
.screen > .royal-submit { width: auto; min-height: 0; margin: 1.15rem auto 0; padding: .25rem 1rem .45rem; flex-direction: column; gap: .05rem; overflow: visible; border: 0; color: var(--muted); background: transparent; box-shadow: none; }
.screen > .royal-submit:hover { filter: none; background: transparent; box-shadow: none; }
.send-order-motion { width: 8rem; height: 7rem; object-fit: contain; filter: drop-shadow(0 7px 10px rgba(67, 20, 39, .34)); transition: transform .28s var(--ease); }
.royal-submit:hover .send-order-motion { transform: scale(1.07); }
.royal-submit:active .send-order-motion { transform: scale(.96); }
.royal-submit-caption { font-size: .76rem; font-weight: 700; letter-spacing: .025em; }

.section-heading { padding: 1.4rem .25rem 1.6rem; }
.choice-grid { display: grid; gap: .75rem; }
.choice-card { width: 100%; min-height: 5.75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1.25rem; display: flex; align-items: center; gap: 1rem; text-align: left; color: var(--ink); background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.12); cursor: pointer; transition: transform .25s var(--ease), border-color .2s ease, box-shadow .25s ease, background .2s ease; }
.choice-card:hover { transform: translateY(-2px); border-color: rgba(255,111,145,.42); box-shadow: 0 12px 28px rgba(0,0,0,.22); background: var(--surface-strong); }
.choice-card:active { transform: scale(.985); }
.choice-icon { flex: 0 0 auto; width: 3.35rem; height: 3.35rem; display: grid; place-items: center; border-radius: 1rem; color: var(--accent-dark); background: var(--accent-soft); }
.choice-icon svg { width: 1.7rem; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.choice-card:hover .choice-icon svg { transform: rotate(6deg) scale(1.08); }
.date-doodle { transform: rotate(-3deg); border-radius: 48% 42% 52% 40%; }
.dinner-doodle { transform: rotate(2deg); border-radius: 42% 52% 44% 50%; }
.brunch-doodle { transform: rotate(-2deg); border-radius: 50% 42% 46% 54%; }
.choice-card strong { display: block; margin-bottom: .25rem; font-size: 1.05rem; }
.choice-card small { color: var(--muted); font-size: .86rem; }

.pill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.pill-choice { min-height: 7rem; padding: 1.15rem .8rem; border: 1px solid var(--line); border-radius: 1.25rem; display: grid; place-content: center; justify-items: center; gap: .65rem; color: var(--ink); text-align: center; background: var(--surface); font-weight: 750; cursor: pointer; transition: transform .25s var(--ease), border-color .2s ease, background .2s ease; }
.pill-choice:hover { transform: translateY(-2px); border-color: rgba(255,111,145,.42); background: var(--surface-strong); }
.pill-choice:active { transform: scale(.975); }
.pill-choice span:first-child { font-size: 1.45rem; }

.date-card { padding: .25rem 1.2rem; border: 1px solid var(--line); border-radius: 1.45rem; background: var(--surface); box-shadow: 0 12px 34px rgba(0,0,0,.18); }
.date-card label { min-height: 5.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.date-card label span { font-weight: 780; }
.date-card input { min-width: 9rem; border: 0; outline: 0; color: var(--muted); background: transparent; text-align: right; font-size: 1rem; }
.divider { height: 1px; background: var(--line); }
.form-error { min-height: 1.4rem; margin: .65rem .25rem 0; color: #b52f4b; font-size: .86rem; }

.review-heading { text-align: center; }
.summary-card { margin-top: .5rem; padding: 1.3rem; border: 1px solid var(--line); border-radius: 1.5rem; display: flex; align-items: center; gap: 1.2rem; background: var(--surface); box-shadow: var(--shadow); }
.summary-date { flex: 0 0 auto; width: 4.4rem; height: 5rem; border-radius: 1.1rem; display: grid; place-content: center; justify-items: center; color: #fff; background: linear-gradient(145deg, var(--accent), #ef786a); }
.summary-date span { font-size: .68rem; font-weight: 850; letter-spacing: .12em; }
.summary-date strong { margin-top: .08rem; font-size: 2rem; line-height: 1; }
.summary-copy h2 { margin: 0 0 .25rem; font-size: 1.3rem; letter-spacing: -.025em; }
.summary-copy p { margin: .18rem 0; color: var(--muted); line-height: 1.35; }
.calendar-note { margin: 1.25rem .4rem 0; color: var(--muted); text-align: center; font-size: .87rem; line-height: 1.5; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: max(1.5rem, env(safe-area-inset-bottom)); width: min(calc(100% - 2rem), 30rem); padding: .85rem 1rem; border-radius: .9rem; color: white; background: rgba(39,34,36,.94); box-shadow: 0 12px 32px rgba(30,20,24,.22); text-align: center; font-size: .86rem; transform: translate(-50%, calc(100% + 4rem)); transition: transform .45s var(--ease); }
.toast.show { transform: translate(-50%, 0); }

:focus-visible { outline: 3px solid rgba(238,95,121,.34); outline-offset: 3px; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #151114; }
::-webkit-scrollbar-thumb { border: 2px solid #151114; border-radius: 99px; background: #6f3b4b; }

@media (min-width: 48rem) {
  .app-shell { min-height: 52rem; margin-block: 2rem; padding: 1.2rem 1.5rem 1.6rem; border: 1px solid var(--line); border-radius: 2.3rem; background: rgba(31,23,28,.58); box-shadow: 0 30px 100px rgba(0,0,0,.3); }
  .memory-photo { aspect-ratio: 4 / 3.4; }
}

@media (max-height: 43rem) and (orientation: landscape) {
  .app-shell { min-height: auto; }
  .memory-photo { aspect-ratio: 16 / 7; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
