:root {
  color-scheme: light;
  --page: #fbf6f2;
  --paper: #fffdfa;
  --ink: #302322;
  --muted: #715d59;
  --wine: #713a48;
  --wine-dark: #542b35;
  --line: #e7d8d1;
  --rose: #f4e6e6;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid #a55769; outline-offset: 4px; }
h1:focus, main:focus { outline: none; }
p, h1, h2, h3 { margin: 0; }
h1,h2,h3 { line-height: 1.22; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.wrap { width: min(1160px, calc(100% - 96px)); margin-inline: auto; }
.visually-hidden, .skip:not(:focus), .clipboard-fallback {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip:focus { position: fixed; top: 12px; left: 12px; background: white; z-index: 5; padding: 10px; }
#scroll-meter { appearance: none; position: fixed; inset: 0 0 auto; display: block; width: 100%; height: 3px; border: 0; z-index: 4; background: var(--line); color: var(--wine); pointer-events: none; }
#scroll-meter::-webkit-progress-bar { background: var(--line); }
#scroll-meter::-webkit-progress-value { background: var(--wine); }
#scroll-meter::-moz-progress-bar { background: var(--wine); }
.top-inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.brand-logo { width: 180px; height: auto; aspect-ratio: var(--brand-ratio, 3 / 1); object-fit: contain; }
.top nav { display: flex; gap: clamp(12px, 3vw, 30px); align-items: center; font-size: .875rem; color: var(--muted); }
.top nav a { padding-block: 8px; white-space: nowrap; }
.top nav button { white-space: nowrap; }
.top nav a:hover, .top nav .nav-current { color: var(--wine); box-shadow: 0 1px var(--wine); }
.header-note { font-size: .85rem; letter-spacing: .06em; white-space: nowrap; }
.step-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.step-count strong { color: var(--wine-dark); font: 1.65rem Georgia,serif; }
.draft-exit { white-space: nowrap; }
.draft-exit-text { min-height: 44px; }
.footer { border-top: 1px solid var(--line); margin-top: 60px; padding-block: 25px 32px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; font-size: .875rem; color: var(--muted); }
#footer-nav { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
#footer-nav a:hover { text-decoration: underline; }
#footer-nav .quiet { min-height: 0; padding: 2px 5px; }
.eyebrow { font: 600 .78rem/1.4 var(--sans); color: var(--wine); letter-spacing: .18em; text-transform: uppercase; }
.muted { color: var(--muted); }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 6px; padding: 9px 19px; border: 1px solid transparent; border-radius: 8px; font-weight: 600; font-size: .9rem; white-space: nowrap; transition: background .15s, border-color .15s; }
.primary { background: var(--wine); color: white; border-color: var(--wine); }
.primary:hover:not(:disabled) { background: var(--wine-dark); border-color: var(--wine-dark); }
.outline { background: transparent; color: var(--wine); border-color: #c6a7aa; }
.outline:hover:not(:disabled), .quiet:hover:not(:disabled) { background-color: var(--rose); }
.quiet { display: inline-flex; align-items: center; background: transparent; padding: 8px 9px; border: 0; color: var(--wine); border-radius: 6px; font-weight: 600; min-height: 40px; font-size: .875rem; }

.survey-home { display: grid; grid-template-columns: minmax(0,1.24fr) minmax(0,.76fr); gap: clamp(36px,7vw,92px); padding-block: clamp(68px,9vw,126px) 58px; align-items: start; }
.home-copy h1 { color: var(--wine-dark); font: 600 clamp(2.6rem,5.3vw,4.75rem)/1.19 var(--serif); letter-spacing: -.035em; margin-top: 20px; }
.home-copy h1 > span { color: var(--wine); }
.home-lead { max-width: 30em; margin-top: 26px; color: var(--muted); line-height: 1.8; }
.home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.draft-line { color: var(--muted); font-size: .875rem; margin-top: 13px; }
.home-notes { margin-top: 18px; }
.home-notes summary { color: var(--wine); cursor: pointer; font-weight: 600; }
.home-notes p { color: var(--muted); margin-top: 10px; max-width: 38em; }
.chapter-index { margin: clamp(74px,12vw,168px) 0 0; padding: 0; list-style: none; }
.chapter-index li { display: flex; align-items: baseline; gap: 15px; padding: 15px 0; border-top: 1px solid var(--line); }
.chapter-number { flex: 0 0 24px; color: var(--wine); font: .875rem Georgia,serif; }
.chapter-index strong { display: block; font: 600 1.35rem/1.4 var(--serif); }
.chapter-index small { display: block; margin-top: 3px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; }

.survey-layout { padding-block: 44px 30px; }
.survey-column { width: min(100%, 44rem); margin-inline-start: 5%; }
.section-meter { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 8px; margin-bottom: 34px; }
.section-meter span { height: 4px; background: var(--line); }
.section-meter .filled { background: var(--wine); }
.form-heading { margin-bottom: 32px; }
.form-heading h1, .success h1, .survey-success h1, .planner h1 { margin: 12px 0; font: 600 clamp(2.1rem,4.6vw,3.65rem)/1.18 var(--serif); color: var(--wine-dark); }
.question { min-width: 0; margin: 0; border-top: 1px solid var(--line); padding: 23px 0 24px; }
.question fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.question fieldset legend { float: left; width: 100%; }
.question fieldset > :not(legend) { clear: both; }
.question-title, legend, .review-fields label, .filters label, .followup label { display: block; font-weight: 650; margin: 0 0 8px; padding: 0; }
input:not([type=checkbox],[type=radio],[type=file]), textarea, select {
  display: block; width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid #d9c6c1;
  background: white; border-radius: 7px; font-weight: 400;
}
textarea { resize: vertical; }
.survey-column :is(input:not([type=checkbox],[type=radio],[type=file]),textarea) { background: #f6ece8; border: 0; border-bottom: 1px solid #b99696; border-radius: 4px 4px 0 0; }
.survey-column :is(input,textarea):focus { border-bottom-color: var(--wine); }
input::placeholder, textarea::placeholder { color: #806b66; opacity: 1; }
input[type=checkbox], input[type=radio] { inline-size: 18px; block-size: 18px; accent-color: var(--wine); margin: 0; flex: none; }
.options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.option { display: flex; cursor: pointer; align-items: center; gap: 8px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; font-size: .9rem; }
.option:has(input:checked), .option:hover { background: var(--rose); border-color: #ba8d97; }
.clear-option { margin-top: 4px; }
.other-detail { margin-top: 12px; }
.other-detail label { display: block; margin-bottom: 5px; color: var(--wine-dark); font-size: .875rem; font-weight: 600; }
.timeline { display: grid; gap: 10px; }
.timeline-row { display: grid; grid-template-columns: 54px repeat(3,minmax(0,1fr)); align-items: end; gap: 8px; padding: 11px; border-radius: 7px; background: #faf2ef; }
.timeline-row strong { align-self: center; }
.timeline-row label > span { display: block; color: var(--muted); font-size: .875rem; }
.timeline-row label { min-width: 0; }
input[type=file] { display: block; width: 100%; margin-top: 12px; }
input::file-selector-button { border: 1px solid #c6a7aa; border-radius: 6px; background: var(--rose); color: var(--wine); padding: 8px; margin-right: 10px; cursor: pointer; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; background: #faf2ef; padding: 4px 10px; border-radius: 7px; overflow-wrap: anywhere; }
.form-actions { display: flex; gap: 12px; justify-content: space-between; margin-top: 22px; }
.form-draft { text-align: right; }
.form-error { color: #8f283a; background: #fae8eb; border-radius: 7px; padding: 10px; margin-top: 12px; }
.review-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.review-fields input, .filters :is(input,select), .followup :is(select,textarea) { margin-top: 5px; }
.consent { display: flex; cursor: pointer; align-items: flex-start; gap: 10px; color: var(--muted); border-top: 1px solid var(--line); padding-block: 20px; }
.consent input { margin-top: 4px; }
.success { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: clamp(24px,6vw,60px); max-width: 680px; margin: 46px auto 0; text-align: center; }
.survey-success { padding-block: 18px 36px; }
.receipt { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; max-width: 32rem; margin: 28px 0; border-block: 1px solid #b99696; padding: 12px 0; }
.receipt dt { color: var(--muted); font-size: .875rem; }
.receipt dd { margin: 2px 0 0; font: 1.55rem Georgia,serif; color: var(--wine); letter-spacing: .08em; }
.success-actions, .planner-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.success-actions { justify-content: center; margin-top: 22px; }
.survey-success .success-actions { justify-content: flex-start; }

.planner { margin-top: 34px; }
.planner-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.planner-overview { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 24px; }
.overview-card { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--muted); text-align: left; }
.overview-card strong { font: 1.9rem/1 Georgia,serif; color: var(--wine-dark); font-variant-numeric: tabular-nums; }
.overview-card[aria-pressed=true], .overview-card:hover { background: var(--rose); border-color: #c6a7aa; }
.planner-records { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 18px; }
.records-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.records-heading h2 { color: var(--wine-dark); font-size: 1.25rem; }
.records-heading p { margin-top: 3px; font-size: .875rem; }
.planner-actions [aria-disabled=true] { opacity: .5; }
.filters { border: 1px solid var(--line); background: var(--page); padding: 12px; border-radius: 9px; display: grid; grid-template-columns: minmax(120px,1fr) minmax(90px,150px) minmax(90px,150px) auto auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.filters label, .followup label { margin: 0; font-size: .9rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
table { border-collapse: collapse; width: 100%; min-width: 710px; text-align: left; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); }
th { background: #f6e9e7; color: var(--wine-dark); font-size: .875rem; }
td { overflow-wrap: anywhere; font-size: .9rem; }
td small { display: block; color: var(--muted); }
.status { white-space: nowrap; color: var(--wine); }
.empty { padding: 32px 18px; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; color: var(--muted); text-align: center; }
.pager { display: flex; justify-content: center; align-items: center; margin-top: 12px; gap: 12px; }
dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 13px; width: min(720px,calc(100% - 30px)); max-height: calc(100dvh - 40px); padding: 0; }
dialog::backdrop { background: #30232288; }
.detail-header, .answer-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; padding: 14px 24px; z-index: 1; }
.detail-header h2 { margin-top: 3px; font: 600 1.8rem var(--serif); overflow-wrap: anywhere; }
.detail-content { padding: 20px 24px; }
.contact { margin: 10px 0; overflow-wrap: anywhere; }
.followup { border: 1px solid var(--line); background: var(--page); padding: 14px; border-radius: 7px; display: grid; gap: 10px; }
.followup .button { justify-self: start; }
.answer-header { margin: 16px 0 4px; }
.answer-block { border-top: 1px solid var(--line); padding: 12px 0; }
.answer-block summary { cursor: pointer; font-weight: 650; }
.answer-block small { color: var(--muted); font-size: .875rem; margin-left: 5px; }
.answer-block dt { font-weight: 650; margin: 8px 0 2px; }
.answer-block dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.attachments { border-top: 1px solid var(--line); padding-top: 14px; }
.attachments > div { display: grid; grid-template-columns: repeat(auto-fit,minmax(100px,1fr)); gap: 10px; margin-top: 9px; }
.attachments a { display: block; overflow-wrap: anywhere; font-size: .875rem; }
.attachments img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 7px; }
#toast { position: fixed; bottom: max(18px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); z-index: 3; background: var(--wine-dark); color: white; padding: 10px 16px; border-radius: 8px; text-align: center; }

@media(max-width: 850px) {
  .wrap { width: calc(100% - 48px); }
  .survey-home { grid-template-columns: minmax(0,1fr); gap: 39px; padding-block: 54px 12px; }
  .chapter-index { margin-top: 0; }
  .survey-column { margin-inline-start: 0; }
}
@media(max-width: 560px) {
  .wrap { width: calc(100% - 40px); }
  .top-inner { min-height: 66px; }
  .top-inner { gap: 8px; }
  .brand-logo { width: min(34vw,145px); }
  .top nav { gap: 7px; }
  .header-note { font-size: .75rem; }
  .step-count strong { font-size: 1.3rem; }
  .edition-note { display: none; }
  .survey-home { padding-top: 42px; }
  .survey-layout { padding-top: 24px; }
  .section-meter { margin-bottom: 26px; }
  .options, .review-fields { grid-template-columns: 1fr; }
  .review-fields label { margin-bottom: 0; }
  .timeline-row { grid-template-columns: 1fr; }
}
@media(max-width: 720px) {
  .planner-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .planner-records { padding: 12px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:first-child { grid-column: 1 / -1; }
  .detail-header, .detail-content { padding-inline: 14px; }
}
@media(prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; }
}
