:root {
  /* 全站字号基准：浏览器默认约 16px；112.5% ≈ 18px，利于情绪低落时的阅读 */
  --fs-root: 112.5%;
  --bg: #f7f6f3;
  --bg-card: #ffffff;
  --text: #373e3a;
  --text-muted: #5a635c;
  --accent: #5e8c7e;
  --accent-soft: #e6efe9;
  --accent-deep: #3f6b5e;
  --sand: #d9c6a8;
  --sand-soft: #f2ece1;
  --sky: #54748f;
  --sky-soft: #e7eef5;
  --warn: #9f5d28;
  --warn-soft: #f6ead9;
  --crisis: #4a6f8a;
  --crisis-soft: #e6eef4;
  --border: #e4e8e2;
  --shadow: 0 4px 20px rgba(62, 74, 68, 0.07);
  --shadow-lift: 0 14px 34px rgba(62, 74, 68, 0.12);
  --code-bg: #f1f0eb;
  --hero-glow-1: rgba(94, 140, 126, 0.16);
  --hero-glow-2: rgba(217, 198, 168, 0.22);
  --bg-glass: rgba(247, 246, 243, 0.9);
  --max-w: 800px;
  --t-fast: 0.18s;
  --t-base: 0.26s;
  --t-slow: 0.4s;
}

/* ===== 主题 · 深色模式（鼠尾草绿 sage） ===== */
:root[data-mode="dark"] {
  --bg: #1a1f1c;
  --bg-card: #222926;
  --text: #e7ede9;
  --text-muted: #aab4ae;
  --accent: #93c2af;
  --accent-soft: #24342d;
  --accent-deep: #a9d6c2;
  --sand: #b7a488;
  --sand-soft: #2f2a20;
  --sky: #8fb4cf;
  --sky-soft: #22313e;
  --warn: #d3a664;
  --warn-soft: #3a3224;
  --crisis: #8fb4cf;
  --crisis-soft: #22303b;
  --border: #2f3733;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.55);
  --code-bg: #2a312d;
  --hero-glow-1: rgba(147, 194, 175, 0.10);
  --hero-glow-2: rgba(183, 164, 136, 0.12);
  --bg-glass: rgba(26, 31, 28, 0.9);
}

/* ===== 主题 · 暖棕沙 sand ===== */
:root[data-theme="sand"] {
  --bg: #faf5ec;
  --bg-card: #fffdf8;
  --text: #4a4237;
  --text-muted: #8a7f6d;
  --accent: #b08a5a;
  --accent-soft: #f3ead9;
  --accent-deep: #8a6433;
  --sand: #c9a87c;
  --sand-soft: #f3e8d3;
  --sky: #7a6a55;
  --sky-soft: #efe8db;
  --warn: #a35b2b;
  --warn-soft: #f5e5d3;
  --crisis: #8a5a3a;
  --crisis-soft: #f0e3d4;
  --border: #eae0d0;
  --shadow: 0 4px 20px rgba(120, 95, 60, 0.08);
  --shadow-lift: 0 14px 34px rgba(120, 95, 60, 0.14);
  --code-bg: #f1e9d9;
  --hero-glow-1: rgba(176, 138, 90, 0.18);
  --hero-glow-2: rgba(201, 168, 124, 0.28);
  --bg-glass: rgba(250, 245, 236, 0.9);
}
:root[data-theme="sand"][data-mode="dark"] {
  --bg: #211b14;
  --bg-card: #2c251c;
  --text: #f0e9dc;
  --text-muted: #a89b85;
  --accent: #d3af7f;
  --accent-soft: #3a3120;
  --accent-deep: #e3c598;
  --sand: #c4a371;
  --sand-soft: #3a3120;
  --sky: #b39b7f;
  --sky-soft: #3b3326;
  --warn: #d9965c;
  --warn-soft: #42301f;
  --crisis: #d0a06b;
  --crisis-soft: #3a2b1c;
  --border: #3b3327;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.5);
  --code-bg: #332b20;
  --hero-glow-1: rgba(211, 175, 127, 0.10);
  --hero-glow-2: rgba(196, 163, 113, 0.14);
  --bg-glass: rgba(33, 27, 20, 0.9);
}

