/* ============================================================
   心屿 · Xinyu — 匿名心理分享与陪伴
   设计语言：温暖治愈 / 低饱和暖色 / 柔和亲善
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  color-scheme: light;
  --hue: 58;                 /* 暖杏主色相 */

  /* 表面 */
  --bg:        oklch(96.6% 0.018 82);
  --surface:   oklch(99.2% 0.008 82);
  --surface-2: oklch(93.8% 0.024 80);
  --surface-3: oklch(91% 0.032 78);

  /* 强调色：珊瑚暖橙 */
  --primary:        oklch(63% 0.13 55);
  --primary-strong: oklch(55% 0.14 52);
  --primary-soft:   oklch(88% 0.062 60);
  --primary-xsoft:  oklch(94.5% 0.032 64);

  /* 语义 */
  --ok:      oklch(56% 0.11 156);
  --ok-soft: oklch(92% 0.05 156);
  --warn:    oklch(58% 0.12 62);
  --warn-soft:oklch(93% 0.055 70);
  --danger:    oklch(53% 0.15 32);
  --danger-soft: oklch(92.5% 0.045 35);
  --info:      oklch(56% 0.075 248);
  --info-soft: oklch(93% 0.03 248);

  /* 文字（向品牌色相方向微微偏暖） */
  --ink:   oklch(29% 0.038 50);
  --ink-2: oklch(43% 0.032 55);
  --ink-3: oklch(57% 0.026 60);
  --ink-disabled: oklch(74% 0.015 65);

  --line: oklch(87% 0.016 76);
  --line-soft: oklch(91% 0.014 78);

  --shadow-1: 0 1px 2px oklch(35% 0.03 55 / 0.05), 0 5px 16px oklch(35% 0.03 55 / 0.05);
  --shadow-2: 0 2px 6px oklch(35% 0.03 55 / 0.07), 0 16px 44px oklch(35% 0.03 55 / 0.09);

  --r-s: 12px; --r-m: 20px; --r-l: 30px;

  --font-display: "Noto Serif SC","Source Han Serif SC","Songti SC","STSong","NWYr",Georgia,"Times New Roman",serif;
  --font-body: "Segoe UI","Microsoft YaHei UI Variable","Microsoft YaHei UI","PingFang SC","Microsoft YaHei",system-ui,sans-serif;

  --body-weight: 400;
  --maxw: 1120px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:        oklch(18.5% 0.018 70);
  --surface:   oklch(22.5% 0.02 72);
  --surface-2: oklch(26.5% 0.024 72);
  --surface-3: oklch(31% 0.03 74);

  --primary:        oklch(74% 0.115 60);
  --primary-strong: oklch(80% 0.1 62);
  --primary-soft:   oklch(40% 0.075 60);
  --primary-xsoft:  oklch(30% 0.05 62);

  --ok:   oklch(76% 0.1 156);
  --ok-soft: oklch(32% 0.05 156);
  --warn: oklch(78% 0.1 70);
  --warn-soft: oklch(32% 0.05 70);
  --danger: oklch(70% 0.12 32);
  --danger-soft: oklch(30% 0.055 35);
  --info: oklch(74% 0.07 248);
  --info-soft: oklch(30% 0.03 248);

  --ink:   oklch(92% 0.012 78);
  --ink-2: oklch(80% 0.018 75);
  --ink-3: oklch(66% 0.02 72);
  --ink-disabled: oklch(48% 0.015 70);

  --line:       oklch(35% 0.02 72);
  --line-soft:  oklch(31% 0.02 72);
  --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.3), 0 5px 16px oklch(0% 0 0 / 0.24);
  --shadow-2: 0 2px 6px oklch(0% 0 0 / 0.32), 0 16px 44px oklch(0% 0 0 / 0.3);
  --body-weight: 350;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: var(--body-weight);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
}

