:root {
  color-scheme: light;
  --ink: #3f446b;
  --ink-strong: #34395f;
  --ink-soft: rgba(63, 68, 107, .63);
  --ink-faint: rgba(63, 68, 107, .45);
  --cream: #fff1d7;
  --paper: rgba(255, 249, 238, .36);
  --paper-strong: rgba(255, 249, 238, .62);
  --line: rgba(255, 241, 215, .56);
  --line-soft: rgba(63, 68, 107, .15);
  --peach: #dcaeaa;
  --gold: #edc987;
  --ok: #658879;
  --warn: #9c665d;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; margin: 0; }
html {
  background:
    radial-gradient(76% 40% at 48% 8%, rgba(255, 241, 215, .4), transparent 72%),
    radial-gradient(80% 48% at 96% 42%, rgba(239, 199, 189, .62), transparent 68%),
    radial-gradient(86% 56% at 0% 76%, rgba(153, 153, 202, .7), transparent 68%),
    linear-gradient(180deg, #999dcb 0%, #baacd0 36%, #dab5c0 72%, #efcdbf 100%);
}
body {
  min-width: 320px;
  color: var(--ink);
  font-family: var(--sans);
  background: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, textarea, select { font-size: 16px; }

.skip-link {
  position: fixed;
  left: 14px;
  top: -70px;
  z-index: 100;
  min-height: 44px;
  padding: 9px 13px;
  border-radius: 999px;
  color: #fff7e9;
  background: rgba(58, 57, 92, .94);
}
.skip-link:focus { top: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  position: relative;
  isolation: isolate;
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
}
.app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(60% 34% at 50% 20%, rgba(255, 248, 230, .38), transparent 76%);
}

.nav {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 60px;
  padding: max(12px, env(safe-area-inset-top)) 20px 4px;
}
.back {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px 5px 0;
  border: 0;
  color: rgba(63, 68, 107, .62);
  background: transparent;
  font-size: 28px;
  line-height: 1;
  text-align: left;
}
.brand { display: grid; min-height: 44px; place-items: center; color: inherit; text-align: center; text-decoration: none; }
.brand span { display: block; font-family: var(--serif); font-size: 18px; font-weight: 300; letter-spacing: .18em; text-indent: .18em; }
.brand small { display: none; }
.step-pill { justify-self: end; min-width: 40px; color: rgba(63, 68, 107, .56); font-size: 11px; text-align: right; }

.screen {
  display: none;
  min-height: calc(100svh - 60px);
  padding: 0 20px max(30px, env(safe-area-inset-bottom));
  animation: rise .45s ease;
}
.screen.active { display: flex; flex-direction: column; }
.screen[hidden] { display: none !important; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow { margin: 34px 0 11px; color: rgba(63, 68, 107, .52); font-size: 11px; letter-spacing: .18em; text-align: center; }
h1, h2, h3 { color: var(--ink-strong); font-family: var(--serif); font-weight: 300; }
h1 { margin: 0; font-size: 30px; line-height: 1.36; letter-spacing: .03em; text-align: center; }
.lead { width: min(100%, 334px); margin: 12px auto 0; color: var(--ink-soft); font-size: 14px; line-height: 1.72; text-align: center; }
.glass {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 249, 238, .58), rgba(255, 249, 238, .23));
  box-shadow: 0 20px 50px rgba(67, 66, 110, .13), inset 0 1px 0 rgba(255, 255, 255, .5);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.curve-area { display: block; }
.curve-area[hidden] { display: none; }
.curve-card { margin-top: 24px; padding: 15px 12px 9px; border-radius: 24px; }
#miniCurve { display: block; width: 100%; height: 132px; }
.moments { display: grid; gap: 10px; margin-top: 14px; }
.moment-option {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 241, 215, .44);
  border-radius: 20px;
  color: inherit;
  background: rgba(255, 249, 238, .26);
  text-align: left;
}
.moment-option:hover:not(:disabled) { background: rgba(255, 249, 238, .38); }
.moment-option.selected { border-color: rgba(255, 241, 215, .94); background: rgba(255, 241, 215, .5); box-shadow: 0 10px 28px rgba(84, 73, 127, .13); }
.moment-option:disabled { opacity: .62; }
.moment-age { color: rgba(63, 68, 107, .68); font-family: var(--serif); font-size: 17px; }
.moment-event { min-width: 0; }
.moment-event strong { display: block; overflow-wrap: anywhere; font-size: 14px; font-weight: 500; line-height: 1.5; }
.moment-event small { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 10px; line-height: 1.45; }
.moment-check { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid rgba(63, 68, 107, .24); border-radius: 50%; }
.moment-option.selected .moment-check { border-color: rgba(201, 141, 124, .7); background: rgba(255, 241, 215, .8); }
.moment-option.selected .moment-check::after { content: "✓"; color: #b47767; font-size: 12px; }
.moment-state { color: rgba(112, 76, 88, .72); font-size: 11px; white-space: nowrap; }
.empty-copy { margin: 15px 3px 0; color: var(--ink-soft); font-size: 12px; line-height: 1.7; text-align: center; }

.fallback { margin-top: 26px; padding: 22px 18px; border-radius: 24px; }
.fallback-label { margin: 0 0 8px; color: var(--ink-faint); font-size: 11px; letter-spacing: .1em; }
.fallback h2 { margin: 0; font-size: 22px; line-height: 1.45; }
.fallback > p:not(.fallback-label) { margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.fallback-fields { display: grid; grid-template-columns: 78px 1fr; gap: 13px 12px; margin-top: 12px; }
.field { min-width: 0; }
.field span { display: block; margin-bottom: 4px; color: var(--ink-faint); font-size: 10px; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 2px 10px;
  border: 0;
  border-bottom: 1px solid rgba(63, 68, 107, .22);
  border-radius: 0;
  outline: none;
  background: transparent;
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(255, 241, 215, .94); box-shadow: 0 2px 0 rgba(255, 241, 215, .54); }
.fallback .field:nth-child(3) { grid-column: 1 / -1; }
.fallback .field:nth-child(4) { grid-column: 1 / -1; }

.archive-card { margin-top: 18px; padding: 17px; border-radius: 24px; }
.archive-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.archive-heading p { margin: 0 0 4px; color: var(--ink-faint); font-size: 10px; letter-spacing: .12em; }
.archive-heading h2 { margin: 0; font-size: 20px; }
.archive-heading > span { color: var(--ink-faint); font-size: 11px; }
.archive-list { display: grid; gap: 8px; margin-top: 13px; }
.archive-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 241, 215, .4);
  border-radius: 17px;
  color: inherit;
  background: rgba(255, 249, 238, .24);
  text-align: left;
}
.archive-item strong { display: block; font-family: var(--serif); font-size: 15px; font-weight: 300; }
.archive-item small { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 10px; }
.status-chip { padding: 5px 8px; border: 1px solid rgba(255, 241, 215, .5); border-radius: 999px; color: var(--ink-soft); background: rgba(255, 249, 238, .3); font-size: 10px; white-space: nowrap; }
.status-chip.waiting { color: #7d5c58; }
.status-chip.delivered { color: var(--ok); }

.sticky-action { margin-top: auto; padding-top: 20px; }
.sticky-action p { margin: 0 0 10px; color: var(--ink-faint); font-size: 11px; text-align: center; }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
}
.primary-button { border: 0; color: #55466d; background: linear-gradient(180deg, #fff1d7, #edc9bc 66%, #c4b2d3); box-shadow: 0 14px 34px rgba(107, 79, 121, .22), inset 0 1px 0 rgba(255, 255, 255, .74); font-size: 16px; letter-spacing: .04em; }
.primary-button:hover:not(:disabled) { filter: brightness(1.035); }
.primary-button:disabled { opacity: .48; box-shadow: none; }
.secondary-button { border: 1px solid rgba(255, 241, 215, .5); color: var(--ink); background: rgba(255, 249, 238, .27); }
.secondary-button:hover:not(:disabled) { background: rgba(255, 249, 238, .42); }
.secondary-button.compact { width: auto; min-height: 44px; padding: 8px 13px; font-size: 11px; }
.text-button { min-height: 44px; padding: 5px 8px; border: 0; color: var(--ink-soft); background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.qa-button { width: auto; min-height: 36px; margin: 9px auto 0; padding: 7px 11px; border: 1px dashed rgba(156, 102, 93, .7); border-radius: 999px; color: #704e59; background: rgba(255, 249, 238, .28); font-size: 10px; }
.notice { margin: 5px 20px 10px; padding: 11px 13px; border-radius: 16px; font-size: 12px; }
.notice.error { color: var(--warn); background: rgba(255, 241, 215, .52); }

.question-progress { margin-top: 22px; color: var(--ink-faint); font-size: 10px; letter-spacing: .08em; }
.progress-track { height: 3px; margin-top: 9px; overflow: hidden; border-radius: 3px; background: rgba(255, 249, 238, .25); }
.progress-fill { width: 16.666%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--cream), var(--gold)); transition: width .35s ease; }
.opening-note { margin-top: 16px; padding: 12px 14px; border-radius: 18px; }
.opening-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0; border: 0; color: var(--ink-soft); background: transparent; font-size: 11px; text-align: left; }
.opening-note p { margin: 8px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.72; }
.opening-note.collapsed p { display: none; }
.context { margin: 24px 0 8px; color: rgba(63, 68, 107, .54); font-size: 12px; letter-spacing: .05em; text-align: center; }
.question { max-width: 360px; margin: 0 auto; font-size: 26px; line-height: 1.48; text-align: center; }
.question-help { max-width: 340px; margin: 11px auto 0; color: var(--ink-soft); font-size: 11px; line-height: 1.6; text-align: center; }
.record-card { margin-top: 25px; padding: 22px 18px 18px; border-radius: 28px; text-align: center; }
.record-button {
  position: relative;
  width: 92px;
  height: 92px;
  padding: 0;
  border: 1px solid rgba(255, 241, 215, .72);
  border-radius: 50%;
  background: radial-gradient(circle at 48% 38%, #fff5df, #e9bebb 66%, #b6a6cf);
  box-shadow: 0 18px 42px rgba(86, 66, 116, .22), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.record-button::before { content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 30px; transform: translate(-50%, -55%); border: 3px solid rgba(74, 68, 105, .72); border-radius: 14px; }
.record-button::after { content: ""; position: absolute; left: 50%; top: 61%; width: 34px; height: 17px; transform: translateX(-50%); border: 3px solid rgba(74, 68, 105, .72); border-top: 0; border-radius: 0 0 18px 18px; }
.record-card.recording .record-button { animation: pulse 1.4s infinite; background: radial-gradient(circle at 48% 38%, #fff0df, #dc9e9c 70%, #b798c8); }
.record-card.recording .record-button::before { width: 24px; height: 24px; border: 0; border-radius: 6px; background: rgba(105, 62, 79, .72); transform: translate(-50%, -50%); }
.record-card.recording .record-button::after { display: none; }
.record-label, .record-dot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(255, 241, 215, .14), 0 18px 42px rgba(86, 66, 116, .22); } }
.timer { margin-top: 12px; font-size: 20px; letter-spacing: .08em; }
.record-hint { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; }
.record-status { min-height: 20px; margin: 7px 0 0; color: rgba(63, 68, 107, .56); font-size: 11px; line-height: 1.55; }
.upload-progress { margin: 12px auto 0; }
.upload-progress-bar { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255, 249, 238, .28); }
.upload-progress-bar span { display: block; width: 8%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cream), var(--gold)); transition: width .2s ease; }
.upload-progress > span { display: block; margin-top: 6px; color: var(--ink-faint); font-size: 10px; }
.record-recovery { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 10px; }
.recorder-note { max-width: 340px; margin: 13px auto 0; color: var(--ink-faint); font-size: 10px; line-height: 1.65; }
.question-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: auto; padding-top: 20px; }