/* ===== 主题 · 湖泊蓝 lake ===== */
:root[data-theme="lake"] {
  --bg: #f2f6fb;
  --bg-card: #ffffff;
  --text: #33404f;
  --text-muted: #63758a;
  --accent: #5a86a8;
  --accent-soft: #e3edf6;
  --accent-deep: #3c5f7d;
  --sand: #8ba3b8;
  --sand-soft: #e9eef4;
  --sky: #5a7fa0;
  --sky-soft: #e4edf6;
  --warn: #a25d2f;
  --warn-soft: #f5e6d5;
  --crisis: #3f6a8f;
  --crisis-soft: #e4eefa;
  --border: #dfe8f2;
  --shadow: 0 4px 20px rgba(60, 95, 125, 0.09);
  --shadow-lift: 0 14px 34px rgba(60, 95, 125, 0.15);
  --code-bg: #eef3f9;
  --hero-glow-1: rgba(90, 134, 168, 0.16);
  --hero-glow-2: rgba(139, 163, 184, 0.24);
  --bg-glass: rgba(242, 246, 251, 0.9);
}
:root[data-theme="lake"][data-mode="dark"] {
  --bg: #141c26;
  --bg-card: #1c2733;
  --text: #e3ecf5;
  --text-muted: #93a5b8;
  --accent: #8fb4d4;
  --accent-soft: #223140;
  --accent-deep: #a9c9e6;
  --sand: #93adc4;
  --sand-soft: #26323f;
  --sky: #8fb0cc;
  --sky-soft: #223443;
  --warn: #d39a5f;
  --warn-soft: #3d2e1d;
  --crisis: #93b8d8;
  --crisis-soft: #1f2f3f;
  --border: #2a3a4a;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.42);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.55);
  --code-bg: #24303d;
  --hero-glow-1: rgba(143, 180, 212, 0.10);
  --hero-glow-2: rgba(147, 173, 196, 0.13);
  --bg-glass: rgba(20, 28, 38, 0.9);
}

/* ===== 主题 · 松林 pine ===== */
:root[data-theme="pine"] {
  --bg: #f2f6f2;
  --bg-card: #ffffff;
  --text: #33413a;
  --text-muted: #64756b;
  --accent: #5f8a73;
  --accent-soft: #e2efe6;
  --accent-deep: #3f6c54;
  --sand: #8fa98f;
  --sand-soft: #e8efe6;
  --sky: #5f7f6e;
  --sky-soft: #e3eee6;
  --warn: #a5672c;
  --warn-soft: #f5e9d4;
  --crisis: #4a745f;
  --crisis-soft: #e2efe7;
  --border: #dee8df;
  --shadow: 0 4px 20px rgba(60, 95, 75, 0.08);
  --shadow-lift: 0 14px 34px rgba(60, 95, 75, 0.14);
  --code-bg: #eef3ec;
  --hero-glow-1: rgba(95, 138, 115, 0.16);
  --hero-glow-2: rgba(143, 169, 143, 0.22);
  --bg-glass: rgba(242, 246, 242, 0.9);
}
:root[data-theme="pine"][data-mode="dark"] {
  --bg: #141d18;
  --bg-card: #1c2720;
  --text: #e6efe8;
  --text-muted: #94a79a;
  --accent: #93baa2;
  --accent-soft: #223329;
  --accent-deep: #a9cdb6;
  --sand: #93ad99;
  --sand-soft: #253229;
  --sky: #8fb09b;
  --sky-soft: #20342a;
  --warn: #d3a05e;
  --warn-soft: #3d2f1c;
  --crisis: #95bfa8;
  --crisis-soft: #1e3026;
  --border: #2a3a2f;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.42);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.55);
  --code-bg: #253029;
  --hero-glow-1: rgba(147, 186, 162, 0.10);
  --hero-glow-2: rgba(143, 173, 153, 0.13);
  --bg-glass: rgba(20, 29, 24, 0.9);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: var(--fs-root);
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Microsoft YaHei UI", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.85;
  transition: background var(--t-base) ease, color var(--t-base) ease;
}