h1,h2,h3,h4 {
  font-family: var(--font-display);
  line-height: 1.32;
  margin: 0 0 .5em;
  letter-spacing: .01em;
  font-weight: 650;
}
h1 { font-size: clamp(1.9rem, 4vw + .6rem, 3rem); }
h2 { font-size: clamp(1.45rem, 2.4vw + .6rem, 2.05rem); }
h3 { font-size: 1.22rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

::selection { background: var(--primary-soft); }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------- 布局骨架 ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  display: flex; align-items: center; gap: 20px;
  max-width: var(--maxw); margin-inline: auto;
  padding: 12px clamp(16px, 4vw, 32px);
}
.logo {
  display: flex; align-items: baseline; gap: 7px;
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.5rem; color: var(--ink);
  letter-spacing: .12em; white-space: nowrap;
}
.logo .dot { color: var(--primary); font-weight: 800; }
.logo .tag { font-size: .72rem; color: var(--ink-3); letter-spacing: .3em; font-weight: 500; }

.nav { display: flex; gap: 2px; margin-inline: auto; flex-wrap: wrap; }
.nav a {
  padding: 8px 13px; border-radius: 999px;
  color: var(--ink-2); font-size: .95rem; font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
.nav a:active { transform: scale(.96); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* 昵称胶囊 */
.me {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 18px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  font-size: .88rem; color: var(--ink-2); cursor: pointer;
  transition: box-shadow .18s ease, transform .18s ease;
}
.me:hover { box-shadow: var(--shadow-1); transform: translateY(-1px); }
.me .who { font-weight: 600; color: var(--ink); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line-soft); background: var(--surface);
  color: var(--ink-2); cursor: pointer;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.icon-btn:hover { background: var(--surface-2); box-shadow: var(--shadow-1); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }

/* 页脚 */
.foot { margin-top: 72px; border-top: 1px solid var(--line-soft); background: var(--surface-2); }
.foot-inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 40px clamp(16px, 4vw, 32px) 48px;
  display: grid; gap: 28px;
}
.foot-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: .12em; }
.foot .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; }
.foot h4 { font-size: .85rem; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 10px; font-weight: 600; }
.foot a { display: block; color: var(--ink-2); font-size: .92rem; padding: 3px 0; }
.foot a:hover { color: var(--primary-strong); }
.foot .legal { font-size: .8rem; color: var(--ink-3); }
.foot .heartline { font-size: .82rem; color: var(--ink-3); margin-top: 8px; }

/* 热线常驻横条 */
.hotline-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 55;
  background: color-mix(in oklch, var(--danger-soft) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid color-mix(in oklch, var(--danger) 25%, transparent);
  padding: 8px 16px; font-size: .88rem;
}
.hotline-bar .wrap { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; text-align: center; }
.hotline-bar b { color: var(--danger); }
.hotline-bar a {
  background: var(--danger); color: #fff; border-radius: 999px;
  padding: 4px 16px; font-weight: 600; margin-left: 4px;
  font-size: .9rem;
}
.hotline-bar a:hover { background: var(--primary-strong); text-decoration: none; }
.hotline-close {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--ink-3); cursor: pointer;
  font-size: 1.1rem; padding: 6px;
}

/* 页面主体留白（避免被热线条遮挡） */
.main { padding-bottom: 90px; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-family: inherit; font-size: .98rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease;
  min-height: 44px; touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); box-shadow: 0 8px 20px oklch(60% 0.13 55 / .35); }

.btn-soft { background: var(--primary-soft); color: var(--primary-strong); }
.btn-soft:hover { background: color-mix(in oklch, var(--primary-soft) 82%, var(--primary) 18%); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in oklch, var(--danger-soft) 80%, var(--danger) 20%); }

.btn-pill-sm { padding: 7px 15px; font-size: .86rem; min-height: 36px; }

.card {
  background: var(--surface);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
  padding: clamp(18px, 3vw, 26px);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: .82rem; font-weight: 500;
}
.chip.is-active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; font-size: .95rem; }
.input, .textarea, .select {
  width: 100%; padding: 12px 15px;
  border: 1.5px solid var(--line); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 1rem; line-height: 1.5;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-xsoft);
}
.textarea { resize: vertical; min-height: 120px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-disabled); }

