/* ============ 思迹 · 样式 ============
 * 气质：安静、克制、低刺激、适合思考。
 * 米白底、深色正文、柔和强调色；大留白；无炫技动画。
 */

:root {
  --bg: #f6f4ee;
  --surface: #fffdf8;
  --surface-ai: #faf8f1;
  --text: #2e2c26;
  --text-soft: #57544b;
  --muted: #8d8778;
  --line: #e4dfd2;
  --line-strong: #d3ccba;
  --accent: #4a7a6a;        /* 柔和苔绿 */
  --accent-strong: #3a6356;
  --accent-ink: #ffffff;
  --accent-wash: #e9f0ec;
  --warn: #a35e4c;
  --ai-line: #b3a88f;       /* AI 虚线 */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 55, 40, 0.04);
  --font-body: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-serif: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

::selection { background: var(--accent-wash); }

/* 焦点可见性 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 16px;
  z-index: 200;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 头部 ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.08em;
}
.site-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 15px;
}
.site-nav a:hover { background: var(--accent-wash); color: var(--accent-strong); }
.site-nav a.is-active { background: var(--accent-wash); color: var(--accent-strong); font-weight: 600; }
.header-badge { margin-left: auto; }

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.badge-api {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-wash);
}

/* ---------- 主体 ---------- */
.main { padding: 40px 20px 80px; min-height: 60vh; }

/* ---------- 首页 ---------- */
.hero { padding: 24px 0 8px; }
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 4.5vw, 36px);
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.35;
}
.hero-sub {
  color: var(--muted);
  margin: 0 0 32px;
  font-size: 17px;
}

.composer textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 17px;
  font-family: var(--font-body);
  line-height: 1.8;
  color: var(--text);
  resize: vertical;
  min-height: 140px;
  box-shadow: var(--shadow);
}
.composer textarea::placeholder { color: #b3ac9c; }
.composer textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(74, 122, 106, 0.15); }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.composer-note { color: var(--muted); font-size: 13.5px; margin: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 48px 0 16px;
}
.section-head h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0;
}
.link-muted { color: var(--muted); font-size: 14px; text-decoration: none; }
.link-muted:hover { color: var(--accent-strong); }

.recent-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.recent-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.recent-item:hover { border-color: var(--accent); }
.recent-title { font-weight: 600; }
.recent-meta { color: var(--muted); font-size: 13px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }

.btn-ghost { background: transparent; }
.btn-calm {
  background: transparent;
  border-style: dashed;
  color: var(--text-soft);
}
.btn-calm:hover { border-color: var(--warn); color: var(--warn); }

.btn-lg { padding: 13px 30px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13.5px; }
.btn-danger-text { color: var(--warn); }
.btn-danger-text:hover { border-color: var(--warn); color: var(--warn); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.center { justify-content: center; }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: var(--font-body);
}
.link-btn:hover { color: var(--accent-strong); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.card textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: var(--font-body);
  line-height: 1.7;
  color: var(--text);
  background: #fff;
  resize: vertical;
}
.card textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(74, 122, 106, 0.15); }

.card-original { border-left: 3px solid var(--accent); }
.card-ai {
  border: 1px dashed var(--ai-line);
  background: var(--surface-ai);
}
.card-question { border-left: 3px solid var(--accent-strong); }
.card-confirmed { background: var(--accent-wash); border-color: var(--accent); }