h1, h2, h3, .logo {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Songti SC", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

a { color: var(--accent-deep); }

/* ---------- Focus (无障碍) ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.logo::before {
  content: "屿";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  flex: none;
}
.logo:hover { color: var(--accent); }
[data-mode="dark"] .logo::before { color: #10201a; }

.nav-links a {
  color: var(--text);
  text-decoration: none;
  margin-left: 22px;
  font-size: 0.95rem;
  position: relative;
  padding-bottom: 4px;
}
.nav-links a:hover,
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text);
  transition: transform var(--t-base);
}
.theme-toggle:hover { transform: rotate(20deg); }

/* ---------- Crisis bar ---------- */
.crisis-bar {
  background: var(--crisis-soft);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.65;
}
.crisis-bar strong { color: var(--crisis); }
.crisis-bar .crisis-title {
  font-weight: 700;
  color: var(--crisis);
  margin-right: 6px;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 52px;
  text-align: center;
  position: relative;
}
/* 治愈感的光晕氛围（纯 CSS，无图片） */
.hero::before {
  content: "";
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  height: 420px;
  background:
    radial-gradient(closest-side, var(--hero-glow-1), transparent 70%),
    radial-gradient(closest-side at 70% 40%, var(--hero-glow-2), transparent 72%);
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none;
  z-index: -1;
}
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}
.hero .accent { color: var(--accent); }
.hero .tagline {
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.9;
}

/* ---------- Tool grid ---------- */
.section-title {
  font-size: 1.5rem;
  margin: 40px 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.tools-block {
  scroll-margin-top: 88px;
}
.tools-block.tools-flash .section-title {
  border-bottom-color: var(--accent);
  color: var(--accent-deep);
  transition: border-color 0.3s, color 0.3s;
}

/* ---------- Quick entry (分流) ---------- */
.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}
.quick-link {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.quick-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}
.quick-link .q-head { font-weight: 700; font-size: 1.02rem; }
.quick-link .q-head .q-emoji { margin-right: 6px; }
.quick-link .q-desc { color: var(--text-muted); font-size: 0.86rem; margin-top: 2px; }
.quick-link.acute { border-left: 4px solid var(--accent); }
.quick-link.growth { border-left: 4px solid var(--accent-deep); }
@media (max-width: 560px) {
  .quick-links { grid-template-columns: 1fr; }
}

/* ---------- Tool card badge (角标) ---------- */
.tool-card { position: relative; }
.tool-badge {
  position: absolute;
  top: 39px;
  right: 16px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}
.tool-badge.urgent { background: var(--warn-soft); color: var(--warn); font-weight: 700; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 60px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform var(--t-base) ease, box-shadow var(--t-base) ease;
}
.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}
.tool-card .tool-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  margin-bottom: 14px;
}
.tool-card .tool-emoji svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.8;
}
.tool-card h3 { font-size: 1.2rem; margin-bottom: 6px; }
.tool-card p { color: var(--text-muted); font-size: 0.95rem; }

@media (max-width: 560px) {
  .tool-grid { grid-template-columns: 1fr; }
}

/* ---------- Article / tool pages ---------- */
.tool-page {
  padding-top: 48px;
  padding-bottom: 80px;
}
.tool-page .page-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 4px 14px 4px 10px;
  border-radius: 20px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.tool-page .page-tag svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}
.tool-page h1 { font-size: 2rem; margin-bottom: 10px; }
.tool-page .lead { color: var(--text-muted); margin-bottom: 32px; font-size: 1.05rem; line-height: 1.8; }