/* 免责声明 */
.disclaimer {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warn-soft); color: var(--ink-2);
  border-radius: var(--r-s); padding: 12px 15px;
  font-size: .9rem; line-height: 1.6;
}
.disclaimer::before { content: "✳"; color: var(--warn); font-weight: 800; line-height: 1.4; }
.disclaimer.vertical::before { display: none; }

/* 危机卡片 */
.crisis-card {
  background: var(--danger-soft);
  border: 1.5px solid color-mix(in oklch, var(--danger) 32%, transparent);
  border-radius: var(--r-m);
  padding: clamp(18px, 3vw, 26px);
  margin: 18px 0;
}
.crisis-card h3 { color: var(--danger); margin-bottom: 10px; }
.crisis-card .hotline-num {
  font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800; color: var(--danger); letter-spacing: .04em;
  margin: 6px 0 2px;
}

/* 空状态 */
.empty {
  text-align: center; padding: 48px 20px; color: var(--ink-3);
}
.empty .mark { font-size: 2.6rem; margin-bottom: 8px; opacity: .9; }
.empty h4 { color: var(--ink-2); }

/* 徽标 */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; letter-spacing: .04em;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* 骨架屏 */
.ske { border-radius: var(--r-s); background: linear-gradient(100deg, var(--surface-2) 40%, var(--surface-3) 50%, var(--surface-2) 60%); background-size: 200% 100%; animation: sweepe 1.4s infinite linear; }
@keyframes sweepe { to { background-position: -200% 0; } }