.waiting-screen { padding-inline: 20px; }
.waiting-content { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 25px 0 35px; }
.orb { width: 112px; height: 112px; margin: 0 auto 28px; border-radius: 50%; background: radial-gradient(circle at 46% 42%, #fff5d9 0 12%, rgba(255, 232, 198, .74) 28%, rgba(219, 168, 194, .58) 56%, rgba(149, 143, 198, .18) 73%, transparent 74%); filter: drop-shadow(0 0 34px rgba(255, 224, 184, .55)); animation: breathe 2.7s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); filter: drop-shadow(0 0 44px rgba(255, 224, 184, .7)); } }
.waiting-content .eyebrow { margin: 0 0 11px; }
.waiting-content h1 { font-size: 28px; }
.ready-panel { display: grid; margin-top: 24px; padding: 17px; border-radius: 22px; }
.ready-panel span, .ready-panel small { color: var(--ink-soft); font-size: 11px; }
.ready-panel strong { margin: 7px 0; font-family: var(--serif); font-size: 18px; font-weight: 300; }
.waiting-content > .secondary-button { margin-top: 13px; }

.story-screen { padding-bottom: 24px; }
.story-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 18px 0 14px; }
.story-heading .eyebrow { margin: 0 0 5px; text-align: left; }
.story-heading h1 { font-size: 28px; text-align: left; }
.version-badge { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: rgba(255, 249, 238, .28); font-size: 10px; }
.story-card { position: relative; padding: 30px 25px 25px; overflow: hidden; border-radius: 30px; }
.story-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 32% at 88% 5%, rgba(255, 241, 215, .46), transparent 80%); }
.archive-mark { position: absolute; top: 18px; right: 21px; display: grid; color: rgba(109, 75, 85, .67); font-size: 8px; letter-spacing: .15em; text-align: right; }
.archive-mark b { margin-top: 2px; font-family: var(--serif); font-size: 10px; font-weight: 300; }
.story-kicker { position: relative; margin: 0 0 13px; color: rgba(63, 68, 107, .5); font-size: 10px; letter-spacing: .18em; }
.story-card h2 { position: relative; max-width: 88%; margin: 0; font-size: 27px; line-height: 1.4; }
.story-body { position: relative; margin: 18px 0 22px; color: rgba(52, 57, 95, .85); font-family: var(--serif); font-size: 15px; line-height: 2; text-align: justify; white-space: pre-line; }
.story-signature { position: relative; margin: 0; padding-top: 16px; border-top: 1px solid rgba(63, 68, 107, .13); color: rgba(63, 68, 107, .55); font-size: 12px; text-align: right; }
.story-actions { display: grid; gap: 9px; margin-top: 14px; }
.upgrade-card { margin-top: 14px; padding: 18px 17px; border-radius: 22px; }
.upgrade-card > p:first-child { margin: 0 0 5px; color: var(--ink-faint); font-size: 10px; letter-spacing: .1em; }
.upgrade-card h2 { margin: 0; font-size: 20px; line-height: 1.45; }
.upgrade-card #upgradeCopy { margin: 8px 0 13px; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.archive-return { display: block; margin: 8px auto 0; }