.tool-page h2 {
  font-size: 1.4rem;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tool-page h3 { font-size: 1.12rem; margin: 26px 0 10px; }
.tool-page p { margin-bottom: 18px; }
.tool-page ol, .tool-page ul { margin: 0 0 20px 24px; }
.tool-page li { margin-bottom: 10px; }

/* callout boxes */
.callout {
  border-radius: 12px;
  padding: 18px 22px;
  margin: 22px 0;
  border: 1px solid var(--border);
}
.callout.seek-help {
  background: var(--warn-soft);
  border-left: 4px solid var(--warn);
}
.callout.note {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
}
.callout .label {
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}
.callout.seek-help .label { color: var(--warn); }
.callout.note .label { color: var(--accent-deep); }
.callout p { margin-bottom: 6px; }
.callout p:last-child { margin-bottom: 0; }

/* step practice */
.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.step .step-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.step .step-title .num {
  display: inline-block;
  min-width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 50%;
  margin-right: 10px;
  font-size: 0.9rem;
}
.step p, .step ul { font-size: 1rem; }

/* scripts / blockquote kept simple */
.tool-page blockquote {
  margin: 24px 0;
  padding: 18px 24px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 0 10px 10px 0;
  font-style: italic;
}
.tool-page pre {
  background: var(--code-bg);
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.tool-page code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88rem;
}
.tool-page :not(pre) > code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent-deep);
}

.breath-box {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  margin: 28px 0;
}
.breath-box .dot {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(0.7); opacity: 0.25; }
  50% { transform: scale(1.15); opacity: 0.6; }
}
.breath-box .hint { color: var(--text-muted); font-size: 0.92rem; }

.back-home {
  display: inline-block;
  margin-top: 28px;
  color: var(--accent-deep);
  text-decoration: none;
  font-weight: 500;
}
.back-home:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 28px 20px;
  line-height: 1.9;
}
.site-footer .disclaimer {
  max-width: 620px;
  margin: 0 auto;
}

/* ---------- Interactive form (M7 thought log) ---------- */
.recorder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  margin: 20px 0 32px;
  box-shadow: var(--shadow);
}
.recorder-step {
  padding: 22px 24px;
  border-top: 1px dashed var(--border);
}
.recorder-step:first-child { border-top: none; }
.recorder-step .step-label {
  font-weight: 700;
  font-size: 1.02rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recorder-step .step-label .num {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 50%;
  font-size: 0.85rem;
}
.recorder-step .step-hint { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 12px; }

.recorder label.lbl {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 14px 0 6px;
}
.recorder input[type=text],
.recorder textarea,
.recorder select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}
.recorder textarea { resize: vertical; min-height: 64px; }
.recorder input[type=text]:focus-visible,
.recorder textarea:focus-visible,
.recorder select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.recorder .feel-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 4px;
}
.recorder .feel-row label.lbl { margin: 0; white-space: nowrap; }
.recorder input[type=range] { flex: 1; accent-color: var(--accent); }
.recorder .feel-val {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  color: var(--accent-deep);
}

