:root {
  --paper: #f7f3ea;
  --paper-2: #ece2cb;
  --gold-tint: #f5e9c3;
  --ink: #1f1b16;
  --ink-soft: #5a554d;
  --ink-faint: #8b8578;
  --line: #e4ddce;
  --glow: #c9a96a;
  --cinnabar: #9c3826;
  --serif: "Fraunces", "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(ellipse at 18% 6%, rgba(201,169,106,.05), transparent 55%), radial-gradient(ellipse at 82% 40%, rgba(31,27,22,.03), transparent 50%);
  font-family: var(--serif);
  line-height: 1.9;
  letter-spacing: .015em;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.wrap { width: 100%; max-width: 900px; margin: 0 auto; padding-inline: clamp(22px, 5vw, 40px); }

.topbar { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: rgba(247,243,234,.88); backdrop-filter: blur(10px); }
.topbar .inner { max-width: 1080px; margin: auto; padding: 13px clamp(24px,6vw,72px); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: .08em; }
.brand small { margin-left: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.seal { width: 32px; height: 32px; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--cinnabar); color: var(--paper); font-size: 13px; line-height: 1.05; }
.site-tabs { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.site-tabs a { padding: 5px 11px; border-radius: 999px; color: var(--ink-soft); text-decoration: none; white-space: nowrap; letter-spacing: .04em; transition: color .3s, background .3s; }
.site-tabs a:hover { color: var(--cinnabar); background: rgba(201,169,106,.1); }
.site-tabs a.here { color: var(--cinnabar); background: rgba(201,169,106,.16); font-weight: 700; }

.hero { padding: clamp(54px, 10vh, 88px) 0 42px; text-align: center; }
.eyebrow { margin: 0 0 10px; color: var(--cinnabar); font-size: 12px; font-weight: 600; letter-spacing: .28em; text-indent: .28em; }
.hero h1 { margin: 0; font-size: clamp(30px, 5vw, 42px); line-height: 1.4; letter-spacing: .035em; }
.hero > p:last-child { max-width: 610px; margin: 18px auto 0; color: var(--ink-soft); font-size: 15px; }

.insight { padding: clamp(24px, 4vw, 34px); border: 1px solid var(--line); border-radius: 8px; background: var(--gold-tint); text-align: center; }
.insight > span { color: var(--cinnabar); font-size: 12px; font-weight: 600; letter-spacing: .28em; }
.insight h2 { margin: 10px 0 8px; font-size: clamp(19px, 3vw, 24px); line-height: 1.7; }
.insight p { max-width: 680px; margin: 0 auto; color: var(--ink-soft); font-size: 13px; }
.insight.compact { padding-block: 22px; }

.section { padding-top: clamp(52px, 8vh, 76px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 22px; line-height: 1.45; }
.section-head > span { color: var(--ink-faint); font-size: 12px; }
.overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.overview article { padding: 18px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fcfaf4; text-align: center; }
.overview small, .overview span { display: block; color: var(--ink-faint); font-size: 12px; }
.overview strong { display: block; margin: 4px 0 2px; font-size: 24px; }
.overview em { margin-left: 4px; color: var(--ink-faint); font-size: 13px; font-style: normal; font-weight: 400; }

.chart-card { margin-top: 14px; padding: 20px 20px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fcfaf4; }
.chart-key { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; font-size: 13px; }
.chart-key > span { color: var(--ink-faint); font-size: 11px; }
.chart-key i { display: inline-block; margin: 0 4px 0 10px; vertical-align: middle; }
.chart-key i:first-child { margin-left: 0; }
.chart-key .gold, .chart-key .red { width: 10px; height: 10px; border-radius: 2px; background: var(--glow); }
.chart-key .red { background: var(--cinnabar); }
.chart-key .dot { width: 7px; height: 7px; border: 2px solid var(--cinnabar); border-radius: 50%; background: #fcfaf4; }
.chart-scroll { overflow-x: auto; padding: 14px 4px 0; }
.chart { position: relative; display: grid; grid-template-columns: repeat(var(--days), minmax(38px, 1fr)); gap: 7px; min-width: 650px; height: 230px; border-bottom: 1px solid var(--line); }
.chart::before { content: ""; position: absolute; inset: 25% 0 auto; border-top: 1px dashed rgba(156,56,38,.25); }
.chart-day { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; }
.sleep-bar { width: min(28px, 72%); border-radius: 3px 3px 0 0; background: linear-gradient(rgba(201,169,106,.72), var(--glow)); }
.sleep-bar.low { background: linear-gradient(rgba(156,56,38,.65), var(--cinnabar)); }
.sleep-value { position: absolute; bottom: calc(var(--sleep, 0) + 2px); color: var(--ink-faint); font-size: 10px; transform: translateY(-2px); }
.chart-day .sleep-value { bottom: auto; top: -19px; display: none; }
.chart-day:hover .sleep-value { display: block; }
.chart-day small { position: absolute; bottom: -28px; color: var(--ink-faint); font-size: 10px; }
.neg-point { position: absolute; z-index: 2; width: 8px; height: 8px; border: 2px solid var(--cinnabar); border-radius: 50%; background: #fcfaf4; transform: translateY(50%); }
.chart-note { margin: 38px 0 0; color: var(--ink-faint); font-size: 11px; text-align: center; }

.add-section { padding-bottom: 0; }
.record-form { padding: clamp(22px, 4vw, 30px); border: 1px solid var(--line); border-radius: 8px; background: #fcfaf4; }
.voice-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 2px; }
.mic-button { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--glow); border-radius: 50%; background: transparent; color: var(--cinnabar); transition: .25s; }
.mic-button:hover { background: rgba(201,169,106,.12); }
.mic-button.listening { border-color: var(--cinnabar); background: rgba(156,56,38,.08); animation: pulse 1.6s ease-in-out infinite; }
.mic-button svg { width: 22px; height: 22px; }
.mic-status { color: var(--ink-faint); font-size: 12px; letter-spacing: .06em; }
.fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.record-form label { color: var(--ink-soft); font-size: 12px; letter-spacing: .04em; }
.record-form input, .record-form select, .record-form textarea { width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: var(--paper); color: var(--ink); }
.record-form input, .record-form select { height: 42px; padding: 7px 10px; }
.record-form input:focus, .record-form select:focus, .record-form textarea:focus { border-color: var(--glow); }
.input-unit { position: relative; display: block; }
.input-unit input { padding-right: 44px; }
.input-unit i { position: absolute; right: 10px; bottom: 8px; color: var(--ink-faint); font-size: 11px; font-style: normal; }
.journal-label { display: block; margin-top: 20px; }
.record-form textarea { min-height: 130px; padding: 14px 16px; resize: vertical; font-size: 14px; line-height: 1.9; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; }
.form-foot small { max-width: 500px; color: var(--ink-faint); font-size: 11px; }
.form-foot button { flex: none; padding: 9px 24px; border: 1px solid var(--cinnabar); border-radius: 999px; background: transparent; color: var(--cinnabar); font-size: 13px; font-weight: 700; transition: .25s; }
.form-foot button:hover { background: var(--cinnabar); color: var(--paper); }

.processing { min-height: calc(100vh - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.processing p { margin: 24px 0 4px; color: var(--ink-soft); font-size: 15px; letter-spacing: .1em; }
.processing small { color: var(--ink-faint); font-size: 11px; letter-spacing: .08em; }
.breathe-circle { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle, var(--glow), transparent 70%); animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(.72); opacity: .35; } 50% { transform: scale(1.55); opacity: .9; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(156,56,38,.22); } 50% { box-shadow: 0 0 0 12px rgba(156,56,38,0); } }

.result-page { max-width: 840px; }
.engine-badge { display: inline-block; margin: 0 0 12px; padding: 3px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-faint); font-size: 10px; letter-spacing: .08em; }
.engine-badge.ai { border-color: var(--glow); background: rgba(201,169,106,.1); color: var(--cinnabar); }
.engine-badge.fallback { background: rgba(31,27,22,.03); }
.step-label { margin: 48px 0 17px; color: var(--cinnabar); font-size: 12px; font-weight: 600; letter-spacing: .24em; }
.step-label span { margin-right: 7px; color: var(--ink-faint); font-weight: 400; }
.health-dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.health-dashboard article { padding: 18px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fcfaf4; text-align: center; }
.health-dashboard small, .health-dashboard span { display: block; color: var(--ink-faint); font-size: 12px; }
.health-dashboard strong { display: block; margin: 5px 0 2px; font-size: 21px; }
.health-dashboard span { color: var(--cinnabar); }
.dual-stream { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stream-card { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: #fcfaf4; }
.stream-card h3 { margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 15px; }
.stream-card h3 small { margin-left: 8px; color: var(--ink-faint); font-size: 12px; font-weight: 400; }
.stream-card ul { margin: 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: 13px; }
.stream-card li { margin: 8px 0; }
.stream-card li b { display: inline-grid; place-items: center; min-width: 28px; margin-right: 8px; color: var(--cinnabar); font-weight: 600; }
.today-mirror { padding: 22px 24px; border-left: 3px solid var(--glow); border-radius: 0 8px 8px 0; background: linear-gradient(145deg, rgba(201,169,106,.1), transparent 65%), #fcfaf4; }
.today-mirror h3 { margin: 0 0 8px; color: var(--cinnabar); font-size: 15px; }
.today-mirror p { margin: 0; font-size: 15px; line-height: 2; }
.today-mirror small { display: block; margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 11px; }
.insight-block { display: grid; gap: 12px; }
.mirror-principle { margin: -7px 0 14px; color: var(--ink-faint); font-size: 11px; letter-spacing: .2em; }
.insight-card { padding: 22px 24px; border-left: 3px solid var(--glow); border-radius: 0 8px 8px 0; background: linear-gradient(145deg, rgba(201,169,106,.1), transparent 65%), #fcfaf4; }
.insight-card h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 9px; color: var(--cinnabar); font-size: 15px; letter-spacing: .08em; }
.insight-card h4 b { display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center; border: 1px solid var(--cinnabar); border-radius: 50%; font-family: var(--serif); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.insight-card p { margin: 0; font-size: 15px; line-height: 2; }
.insight-card small { display: block; margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 11px; line-height: 1.7; }
.cross-mirror { padding: clamp(22px,4vw,30px); border: 1px solid var(--line); border-radius: 8px; background: var(--gold-tint); text-align: center; }
.cross-mirror h2 { margin: 0 0 8px; font-size: clamp(18px,3vw,22px); }
.cross-mirror p { margin: 0 auto; max-width: 650px; color: var(--ink-soft); font-size: 13px; }
.cross-mirror small { display: block; margin-top: 9px; color: var(--ink-faint); font-size: 11px; }
.ai-evidence { max-width: 650px; margin: 14px auto 0; padding-top: 12px; border-top: 1px solid rgba(31,27,22,.08); color: var(--ink-soft); font-size: 11px; text-align: left; }
.ai-evidence span { display: block; margin: 4px 0; }
.breath-section { padding: 26px 0 6px; text-align: center; }
.breath-once { width: 46px; height: 46px; margin: 0 auto 18px; border: 1px solid var(--glow); border-radius: 50%; animation: breath-once 14s ease-in-out infinite; }
.breath-section p { color: var(--ink-faint); font-size: 12px; letter-spacing: .3em; text-indent: .3em; }
@keyframes breath-once { 0%,100% { transform: scale(.72); opacity: .4; } 28%,57% { transform: scale(1.45); opacity: .95; } }
.result-actions { display: flex; justify-content: center; margin-top: 38px; }
.result-actions button { padding: 10px 28px; border: 1px solid var(--cinnabar); border-radius: 999px; background: transparent; color: var(--cinnabar); font-size: 13px; font-weight: 700; }
.result-actions button:hover { background: var(--cinnabar); color: var(--paper); }

.day-list { border-top: 1px solid var(--line); }
.day-row { position: relative; display: grid; grid-template-columns: 94px 1fr auto; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.day-row.low::before { content: ""; position: absolute; left: -12px; top: 22px; width: 3px; height: 34px; border-radius: 2px; background: var(--cinnabar); }
.day-row time { color: var(--ink-faint); font-size: 12px; }
.day-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.day-meta > span { padding: 1px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--cinnabar); font-size: 11px; }
.day-meta small { color: var(--ink-faint); font-size: 11px; }
.day-meta b { color: var(--ink-soft); }
.day-row p { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; }
.day-row > i { color: var(--ink-faint); font-size: 10px; font-style: normal; letter-spacing: .08em; }

.day-groups { border-top: 1px solid var(--line); }
.day-group { position: relative; border-bottom: 1px solid var(--line); }
.day-group.low::before { content: ""; position: absolute; left: -12px; top: 20px; width: 3px; height: 38px; border-radius: 2px; background: var(--cinnabar); }
.day-group summary { display: grid; grid-template-columns: 92px 150px 1fr auto; align-items: center; gap: 18px; padding: 18px 0; cursor: pointer; list-style: none; }
.day-group summary::-webkit-details-marker { display: none; }
.day-group summary time { color: var(--ink-faint); font-size: 12px; }
.day-group summary div b, .day-group summary div small { display: block; }
.day-group summary div b { font-size: 13px; }
.day-group summary div small { color: var(--ink-faint); font-size: 10px; }
.day-group summary p { margin: 0; overflow: hidden; color: var(--ink-soft); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.day-group summary > i { color: var(--cinnabar); font-size: 10px; font-style: normal; }
.day-group[open] summary > i { font-size: 0; }
.day-group[open] summary > i::after { content: "收起"; font-size: 10px; }
.entry-list { display: grid; gap: 8px; padding: 0 0 18px 110px; }
.entry-row { width: 100%; display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 6px; background: #fcfaf4; color: var(--ink); text-align: left; transition: .2s; }
.entry-row:hover { border-color: var(--glow); transform: translateX(3px); }
.entry-row span b, .entry-row span i { display: block; }
.entry-row span b { font-size: 11px; }
.entry-row span i { color: var(--ink-faint); font-size: 10px; font-style: normal; }
.entry-row p { margin: 0; overflow: hidden; color: var(--ink-soft); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.entry-row em { color: var(--cinnabar); font-size: 11px; font-style: normal; }
.empty-entry { margin: 0; color: var(--ink-faint); font-size: 12px; }

.detail-hero { padding: 52px 0 24px; }
.detail-hero button { margin-bottom: 26px; padding: 0; border: 0; background: transparent; color: var(--cinnabar); font-size: 12px; }
.detail-hero h1 { margin: 0; font-size: clamp(28px,4vw,38px); }
.journal-full { padding: clamp(22px,4vw,32px); border: 1px solid var(--line); border-radius: 8px; background: #fcfaf4; }
.journal-full > p { margin: 0; font-size: clamp(16px,2.5vw,19px); line-height: 2.1; }
.journal-full > div { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 11px; }

footer { margin-top: 76px; border-top: 1px solid var(--line); }
footer .wrap { display: flex; justify-content: space-between; gap: 20px; padding-block: 28px 42px; color: var(--ink-faint); font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 11px 17px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 12px; opacity: 0; transform: translateY(16px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 720px) {
  .topbar .inner { gap: 10px; }
  .brand small { display: none; }
  .site-tabs { gap: 0; overflow-x: auto; font-size: 12px; scrollbar-width: none; }
  .site-tabs::-webkit-scrollbar { display: none; }
  .site-tabs a { padding: 4px 7px; }
  .overview { grid-template-columns: 1fr; }
  .health-dashboard, .dual-stream { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr 1fr; }
  .section-head, .chart-key, .form-foot { align-items: flex-start; flex-direction: column; }
  .day-row { grid-template-columns: 78px 1fr; gap: 14px; }
  .day-row > i { display: none; }
  .day-meta { align-items: flex-start; flex-direction: column; gap: 7px; }
  .day-group summary { grid-template-columns: 76px 1fr auto; gap: 12px; }
  .day-group summary > p { display: none; }
  .entry-list { padding-left: 0; }
  .entry-row { grid-template-columns: 92px 1fr auto; gap: 10px; }
}

@media (max-width: 460px) {
  .fields { grid-template-columns: 1fr; }
  .hero { text-align: left; }
  .hero .eyebrow { text-indent: 0; }
  .insight { text-align: left; }
  .form-foot button { width: 100%; }
  .voice-head { align-items: center; flex-direction: column; text-align: center; }
  .entry-row { grid-template-columns: 1fr auto; }
  .entry-row p { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .journal-full > div { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