.node-label {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
  letter-spacing: 0.04em;
}
.node-label-ai { color: #9a8f74; }
.dot-ai {
  display: inline-block;
  width: 8px; height: 8px;
  border: 1.5px dashed var(--ai-line);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

.quote {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.tag, .tag-solid, .tag-hint {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tag { border: 1px solid var(--line-strong); color: var(--muted); }
.tag-solid { background: var(--accent-wash); color: var(--accent-strong); border: 1px solid var(--accent); }
.tag-hint { background: #f3efe4; color: #7a6f52; border: 1px solid #ddd3ba; }

.muted { color: var(--muted); font-size: 14px; }
.muted-inline { color: var(--muted); font-size: 13px; margin-left: 6px; }
.hidden { display: none !important; }

.ai-part {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--ai-line);
  border-radius: 10px;
  background: var(--surface-ai);
  font-size: 14.5px;
  color: var(--text-soft);
}
.ai-part p { margin: 0 0 4px; }

.demo-notice {
  font-size: 13.5px;
  color: #8a7a52;
  background: #f7f1df;
  border: 1px dashed #ddd0a8;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 16px 0;
}

/* ---------- 工作区 ---------- */
.ws-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ws-title {
  font-family: var(--font-serif);
  font-size: clamp(21px, 3.5vw, 27px);
  margin: 0 0 4px;
  line-height: 1.4;
}
.ws-meta { color: var(--muted); font-size: 13.5px; margin: 0; }
.ws-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.round-indicator {
  color: var(--muted);
  font-size: 13.5px;
  margin: 20px 0 0;
  text-align: center;
}

.restatement { font-size: 16.5px; line-height: 1.85; margin: 0; }

.correct-row { margin-top: 12px; }
.correct-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.correct-form input {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14.5px;
  font-family: var(--font-body);
}
.correct-form input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(74, 122, 106, 0.15); }

/* 提示卡 */
.hint-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 10px 0 4px;
}
.hint-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.hint-card:hover { border-color: var(--accent); }
.hint-card.is-chosen {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: 0 0 0 1px var(--accent);
}
.hint-type {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-strong);
  letter-spacing: 0.05em;
}
.hint-card.is-chosen .hint-type { color: var(--accent-strong); }
.hint-text { font-size: 14.5px; line-height: 1.65; color: var(--text); flex: 1; }
.hint-mark { font-size: 12px; color: var(--muted); }
.hint-card.is-chosen .hint-mark { color: var(--accent-strong); font-weight: 600; }
.hint-foot { text-align: right; margin: 4px 0 0; }

/* 决策区 */
.decide-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 30px 0 10px;
}
.decide-note { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 30px; }
.confirmed-q { font-size: 18px; font-weight: 600; margin: 0; line-height: 1.7; }

.plain-list { margin: 0; padding-left: 1.3em; }
.plain-list li { margin: 6px 0; }

.branch-block { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.orig-details { margin-top: 12px; }
.orig-details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.orig-details .quote { margin-top: 8px; color: var(--text-soft); }

/* ---------- 空白 ---------- */
.blank-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: 36px 8px;
}
.blank-big {
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 32px);
  margin: 0;
}
.blank-sub { color: var(--text-soft); margin: 0; font-size: 16px; max-width: 420px; }
.blank-quote {
  margin: 0;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  background: var(--surface-ai);
  text-align: left;
  max-width: 520px;
  line-height: 1.85;
  border-radius: 0 10px 10px 0;
}
.blank-screen textarea {
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 16px;
  font-family: var(--font-body);
  line-height: 1.8;
  min-height: 120px;
  resize: vertical;
}
.blank-screen textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(74, 122, 106, 0.15); }
.kw-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.kw {
  font-family: var(--font-serif);
  font-size: 24px;
  padding: 10px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}

.blank-opts { display: grid; gap: 10px; margin: 14px 0; }
.blank-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-body);
}
.blank-opt:hover { border-color: var(--accent); background: var(--accent-wash); }
.blank-opt-label { font-weight: 600; font-size: 15.5px; }
.blank-opt-desc { color: var(--muted); font-size: 13.5px; }

/* ---------- 时间线 ---------- */
.path-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 20px;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-user { background: var(--accent); }
.legend-ai { border: 2px dashed var(--ai-line); }
.legend-event { background: transparent; border: 2px solid var(--line-strong); }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 8px;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line-strong);
}
.tl-item {
  position: relative;
  padding: 0 0 26px 40px;
}
.tl-node {
  position: absolute;
  left: 4px;
  top: 5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}