.distort {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.distort:hover { border-color: var(--accent); }
.distort input { margin-top: 4px; accent-color: var(--accent); }
.distort .d-name { font-weight: 600; font-size: 0.95rem; }
.distort .d-desc { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.distort.checked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.recorder .actions { padding: 20px 24px; text-align: center; border-top: 1px dashed var(--border); }
.btn {
  display: inline-block;
  background: var(--accent-deep);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 26px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity var(--t-fast), background var(--t-fast);
}
[data-mode="dark"] .btn {
  background: var(--accent);
  color: #10201a;
}
.btn:hover { opacity: 0.9; }
.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.result-block {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 20px 0;
}
.result-block h3 { color: var(--accent-deep); margin-bottom: 10px; }
.result-block .row { margin-bottom: 8px; font-size: 0.95rem; }
.result-block .row .k { color: var(--text-muted); }
.result-block .score-compare {
  display: flex;
  gap: 24px;
  margin: 12px 0;
  font-size: 0.95rem;
}
.result-block .score-compare .big { font-size: 1.6rem; font-weight: 700; color: var(--accent-deep); }
.result-block .delta { font-weight: 700; color: var(--accent-deep); margin-left: 4px; }

.history-list { margin-top: 16px; }
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  font-size: 0.92rem;
}
.history-item .h-time { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 6px; }
.history-item .h-thought {
  color: var(--text);
  margin-bottom: 4px;
}
.history-item .h-rethink { color: var(--accent-deep); }
.empty-hint { color: var(--text-muted); font-size: 0.9rem; text-align: center; padding: 20px; }

/* ---------- Self-compassion practice (M8) ---------- */
.selfcomp {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  margin: 20px 0 32px;
  box-shadow: var(--shadow);
}
.selfcomp-step { padding: 22px 24px; border-top: 1px dashed var(--border); }
.selfcomp-step:first-child { border-top: none; }
.selfcomp-step .step-label {
  font-weight: 700;
  font-size: 1.02rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.selfcomp-step .step-label .num {
  display: inline-flex;
  min-width: 24px; height: 24px;
  align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 50%; font-size: 0.85rem;
}
.selfcomp-step p { color: var(--text-muted); font-size: 0.92rem; }
.selfcomp-step textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font-family: inherit; font-size: 0.95rem; box-sizing: border-box;
  resize: vertical; min-height: 72px;
}
.selfcomp-step textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.selfcomp-actions { padding: 20px 24px; text-align: center; border-top: 1px dashed var(--border); }

/* ---------- Action space (M11) ---------- */
.action-space {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; margin: 20px 0 32px; box-shadow: var(--shadow);
}
.action-input { display: flex; gap: 10px; margin-bottom: 18px; }
.action-input input[type=text] {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-family: inherit; font-size: 0.95rem;
}
.action-input input[type=text]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.action-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 8px;
  border-top: 1px dashed var(--border); font-size: 0.98rem;
}
.action-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; cursor: pointer; }
.action-item .a-text { flex: 1; }
.action-item.done .a-text { text-decoration: line-through; color: var(--text-muted); }
.action-item .a-del { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }
.action-item .a-del:hover { color: var(--warn); }
.action-empty { color: var(--text-muted); text-align: center; padding: 20px; font-size: 0.92rem; }
.action-progress { margin-bottom: 14px; }
.action-progress .bar {
  height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
}
.action-progress .bar > i {
  display: block; height: 100%; background: var(--accent); width: 0%; transition: width 0.3s;
}
.action-progress .p-text { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; text-align: right; }

/* ---------- Book TOC sidebar (延伸阅读目录) ---------- */
.book-toc {
  position: fixed;
  top: 120px;
  right: 24px;
  width: 200px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}
.book-toc h4 {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.book-toc a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 5px 6px;
  border-radius: 6px;
  line-height: 1.4;
  transition: background var(--t-fast), color var(--t-fast);
}
.book-toc a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.book-toc a.sec { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }
/* 锚点补偿 sticky header */
.step { scroll-margin-top: 90px; }
h2 { scroll-margin-top: 90px; }
/* 窄屏隐藏侧栏目录，改为页内顶部目录链接放于正文之上 */
@media (max-width: 1240px) {
  .book-toc { display: none; }
}