.feedback-dialog { width: min(calc(100% - 20px), 410px); max-height: calc(100svh - 20px); padding: 0; overflow: visible; border: 0; color: var(--ink); background: transparent; }
.feedback-dialog::backdrop { background: rgba(54, 53, 87, .46); backdrop-filter: blur(6px); }
.dialog-sheet { max-height: calc(100svh - 20px); padding: 22px; overflow: auto; border-radius: 25px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 12px; }
.dialog-heading p { margin: 0 0 5px; color: var(--ink-faint); font-size: 10px; letter-spacing: .1em; }
.dialog-heading h2 { margin: 0; font-size: 24px; }
.dialog-close { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: rgba(255, 249, 238, .24); font-size: 20px; }
.dialog-intro { color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.feedback-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 16px 0; padding: 4px; border-radius: 999px; background: rgba(255, 249, 238, .25); }
.tab { min-height: 40px; border: 0; border-radius: 999px; color: var(--ink-soft); background: transparent; }
.tab.active { color: var(--ink); background: rgba(255, 241, 215, .55); box-shadow: 0 5px 16px rgba(84, 73, 127, .1); }
.feedback-panel { margin-bottom: 17px; }
.feedback-panel .field textarea { padding: 11px; border: 1px solid rgba(255, 241, 215, .5); border-radius: 16px; background: rgba(255, 249, 238, .23); }
.feedback-recorder { display: grid; justify-items: center; gap: 12px; padding: 24px 15px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 249, 238, .23); }
.dialog-error { color: var(--warn); font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); z-index: 200; max-width: calc(100% - 34px); padding: 10px 17px; border-radius: 999px; color: #fff7e9; background: rgba(58, 57, 92, .9); font-size: 12px; opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity .25s; white-space: nowrap; }
.toast.show { opacity: 1; }

[data-programmatic-focus]:focus { outline: none; }
:focus-visible { outline: 3px solid rgba(255, 241, 215, .78); outline-offset: 3px; }
@media (min-width: 700px) {
  body { padding: 18px 0; }
  .app { min-height: calc(100svh - 36px); border-radius: 32px; box-shadow: 0 24px 70px rgba(54, 53, 87, .22); }
  .screen { min-height: calc(100svh - 96px); }
}
@media (max-width: 360px) {
  .screen { padding-inline: 15px; }
  .nav { padding-inline: 15px; }
  .question { font-size: 24px; }
  .moment-option { grid-template-columns: 52px 1fr auto; padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