.tl-ai .tl-node { border-style: dashed; border-color: var(--ai-line); }
.tl-blank .tl-node, .tl-resume .tl-node, .tl-event .tl-node { border-style: solid; border-color: var(--line-strong); border-width: 2px; }
.tl-reject .tl-node { border-color: var(--warn); border-style: solid; }
.tl-hint .tl-node { border-color: #c9bc96; border-style: dashed; border-width: 2px; }
.tl-confirmed .tl-node { background: var(--accent); }
.tl-body { min-width: 0; }
.tl-label {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 6px;
  letter-spacing: 0.04em;
}
.tl-ai .tl-label { color: #9a8f74; }
.tl-reject .tl-label { color: var(--warn); }
.tl-body p { margin: 0 0 6px; }
.tl-time { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.path-aipart {
  font-size: 13.5px;
  color: #9a8f74;
  border-top: 1px dashed var(--ai-line);
  padding-top: 6px;
  margin-top: 6px;
}

/* ---------- 历史 ---------- */
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  flex-wrap: wrap;
}
.history-item:hover { border-color: var(--line-strong); }
.history-main {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
}
.history-title { font-weight: 600; font-size: 16px; }
.history-excerpt { color: var(--text-soft); font-size: 14px; }
.history-meta { color: var(--muted); font-size: 12.5px; }
.history-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 详情 ---------- */
.detail-rounds { margin: 0; padding-left: 1.3em; }
.detail-rounds li { margin: 12px 0; }
.detail-ai-line { color: #9a8f74; font-size: 14.5px; }

/* ---------- 表单字段 ---------- */
.field { margin: 14px 0; }
.field label { display: block; font-size: 14px; color: var(--text-soft); margin-bottom: 6px; }
.field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  background: #fff;
}
.field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(74, 122, 106, 0.15); }
.field-note { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }

.mode-choose { display: grid; gap: 10px; margin: 6px 0 14px; }
.mode-option {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: var(--surface);
}
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.mode-option input { grid-row: span 2; align-self: center; accent-color: var(--accent); width: 17px; height: 17px; }
.mode-name { font-weight: 600; }
.mode-desc { color: var(--muted); font-size: 13.5px; }

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 44, 38, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 26px 28px;
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(46, 44, 38, 0.18);
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0 0 10px;
}
.modal-text { margin: 0 0 8px; color: var(--text-soft); font-size: 15px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal input[type="text"] {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: var(--font-body);
}

/* ---------- Toast ---------- */
.toast-holder {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: rgba(46, 44, 38, 0.92);
  color: #f6f4ee;
  font-size: 14px;
  padding: 9px 20px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.toast-show { opacity: 1; transform: translateY(0); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 70px 20px; }
.empty-title { font-family: var(--font-serif); font-size: 20px; margin: 0 0 8px; }
.empty-sub { color: var(--muted); margin: 0; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 13px;
}
.site-footer p { margin: 0 0 4px; }
.footer-motto { font-family: var(--font-serif); letter-spacing: 0.1em; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .main { padding: 26px 16px 60px; }
  .wrap { padding: 0 16px; }
  .header-inner { gap: 12px; flex-wrap: wrap; }
  .header-badge { margin-left: 0; width: 100%; }
  .hint-grid { grid-template-columns: 1fr; }
  .ws-head { flex-direction: column; }
  .composer-foot { flex-direction: column; align-items: stretch; }
  .composer-foot .btn { width: 100%; }
  .btn-row .btn { flex: 1; }
  .decide-bar { flex-direction: column-reverse; }
  .decide-bar .btn { width: 100%; }
  .history-item { flex-direction: column; align-items: stretch; }
  .history-actions { justify-content: flex-start; }
  .card { padding: 18px; }
}

/* ---------- 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto !important; }
}