/* 页内折叠目录（窄屏） */
.book-toc-inline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 24px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}
.book-toc-inline summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.book-toc-inline .inline-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-top: 10px; }
.book-toc-inline a { text-decoration: none; color: var(--text); padding: 3px 4px; }
.book-toc-inline a:hover { color: var(--accent-deep); background: var(--accent-soft); }
@media (min-width: 1241px) {
  .book-toc-inline { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hero { padding: 60px 0 28px; }
  .hero h1 { font-size: 1.9rem; }
  .nav { padding: 12px 16px; }
  .logo { font-size: 1.15rem; }
  .logo::before { width: 26px; height: 26px; font-size: 0.82rem; }
  .nav-links a { margin-left: 14px; font-size: 0.9rem; }
  .theme-toggle { width: 32px; height: 32px; font-size: 1rem; }
  .hero::before { width: 120%; min-width: 360px; height: 320px; top: -30px; }
  .book-toc-inline .inline-links { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .nav { padding: 10px 12px; }
  .logo { font-size: 1.05rem; }
  .nav-links a { margin-left: 12px; font-size: 0.85rem; }
}

/* ---------- 宽屏 (大屏桌面, 如 1920x1080) ---------- */
@media (min-width: 1200px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1400px) {
  :root { --max-w: 1020px; }
  .hero { padding: 108px 0 56px; }
  .hero h1 { font-size: 2.9rem; }
}
@media (min-width: 1800px) {
  :root { --max-w: 1160px; }
  .hero h1 { font-size: 3.1rem; }
}

/* ---------- Theme panel (主题选择面板) ---------- */
.theme-btn { position: relative; display: inline-flex; }
.theme-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 252px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  padding: 16px;
  z-index: 200;
  display: none;
}
.theme-panel.open { display: block; }
.theme-panel h5 {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin: 0 0 8px;
  font-family: inherit;
}
.theme-panel .tp-seg {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
}
.tp-seg button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.tp-seg button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}
.theme-panel .tp-themes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tp-theme {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 4px 7px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.tp-theme:hover { border-color: var(--accent); }
.tp-theme.active { border-color: var(--accent); background: var(--accent-soft); }
.tp-swatch {
  display: block;
  width: 24px; height: 24px;
  margin: 0 auto 5px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.tp-theme .tp-name { font-size: 0.7rem; color: var(--text-muted); }


/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 10px 18px;
  background: var(--accent-deep);
  color: #fff;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Mobile nav hamburger ---------- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  flex: none;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 1px;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav { flex-wrap: wrap; gap: 8px; }
  .nav-toggle { display: inline-flex; margin-left: auto; order: 2; }
  .theme-btn, .theme-toggle { order: 3; }
  .nav-links {
    display: none;
    width: 100%;
    order: 4;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    margin-left: 0;
    padding: 10px 8px;
    border-radius: 8px;
  }
  .nav-links a.active::after { display: none; }
  .nav-links a.active { background: var(--accent-soft); color: var(--accent-deep); }
}

/* ---------- Search box ---------- */
.search-box {
  position: relative;
  max-width: 480px;
  margin: 8px auto 28px;
}
.search-box input[type="search"] {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px 12px 42px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.98rem;
  box-shadow: var(--shadow);
}
.search-box input[type="search"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.search-box::before {
  content: "⌕";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}
.search-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 16px;
  font-size: 0.95rem;
  display: none;
}
.search-empty.show { display: block; }

/* ---------- Crisis bar links ---------- */
.crisis-bar a { color: var(--crisis); text-decoration: underline; text-underline-offset: 2px; }
.crisis-bar a:hover { color: var(--accent-deep); }
.crisis-bar .crisis-more {
  display: inline-block;
  margin-left: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Footer copyright spacing ---------- */
.site-footer .copy { margin-top: 6px; }

/* ---------- Books meta line / muted note ---------- */
.meta-muted { color: var(--text-muted); font-size: 0.9rem; }
.meta-muted.sm { font-size: 0.85rem; margin-top: 6px; }
.books-banner { margin-bottom: 28px; }
.action-toolbar { text-align: center; margin-top: 14px; }
.action-toolbar .btn { margin-right: 10px; }
.action-toolbar .btn:last-child { margin-right: 0; }
.mood-save-wrap { text-align: center; margin-top: 12px; }
.mood-history { margin-top: 12px; }
.mood-note {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 56px;
}
.mood-note:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.privacy-note { color: var(--text-muted); font-size: 0.9rem; }
.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.breadcrumb a { color: var(--accent-deep); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.tool-emoji svg,
.page-tag svg {
  display: inline-block;
  vertical-align: -0.2em;
}
.storage-mode {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 4px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}
.storage-mode input { margin-top: 3px; }
.file-btn { cursor: pointer; display: inline-flex; align-items: center; }
.xinyu-dialog {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.xinyu-dialog[hidden] { display: none !important; }
.xinyu-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 22, 0.45);
}
.xinyu-dialog-panel {
  position: relative;
  width: min(420px, 100%);
  background: var(--bg-elevated, var(--bg));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 20px 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18);
}
.xinyu-dialog-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.xinyu-dialog-body {
  margin: 0 0 18px;
  line-height: 1.6;
  color: var(--text-muted);
}
.xinyu-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.privacy-warn {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.55;
}
.privacy-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 8px; }
.verify-date { margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }
.search-crisis {
  display: none;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, #5a86a8 45%, var(--border));
  background: color-mix(in srgb, #5a86a8 12%, var(--bg-elevated, var(--bg)));
  color: var(--text);
  line-height: 1.6;
}
.search-crisis.show { display: block; }
.search-crisis p { margin: 6px 0 0; }
.search-crisis a { font-weight: 600; }
.hidden { display: none !important; }
.feel-name-flex { flex: 1; }
.btn-gap { margin-left: 10px; }

/* ---------- 404 ---------- */
.hero-404-code {
  font-size: 5rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
  font-weight: 700;
}
.hero-back { margin-top: 28px; }
.narrow-section { max-width: 560px; margin: 0 auto 40px; }
.quick-links.single-col { grid-template-columns: 1fr; }
.quick-links.spaced { margin-top: 14px; }

/* ---------- Tool grid last-row (3-col: 10 tools without resources) ---------- */
@media (min-width: 1200px) {
  .tool-grid:not(.tool-grid--with-resources) .tool-card:nth-last-child(2):nth-child(3n+1),
  .tool-grid:not(.tool-grid--with-resources) .tool-card:nth-last-child(1):nth-child(3n+2) {
    /* when last row has 1 leftover after pairs of 3: with 10 cards = 3+3+3+1 → span nicely */
  }
  /* 10 cards on 3-col: last row has 1. Make last 2 of previous? Better: span last card across remaining.
     Clean approach: 10 tools → last row 1 card spans full? Or last 2 of incomplete row center.
     With 10 items: rows of 3 leave 1. Span that one across 3 cols looks odd.
     Prefer: last incomplete row — if 1 leftover, span it; if 2 leftover, each span 1.5 via grid-column.
  */
  .tool-grid .tool-card:last-child:nth-child(3n+1) {
    grid-column: 1 / -1;
    max-width: 66%;
    justify-self: center;
    width: 100%;
  }
  .tool-grid .tool-card:nth-last-child(2):nth-child(3n+1) {
    grid-column: 1 / 2;
  }
  .tool-grid .tool-card:nth-last-child(1):nth-child(3n+2) {
    grid-column: 2 / 3;
  }
}

/* When resources removed: 10 cards → last row has 1 (nth-child 10 = 3n+1). Spans full centered. Good.
   If 2 leftover (e.g. 11): nth-last 2 is 3n+1 and last is 3n+2 — handled above but first rule also matches last when it's 3n+1 only.
*/

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .breath-box .dot { animation: none !important; opacity: 0.45; transform: none !important; }
  .tool-card:hover,
  .quick-link:hover,
  .theme-toggle:hover {
    transform: none !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- Tel / hotline links in content ---------- */
a[href^="tel:"] { color: var(--accent-deep); font-weight: 600; text-decoration: none; }
a[href^="tel:"]:hover { text-decoration: underline; }

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

.result-quote { font-size: 1.05rem; font-style: italic; margin: 0 0 8px; line-height: 2; }
.result-hint { margin: 0; font-size: 0.88rem; color: var(--text-muted); }
.result-hint.sm { font-size: 0.85rem; }
.score-delta-wrap { align-self: flex-end; }
.theme-panel[hidden] { display: none !important; }

/* ---------- Print ---------- */
@media print {
  .skip-link,
  .site-header,
  .nav-toggle,
  .theme-toggle,
  .theme-btn,
  .theme-panel,
  .search-box,
  .privacy-actions,
  .back-home {
    display: none !important;
  }
  .crisis-bar {
    position: static !important;
    box-shadow: none !important;
    border: 1px solid #999;
    break-inside: avoid;
  }
  body {
    background: #fff !important;
    color: #111 !important;
  }
  a[href^="tel:"]::after {
    content: "（" attr(href) "）";
    font-size: 0.85em;
    font-weight: 400;
    color: #333;
  }
  .container,
  .tool-page {
    max-width: none;
  }
}
