:root {
  --wine: #7a263a;
  --wine-dark: #5c1c2b;
  --cream: #fbf7f0;
  --paper: #fffdf9;
  --ink: #2f2b2a;
  --muted: #746b67;
  --gold: #c99a4a;
  --green: #4e8072;
  --line: #e9ddd1;
  --shadow: 0 12px 32px rgba(77, 48, 40, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px max(20px, calc((100vw - 1120px) / 2));
  background: rgba(251, 247, 240, .94);
  border-bottom: 1px solid rgba(122, 38, 58, .08);
  backdrop-filter: blur(12px);
}
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: white;
  background: var(--wine);
  border-radius: 50% 50% 48% 52%;
  font-family: STKaiti, KaiTi, serif;
  font-size: 22px;
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.header-links { display: flex; gap: 18px; }
.privacy-link { color: var(--muted); font-size: 14px; text-decoration: none; }

main { min-height: calc(100vh - 180px); }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.narrow { width: min(720px, calc(100% - 32px)); margin: 0 auto; }
.hero { padding: 74px 0 46px; text-align: center; }
.eyebrow { color: var(--wine); font-size: 13px; font-weight: 700; letter-spacing: .22em; }
h1, h2, h3 { font-family: STKaiti, KaiTi, "Songti SC", serif; line-height: 1.25; }
h1 { margin: 15px auto; max-width: 820px; font-size: clamp(37px, 6vw, 64px); font-weight: 600; }
h2 { font-size: clamp(28px, 4vw, 40px); }
h3 { font-size: 24px; }
.lead { max-width: 700px; margin: 0 auto; color: var(--muted); font-size: 18px; }

.assessment-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; padding: 22px 0 64px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.assessment-card { position: relative; overflow: hidden; padding: 32px; }
.assessment-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--wine); }
.assessment-card.alt::before { background: var(--green); }
.assessment-card h2 { margin: 16px 0 12px; font-size: 30px; }
.pill { display: inline-flex; padding: 5px 11px; color: var(--wine); background: #f6e8e8; border-radius: 999px; font-size: 13px; font-weight: 700; }
.meta { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.card-actions { display: flex; gap: 12px; align-items: center; margin-top: 26px; }
.btn {
  min-height: 46px;
  padding: 11px 21px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--wine); }
.btn-primary:hover { background: var(--wine-dark); }
.btn-secondary { color: var(--wine); background: transparent; border-color: #d8bac1; }
.btn-ghost { color: var(--muted); background: transparent; }
.btn:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.note { padding: 20px; color: var(--muted); background: #f4eee5; border-radius: 14px; font-size: 14px; }

.intro { padding: 52px 0 72px; }
.back-link { display: inline-block; margin-bottom: 22px; color: var(--muted); text-decoration: none; }
.intro-card { padding: clamp(24px, 5vw, 46px); }
.intro-card h1 { margin-left: 0; font-size: clamp(34px, 5vw, 50px); }
.instruction-list { padding-left: 22px; color: var(--muted); }
.consent { display: flex; gap: 12px; align-items: flex-start; margin: 24px 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.consent input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--wine); }
.preview-tools { display: grid; gap: 7px; margin-top: 14px; padding-top: 14px; text-align: center; border-top: 1px dashed var(--line); }
.preview-tools small { color: var(--muted); }
.preview-banner { margin: 18px 0 0; padding: 13px 16px; color: #6c4c13; background: #fff3d8; border: 1px solid #ead39e; border-radius: 12px; font-size: 14px; }

.profile-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.profile-section h2 { margin: 0 0 4px; font-family: inherit; font-size: 21px; }
.profile-section > p { margin: 0; color: var(--muted); font-size: 14px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 700; }
.field label em { color: var(--wine); font-size: 12px; font-style: normal; }
.field label span, .field small { color: var(--muted); font-size: 12px; font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #d8cdc3;
  border-radius: 10px;
}
.field textarea { min-height: 120px; resize: vertical; }

.take-page { padding: 26px 0 70px; }
.progress-wrap { position: sticky; top: 69px; z-index: 5; padding: 15px 0 12px; background: var(--cream); }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.progress { height: 7px; overflow: hidden; background: #eadfd5; border-radius: 99px; }
.progress > span { display: block; width: 0; height: 100%; background: var(--wine); border-radius: inherit; transition: width .25s ease; }
.question-card { margin-top: 28px; padding: clamp(25px, 5vw, 42px); }
.question-index { color: var(--wine); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.question-card h2 { margin: 13px 0 30px; font-family: inherit; font-size: clamp(23px, 4vw, 30px); font-weight: 700; }
.choices { display: grid; gap: 12px; }
.choice {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 55px;
  padding: 13px 16px;
  color: var(--ink);
  text-align: left;
  background: white;
  border: 1px solid #dcd0c6;
  border-radius: 13px;
  cursor: pointer;
}
.choice:hover { border-color: #b78691; }
.choice.selected { color: var(--wine-dark); background: #f8ebed; border-color: var(--wine); box-shadow: 0 0 0 2px rgba(122,38,58,.08); }
.choice-key { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; color: var(--wine); background: #f6e8e8; border-radius: 9px; font-weight: 800; }
.relation-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.relation-choice { min-height: 42px; padding: 9px 12px; gap: 9px; }
.relation-choice input { flex: 0 0 16px; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--wine); }
.relation-choice span { color: var(--ink); font-size: 16px; line-height: 1.45; }
.question-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.skip-banner { margin: 18px 0 -6px; padding: 12px 16px; color: #355e53; background: #e9f2ef; border-radius: 12px; font-size: 14px; }

.result-page { padding: 44px 0 80px; }
.result-hero { padding: clamp(27px, 5vw, 45px); }
.result-hero h1 { margin-left: 0; font-size: clamp(36px, 5vw, 52px); }
.summary { font-size: 18px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.section-title { margin: 42px 0 18px; }
.bars { display: grid; gap: 14px; padding: 26px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 74px; gap: 14px; align-items: center; }
.bar-label { font-weight: 700; }
.bar-track { height: 13px; overflow: hidden; background: #eee4da; border-radius: 99px; }
.bar-fill { height: 100%; background: var(--wine); border-radius: inherit; }
.bar-fill.green { background: var(--green); }
.bar-value { color: var(--muted); text-align: right; font-size: 14px; }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.result-card { padding: 24px; }
.result-card h3 { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.status { display: inline-flex; padding: 4px 9px; color: var(--wine); background: #f7e9eb; border-radius: 99px; font-family: inherit; font-size: 12px; white-space: nowrap; }
.subscores { display: grid; gap: 8px; margin-top: 16px; }
.subscore { display: flex; justify-content: space-between; gap: 14px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.belief { margin: 8px 0; color: var(--muted); }
.belief strong { color: var(--ink); }
.profile-report { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 24px; padding: 20px 24px; }
.profile-report > div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.profile-report span { color: var(--muted); }
.answer-intro { margin: -8px 0 16px; color: var(--muted); }
.answer-table-wrap { overflow-x: auto; }
.answer-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 14px; }
.answer-table th, .answer-table td { padding: 13px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.answer-table th { color: var(--wine-dark); background: #f6eee6; white-space: nowrap; }
.answer-table th:first-child, .answer-table td:first-child { width: 72px; }
.answer-table th:nth-child(2), .answer-table td:nth-child(2) { width: 145px; }
.answer-table th:last-child, .answer-table td:last-child { width: 160px; }
.pdf-render-root { position: fixed; z-index: -1000; top: 0; left: -12000px; width: 794px; background: white; }
.pdf-sheet { position: relative; width: 794px; min-height: 1123px; padding: 54px 58px 62px; color: #2f2b2a; background: white; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; box-sizing: border-box; }
.pdf-sheet h1 { margin: 30px 0 18px; color: #5c1c2b; font-family: STKaiti, KaiTi, serif; font-size: 34px; }
.pdf-sheet h2 { margin: 25px 0 12px; color: #5c1c2b; font-family: inherit; font-size: 21px; }
.pdf-sheet h3 { margin: 0 0 7px; color: #5c1c2b; font-family: inherit; font-size: 17px; }
.pdf-sheet p { margin: 8px 0; }
.pdf-head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 12px; border-bottom: 2px solid #7a263a; }
.pdf-head div { display: grid; }
.pdf-head strong { color: #7a263a; font-size: 19px; }
.pdf-head span, .pdf-head small { color: #746b67; font-size: 11px; }
.pdf-summary, .pdf-disclaimer, .pdf-open { padding: 15px 17px; background: #fbf7f0; border-left: 4px solid #c99a4a; }
.pdf-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.pdf-sheet th, .pdf-sheet td { padding: 9px 10px; text-align: left; vertical-align: top; border: 1px solid #d8cdc3; overflow-wrap: anywhere; }
.pdf-sheet th { color: #5c1c2b; background: #f4e9df; }
.pdf-result-card { margin-bottom: 13px; padding: 14px 16px; border: 1px solid #dfd3c9; border-radius: 8px; }
.pdf-result-card > div { display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid #eee4da; font-size: 12px; }
.pdf-answers th:nth-child(1) { width: 8%; }
.pdf-answers th:nth-child(2) { width: 20%; }
.pdf-answers th:nth-child(3) { width: 48%; }
.pdf-answers th:nth-child(4) { width: 24%; }
.pdf-answers td { padding: 11px 9px; font-size: 11.5px; line-height: 1.55; }
.pdf-foot { position: absolute; right: 58px; bottom: 25px; left: 58px; padding-top: 8px; color: #8b817c; text-align: center; border-top: 1px solid #e6ddd5; font-size: 9px; }
.privacy-page { padding: 48px 0 80px; }
.privacy-page .card { padding: clamp(24px, 5vw, 46px); }
.admin-page { padding: 44px 0 80px; }
.admin-login { max-width: 520px; margin: 0 auto; padding: clamp(26px, 5vw, 44px); }
.admin-login h1, .admin-head h1, .admin-detail-head h1 { margin: 15px 0 8px; font-size: clamp(34px, 5vw, 48px); }
.admin-login > p, .admin-head p, .admin-detail-head p { color: var(--muted); }
.admin-login-form { display: grid; gap: 16px; margin-top: 26px; }
.form-message { min-height: 24px; margin: 0; color: var(--wine); font-size: 14px; }
.admin-loading { padding: 70px 20px; color: var(--muted); text-align: center; }
.admin-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 24px; }
.admin-head .back-link { margin-bottom: 28px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.admin-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; align-items: end; padding: 16px 20px; margin-bottom: 12px; }
.admin-toolbar .field { width: min(420px, 100%); }
.admin-toolbar > span { color: var(--muted); white-space: nowrap; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; min-width: 880px; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 14px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--wine-dark); background: #f6eee6; white-space: nowrap; }
.admin-table td small { display: block; max-width: 160px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.admin-empty { padding: 34px !important; color: var(--muted); text-align: center !important; }
.preference { display: inline-flex; padding: 4px 9px; color: #355e53; background: #e9f2ef; border-radius: 999px; white-space: nowrap; }
.preference.no { color: var(--wine-dark); background: #f7e9eb; }
.data-kind { display: inline-flex; padding: 4px 9px; color: #355e53; background: #e9f2ef; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.data-kind.test { color: #6c4c13; background: #fff3d8; }
.admin-toolbar .data-filter { width: 210px; }
.admin-toolbar .assessment-filter { width: 230px; }
.admin-toolbar .date-filter { width: 160px; }
.admin-selection { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.admin-table .select-column { width: 44px; padding-left: 14px; padding-right: 8px; }
.admin-table input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--wine); }
.btn-small { min-height: 36px; padding: 7px 13px; border-radius: 9px; font-size: 13px; }
.admin-pagination { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }
.admin-detail-head { padding: clamp(25px, 5vw, 40px); }
.contact-decision { margin: 20px 0; padding: 14px 16px; color: #355e53; background: #e9f2ef; border-radius: 12px; }
.contact-decision.no { color: var(--wine-dark); background: #f7e9eb; }
.btn-danger { color: var(--wine-dark); border-color: #d8bac1; }
.error { padding: 60px 20px; text-align: center; }
footer { padding: 26px 20px 34px; color: var(--muted); text-align: center; font-size: 12px; border-top: 1px solid var(--line); }
footer p { margin: 4px; }
footer a { color: inherit; text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 760px) {
  .assessment-grid, .result-grid, .profile-grid, .relation-choices { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .hero { padding-top: 48px; }
  .assessment-card { padding: 25px; }
  .bar-row { grid-template-columns: 72px 1fr 58px; gap: 9px; }
  .brand small { display: none; }
  .header-links { gap: 12px; }
  .privacy-link { font-size: 12px; }
  .progress-wrap { top: 69px; }
  .question-nav .btn { flex: 1; padding-left: 10px; padding-right: 10px; }
  .profile-report { grid-template-columns: 1fr; }
  .admin-head, .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-actions { justify-content: stretch; }
  .admin-actions .btn { flex: 1; }
}

@media print {
  .site-header, footer, .result-actions, .back-link { display: none !important; }
  body { background: white; }
  .result-page { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .result-card { break-inside: avoid; }
  .answer-table-wrap { overflow: visible; border: 0; }
  .answer-table { min-width: 0; font-size: 10px; }
  .answer-table th, .answer-table td { padding: 7px; }
  .answer-table tr { break-inside: avoid; }
}