/* Toast */
#toast-zone {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
.toast {
  background: var(--ink); color: var(--bg);
  padding: 11px 20px; border-radius: 999px; font-size: .92rem;
  box-shadow: var(--shadow-2); opacity: 0; transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: auto; text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* 模态 */
.modal-mask {
  position: fixed; inset: 0; z-index: 120;
  background: oklch(18% 0.02 60 / .45);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  padding: clamp(22px, 4vw, 34px);
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  animation: rise .28s cubic-bezier(.2,.8,.3,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h3 { margin-bottom: 14px; }

/* 折叠面板 */
details.fold { background: var(--surface-2); border-radius: var(--r-m); padding: 4px 18px; margin-bottom: 12px; }
details.fold summary {
  cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  list-style: none;
}
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::after { content: "+"; font-size: 1.3rem; color: var(--primary); transition: transform .2s ease; }
details.fold[open] summary::after { transform: rotate(45deg); }

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(48px, 8vw, 96px) 0 clamp(36px, 6vw, 72px);
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(640px 360px at 18% 12%, var(--primary-xsoft), transparent 65%),
    radial-gradient(560px 340px at 84% 20%, oklch(90% 0.05 140 / .5), transparent 60%),
    radial-gradient(600px 420px at 60% 110%, oklch(90% 0.05 40 / .5), transparent 62%);
  z-index: -1;
}
.hero .hello { font-family: var(--font-display); font-size: 1.05rem; color: var(--primary-strong); letter-spacing: .34em; margin-bottom: 14px; font-weight: 600; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw + .6rem, 3.6rem); letter-spacing: .05em; }
.hero .sub { max-width: 44ch; margin: 14px auto 26px; color: var(--ink-2); font-size: 1.08rem; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .anon-note { margin-top: 22px; font-size: .86rem; color: var(--ink-3); }

/* 模块入口网格 */
.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin-top: 26px; }
.entry {
  display: block; position: relative;
  background: var(--surface); border-radius: var(--r-l);
  box-shadow: var(--shadow-1);
  padding: 28px 26px; color: var(--ink);
  transition: transform .22s cubic-bezier(.2,.8,.3,1), box-shadow .22s ease;
  overflow: hidden;
}
.entry:hover { transform: translateY(-5px); box-shadow: var(--shadow-2); text-decoration: none; color: var(--ink); }
.entry .ico {
  width: 52px; height: 52px; border-radius: 18px;
  display: grid; place-items: center; margin-bottom: 18px;
  font-size: 1.5rem;
}
.entry .ico svg { width: 26px; height: 26px; }
.entry h3 { margin-bottom: 8px; font-size: 1.18rem; }
.entry p { color: var(--ink-2); font-size: .94rem; margin: 0; }
.entry .go { position: absolute; right: 22px; bottom: 24px; font-size: .9rem; color: var(--primary-strong); opacity: 0; transform: translateX(-6px); transition: opacity .2s ease, transform .2s ease; font-weight: 600; }
.entry:hover .go { opacity: 1; transform: none; }

/* 分区 */
.section { margin-top: clamp(44px, 7vw, 72px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .more { color: var(--ink-3); font-size: .9rem; }

.fluent-list { position: relative; }
.fluent-list .tick { position: absolute; inset: 0 0 0 0; pointer-events: none; }

/* 文章卡 */
.article-card { display: block; background: var(--surface-2); border-radius: var(--r-m); padding: 20px 22px; color: var(--ink); transition: transform .2s ease, box-shadow .2s ease; height: 100%; }
.article-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); text-decoration: none; color: var(--ink); }
.article-card .meta { font-size: .78rem; color: var(--ink-3); margin-bottom: 8px; letter-spacing: .06em; }
.article-card h4 { margin: 0 0 6px; }
.article-card p { color: var(--ink-2); font-size: .9rem; margin: 0; }

/* ---------- 社区页 ---------- */
.compose-box { margin-bottom: 26px; }
.compose-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.compose-tabs .tab { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: .9rem; transition: all .16s ease; }
.compose-tabs .tab.is-on { background: var(--primary-soft); border-color: transparent; color: var(--primary-strong); font-weight: 600; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }

.post {
  background: var(--surface); border-radius: var(--r-m);
  box-shadow: var(--shadow-1); padding: 22px 24px; margin-bottom: 16px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.post:hover { box-shadow: var(--shadow-2); }
.post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.05rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}
.avatar.alt { background: linear-gradient(135deg, oklch(66% 0.1 48), oklch(58% 0.12 35)); }
.avatar.alt2 { background: linear-gradient(135deg, oklch(63% 0.1 200), oklch(55% 0.11 220)); }
.post-author { font-weight: 600; color: var(--ink); }
.post-time { font-size: .8rem; color: var(--ink-3); }
.post .cat {
  margin-left: auto; font-size: .78rem; font-weight: 600;
  padding: 3px 11px; border-radius: 999px;
  background: var(--primary-xsoft); color: var(--primary-strong);
}
.post-body { color: var(--ink-2); white-space: pre-wrap; word-break: break-word; margin-bottom: 14px; }
.post-body .fold-chunk { display: none; }
.post.expand .post-body .fold-chunk { display: inline; }
.post-actions { display: flex; gap: 6px; align-items: center; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; color: var(--ink-3);
  padding: 7px 12px; border-radius: 999px; font-size: .88rem; font-weight: 500; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.mini-btn:hover { background: var(--surface-2); color: var(--ink); }
.mini-btn.is-on { color: var(--primary-strong); }
.mini-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.mini-btn .heart { transition: transform .18s cubic-bezier(.2,.8,.3,1.5); }
.mini-btn.is-liked .heart { transform: scale(1.22); }

.replies { margin-top: 14px; padding-top: 6px; border-top: 1px dashed var(--line-soft); }
.reply { display: flex; gap: 10px; padding: 10px 0; font-size: .94rem; }
.reply .avatar { width: 30px; height: 30px; font-size: .82rem; }
.reply .rbody { flex: 1; min-width: 0; }
.reply-author { font-weight: 600; color: var(--ink-2); font-size: .88rem; }
.reply-text { color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.reply-time { font-size: .76rem; color: var(--ink-3); margin-top: 2px; }

.reply-box { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.reply-box input { flex: 1; }

/* ---------- 测评页 ---------- */
.scale-pick { display: grid; gap: 16px; margin-top: 8px; }
.scale-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border-radius: var(--r-m);
  box-shadow: var(--shadow-1); padding: 22px 24px; cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.scale-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.scale-card.is-on { border-color: var(--primary); }
.scale-card .s-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.scale-card .s-title { font-weight: 700; font-size: 1.12rem; font-family: var(--font-display); }
.scale-card .s-desc { color: var(--ink-2); font-size: .9rem; margin-top: 3px; }
.scale-card .s-note { color: var(--ink-3); font-size: .8rem; margin-top: 2px; }

.quiz { max-width: 760px; margin-inline: auto; }
.quiz-progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 26px; }
.quiz-progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s cubic-bezier(.2,.8,.3,1); }
.quiz-q { font-family: var(--font-display); font-weight: 650; font-size: 1.18rem; margin-bottom: 20px; min-height: 3.4em; }
.quiz-q .idx { color: var(--primary-strong); font-size: .86rem; letter-spacing: .1em; display: block; margin-bottom: 6px; font-weight: 600; }
.opt-list { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-s);
  padding: 13px 16px; cursor: pointer; background: var(--surface);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.opt:hover { border-color: var(--primary-soft); }
.opt.is-on { border-color: var(--primary); background: var(--primary-xsoft); }
.opt .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-soft); flex: none; display: grid; place-items: center; transition: all .15s ease; }
.opt.is-on .radio { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--primary-xsoft); }
.opt .txt { font-size: .98rem; color: var(--ink); }
.quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }

/* 结果 */
.result-hero { text-align: center; padding: 8px 0 10px; }
.score-ring {
  --val: 0;
  width: 150px; height: 150px; margin: 10px auto 6px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--surface) 79%, transparent 80% 100%),
    conic-gradient(var(--primary) calc(var(--val) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
}
.score-ring .num { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; }
.score-ring .lv { font-size: .78rem; color: var(--ink-3); }
.result-tag { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; margin: 4px 0 10px; }
.score-list { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.score-list li { display: flex; justify-content: space-between; background: var(--surface-2); padding: 12px 16px; border-radius: var(--r-s); font-size: .94rem; }

/* ---------- 陪伴页 ---------- */
.chat-shell {
  display: grid; grid-template-columns: 300px 1fr; gap: 18px;
  min-height: calc(100vh - 220px);
}
@media (max-width: 860px) { .chat-shell { grid-template-columns: 1fr; } }
.chat-side { display: flex; flex-direction: column; gap: 14px; }
.ai-intro { background: var(--surface-2); border-radius: var(--r-m); padding: 20px; font-size: .9rem; color: var(--ink-2); }
.ai-intro h4 { color: var(--ink); margin-bottom: 8px; }
.chat-tips { font-size: .82rem; color: var(--ink-3); }

.chat-main { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); overflow: hidden; }
.chat-head { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; }
.chat-head .status { font-size: .8rem; color: var(--ink-3); }
.chat-head .status b { color: var(--ok); }
.chat-head .st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.chat-head .st-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

.chat-log { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.msg { display: flex; gap: 12px; max-width: 84%; }
.msg.ai { align-self: flex-start; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .b { background: var(--surface-2); border-radius: 18px 18px 18px 4px; padding: 12px 16px; font-size: .96rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.me .b { background: var(--primary); color: #fff; border-radius: 18px 18px 4px 18px; }
.msg .who { font-size: .76rem; color: var(--ink-3); margin-bottom: 3px; }
.msg.me .who { text-align: right; }
.msg.typing .b { color: var(--ink-3); }

.chat-bar { border-top: 1px solid var(--line-soft); padding: 14px; display: flex; gap: 12px; align-items: flex-end; }
.chat-bar textarea { flex: 1; min-height: 48px; max-height: 160px; resize: none; }
.chat-bar .send { width: 48px; height: 48px; border-radius: 50%; flex: none; padding: 0; display: grid; place-items: center; }
.chat-bar .send svg { width: 20px; height: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 14px; }
.qchip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 7px 14px; font-size: .84rem; cursor: pointer; transition: all .15s ease; }
.qchip:hover { background: var(--primary-soft); border-color: transparent; color: var(--primary-strong); }

/* 接入配置说明 */
.setup-steps { display: grid; gap: 14px; margin-top: 16px; }
.setup-steps .step { display: flex; gap: 14px; align-items: flex-start; }
.setup-steps .n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.setup-steps code { background: var(--surface-2); padding: 2px 7px; border-radius: 6px; font-size: .86em; }

/* ---------- 知识库 & 练习 ---------- */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.kb-tag { font-size: .78rem; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.kb-tag.t1 { background: var(--primary-xsoft); color: var(--primary-strong); }
.kb-tag.t2 { background: var(--info-soft); color: var(--info); }
.kb-tag.t3 { background: var(--ok-soft); color: var(--ok); }
.kb-tag.t4 { background: var(--warn-soft); color: var(--warn); }

.exercise-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 10px; }
.exercise { background: var(--surface-2); border-radius: var(--r-l); padding: 26px; display: flex; flex-direction: column; }
.exercise .e-ico { font-size: 1.7rem; margin-bottom: 12px; }
.exercise h3 { margin-bottom: 8px; }
.exercise p { color: var(--ink-2); font-size: .92rem; flex: 1; }
.exercise .step-list { list-style: none; padding: 0; margin: 8px 0 18px; display: grid; gap: 8px; font-size: .9rem; color: var(--ink-2); counter-reset: s; }
.exercise .step-list li { display: flex; gap: 10px; counter-increment: s; align-items: flex-start; }
.exercise .step-list li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); font-size: .76rem; font-weight: 700; display: grid; place-items: center; margin-top: 2px; }

/* 呼吸练习 */
.breath-stage { position: relative; height: 330px; display: grid; place-items: center; margin: 16px 0; }
.breath-dot {
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--primary-xsoft), var(--primary-soft) 58%, var(--primary) 100%);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-family: var(--font-display);
  letter-spacing: .18em; font-size: 1.05rem;
  box-shadow: 0 0 0 0 var(--primary-xsoft);
  transition: none;
}
.breath-dot.breathe-in { animation: breatheIn 4s cubic-bezier(.45,0,.55,1) forwards; }
.breath-dot.breathe-hold { animation: breatheHold 7s linear forwards; }
.breath-dot.breathe-out { animation: breatheOut 8s cubic-bezier(.45,0,.55,1) forwards; }
@keyframes breatheIn { from { transform: scale(1); } to { transform: scale(1.32); } }
@keyframes breatheHold { from, to { transform: scale(1.32); } }
@keyframes breatheOut { from { transform: scale(1.32); } to { transform: scale(1); } }
.breath-phase { text-align: center; font-size: 1.15rem; color: var(--ink-2); min-height: 2em; font-weight: 500; }
.breath-count { text-align: center; font-size: 2.4rem; font-family: var(--font-display); font-weight: 800; color: var(--primary-strong); }
.breath-ctl { text-align: center; margin: 18px 0 6px; }

