:root {
  --ink: #23201d;
  --muted: #716b64;
  --line: #e7ded3;
  --paper: #fffdf9;
  --accent: #8c4b34;
  --accent-soft: #f4e7dc;
  --danger: #a23b35;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #f3eee7;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at top, #fff9ef 0, #f3eee7 42rem); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.page-shell { width: min(760px, 100%); margin: 0 auto; padding: 28px 16px 56px; }
.hero { padding: 28px 10px 26px; }
.hero__eyebrow, .step { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .14em; margin: 0 0 8px; text-transform: uppercase; }
.hero h1 { font-family: "Songti SC", STSong, serif; font-size: clamp(30px, 8vw, 48px); line-height: 1.2; margin: 0; max-width: 650px; }
.hero > p:last-child { color: var(--muted); line-height: 1.75; margin: 16px 0 0; max-width: 620px; }

.panel { background: rgba(255, 253, 249, .96); border: 1px solid rgba(140, 75, 52, .14); border-radius: 22px; box-shadow: 0 16px 45px rgba(68, 48, 35, .08); margin-top: 16px; padding: 22px; }
.panel__heading { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 20px; }
.panel h2 { font-family: "Songti SC", STSong, serif; font-size: 24px; margin: 0; }
.text-button { background: transparent; border: 0; color: var(--accent); padding: 4px 0; }
.privacy-note { background: #f8f1e9; border-radius: 14px; color: #5d554d; font-size: 14px; line-height: 1.7; margin: -4px 0 20px; padding: 14px 16px; }
.privacy-note p { margin: 0; }
.privacy-note p + p { margin-top: 8px; }

.choice-row { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin-bottom: 12px; }
.choice { background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); min-height: 44px; }
.choice.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.date-grid { display: grid; gap: 10px; grid-template-columns: 1.4fr 1fr 1fr; margin-top: 14px; }
.date-grid--two { grid-template-columns: 2fr 1fr; }
label { color: var(--muted); display: grid; font-size: 13px; gap: 7px; }
input, select, textarea { background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); outline: none; padding: 12px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(140, 75, 52, .1); }
.check-label { align-items: center; align-self: end; display: flex; min-height: 44px; }
.check-label input { accent-color: var(--accent); height: 18px; width: 18px; }

.messages { display: grid; gap: 12px; margin-bottom: 16px; max-height: 58vh; min-height: 150px; overflow: auto; padding: 2px; }
.empty-state { align-items: center; color: var(--muted); display: flex; flex-direction: column; justify-content: center; min-height: 140px; text-align: center; }
.empty-state span { color: var(--accent); font-size: 30px; }
.message { border-radius: 16px; line-height: 1.65; max-width: 88%; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; }
.message--user { background: var(--accent); color: white; justify-self: end; }
.message--assistant { background: #f4eee7; justify-self: start; }
.message--error { background: #fff0ef; color: var(--danger); justify-self: start; }
.message__meta { color: inherit; font-size: 11px; margin-top: 7px; opacity: .68; }
.composer textarea { min-height: 92px; resize: vertical; }
.privacy-hint { color: var(--danger); font-size: 12px; line-height: 1.5; margin: 8px 2px 0; }
.composer__footer { align-items: center; color: var(--muted); display: flex; font-size: 12px; justify-content: space-between; margin-top: 10px; }
.composer__actions { display: flex; gap: 8px; }
.button { background: var(--accent); border: 1px solid var(--accent); border-radius: 999px; color: white; min-width: 106px; padding: 10px 18px; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button--ghost { background: transparent; color: var(--accent); min-width: auto; }
.form-error { background: #fff0ef; border-radius: 10px; color: var(--danger); font-size: 13px; line-height: 1.5; margin: 12px 0 0; padding: 10px 12px; }

.sr-only { height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; clip: rect(0, 0, 0, 0); }

@media (max-width: 520px) {
  .page-shell { padding-left: 12px; padding-right: 12px; }
  .panel { border-radius: 18px; padding: 18px 15px; }
  .date-grid, .date-grid--two { grid-template-columns: 1fr; }
  .check-label { min-height: 34px; }
  .panel__heading { align-items: flex-start; }
  .text-button { font-size: 13px; }
  .message { max-width: 94%; }
}