.timer-big { font-family: var(--font-display); font-size: 3rem; font-weight: 800; text-align: center; color: var(--primary-strong); margin: 12px 0; }

/* ---------- 安全与帮助 ---------- */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-top: 10px; }

/* ---------- 补充：分节/通用网格/标签 ---------- */
.sect-tag {
  display: inline-block; font-family: var(--font-display); font-size: .98rem;
  color: var(--primary-strong); letter-spacing: .34em; margin-bottom: 10px; font-weight: 600;
}
.sec-title { margin: 0 0 6px; }
.sec-title .muted { font-family: var(--font-body); font-size: .92rem; color: var(--ink-3); font-weight: 400; letter-spacing: 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 10px; }
.hero-center { text-align: center; }
.hero-center .sub { margin-inline: auto; max-width: 46ch; }

/* 通用 tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 20px; }
.tabs .tab {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: .9rem;
  transition: all .16s ease; font-family: var(--font-body);
}
.tabs .tab:hover { border-color: var(--primary-soft); }
.tabs .tab.is-on { background: var(--primary-soft); border-color: transparent; color: var(--primary-strong); font-weight: 600; }

/* 文章网格 */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.article-card { object-fit: contain; }
.article-card .badge { margin-bottom: 8px; }

/* 练习卡片 */
.exercise-card { position: relative; cursor: pointer; overflow: hidden; padding: 26px 24px; }
.exercise-card:hover { box-shadow: var(--shadow-2); transform: translateY(-3px); }
.ex-ico {
  width: 50px; height: 50px; border-radius: 16px;
  display: grid; place-items: center; font-size: 1.5rem; margin-bottom: 14px;
}
.ex-meta { font-size: .78rem; color: var(--ink-3); letter-spacing: .02em; }
.tappable { transition: transform .2s cubic-bezier(.2,.8,.3,1), box-shadow .2s ease; }
.tappable:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.tappable-link { cursor: default; }
.tappable-link .ex-ico { margin-bottom: 12px; }
.tappable-link h4 { margin-bottom: 6px; }
.tappable-link p { font-size: .9rem; color: var(--ink-2); margin: 0; }

/* ---------- 练习面板 ---------- */
.practice {
  background: var(--surface); border-radius: var(--r-l);
  box-shadow: var(--shadow-2); padding: clamp(22px, 4vw, 40px); margin-top: 26px;
}
.practice-head { text-align: center; margin-bottom: 18px; }
.practice-head h3 { margin-bottom: 6px; }
.practice-stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  background: var(--surface-2); border-radius: var(--r-m);
  padding: clamp(20px, 4vw, 34px); margin-top: 6px;
}
.timer-ring { position: relative; width: 170px; height: 170px; flex: none; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.timer-ring .track { stroke: var(--surface-3); }
.timer-ring .bar {
  stroke: var(--primary);
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .1s linear;
}
.timer-center {
  position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center; gap: 2px;
}
.timer-num { font-family: var(--font-display); font-size: 2.3rem; font-weight: 800; color: var(--primary-strong); line-height: 1.1; }
.timer-phase { font-size: .8rem; color: var(--ink-3); max-width: 120px; }
.practice-step { text-align: center; max-width: 46ch; margin-inline: auto; }
.phase-badge {
  display: inline-block; padding: 5px 16px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-strong);
  font-weight: 600; font-size: .92rem;
}

/* ---------- 安全页：危机大卡片 ---------- */
.crisis-card.static { margin: 0; }
.crisis-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.crisis-ico { font-size: 2rem; flex: none; }
.crisis-title { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--danger); }
.crisis-sub { color: var(--ink-2); margin: 4px 0 0; font-size: .95rem; }
.crisis-body { margin-top: 8px; }
.hotline-big {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface-2); border-radius: var(--r-m);
  padding: 18px 20px; margin-bottom: 18px;
}
.hotline-num { font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 800; color: var(--danger); letter-spacing: .03em; }
.hotline-label { color: var(--ink-2); font-size: .92rem; margin-inline-end: auto; }
.crisis-card .hotline-big .hotline-num { margin: 0; }
.crisis-steps { display: grid; gap: 10px; }
.crisis-steps .cs { display: flex; gap: 12px; align-items: flex-start; }
.crisis-steps .cs b {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--danger); color: #fff; display: grid; place-items: center; font-size: .86rem;
}
.crisis-steps .cs span { color: var(--ink-2); font-size: .95rem; padding-top: 2px; }
.crisis-note { font-size: .88rem; color: var(--ink-3); margin: 16px 0 0; }
a.lk { color: var(--danger); font-weight: 600; }

/* 说明列表 */
.plain-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 12px; }
.plain-list li { position: relative; padding-left: 26px; color: var(--ink-2); line-height: 1.85; font-size: .98rem; }
.plain-list li::before { content: "✦"; position: absolute; left: 0; top: 0; color: var(--primary); font-weight: 700; }
.plain-list b { color: var(--ink); }

/* AI 消息错误态 */
.msg.error .b { border: 1px solid color-mix(in oklch, var(--danger) 35%, transparent); color: var(--danger); background: var(--danger-soft); }

/* 危机区占位（发布页） */
#crisis-zone { margin-top: 20px; }

/* 无障碍动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
}

/* 移动端导航 */
.nav-toggle { display: none; }
@media (max-width: 880px) {
  .nav-toggle { display: inline-grid; }
  .nav {
    position: fixed; top: 62px; left: 0; right: 0; z-index: 59;
    flex-direction: column; background: var(--surface);
    box-shadow: var(--shadow-2); padding: 12px 18px 20px; gap: 4px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: var(--r-s); }
  .topbar-inner { flex-wrap: wrap; }
  .topbar-actions .me .who-text { display: none; }
  .msg { max-width: 96%; }
}
