:root {
  --bg: #FAF6F0;
  --card: #FFFFFF;
  --ink: #2B2622;
  --ink-2: #6B6158;
  --line: #E9E1D6;
  --brand: #B8452F;
  --brand-2: #D97742;
  --gold: #C9A227;
  --green: #2F8F6B;
  --shadow: 0 6px 24px rgba(58, 42, 28, .08);
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.65;
  padding-bottom: 84px;
}
h1, h2, h3, .serif { font-family: "Noto Serif SC", "Songti SC", Georgia, serif; }
a { color: var(--brand); }
button { font-family: inherit; font-size: 16px; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 16px; }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 14px; }

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 246, 240, .92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 680px; margin: 0 auto; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.brand { font-family: "Noto Serif SC", serif; font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.brand small { display: block; font-size: 11px; color: var(--ink-2); font-weight: 400; letter-spacing: 1px; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none;
}

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 14px 0; }
.card.tight { padding: 13px; }

/* ---------- 今日故事 ---------- */
.today { background: linear-gradient(135deg, #FFF9F0 0%, #FDF1E6 100%); border-color: #F0DFC9; }
.today .daytag { display: inline-block; background: var(--brand); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 999px; letter-spacing: .5px; }
.today .ttl { font-family: "Noto Serif SC", serif; font-size: 22px; font-weight: 700; margin: 8px 0 4px; }
.today .meta { font-size: 12.5px; color: var(--ink-2); }
.today .point { margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--gold); color: #7a5c1e; font-size: 14.5px; }

/* ---------- 表单 ---------- */
.field { margin: 12px 0; }
.field label { display: block; font-size: 13.5px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.field label .hint { font-weight: 400; color: #A79B8E; }
textarea, input[type=text], input[type=password], input[type=date], select {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #FCFAF7; color: var(--ink); outline: none; transition: border-color .15s, background .15s;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
textarea:focus, input:focus, select:focus { border-color: var(--brand-2); background: #fff; }
.field.step { position: relative; padding-left: 30px; }
.field.step .num {
  position: absolute; left: 0; top: 24px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.btn {
  width: 100%; padding: 13px; border: none; border-radius: 12px; background: var(--brand); color: #fff;
  font-weight: 700; letter-spacing: 1px; transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.small { width: auto; padding: 7px 14px; font-size: 14px; border-radius: 9px; }
.btn.gray { background: #EFEAE3; color: var(--ink-2); }
.btn:disabled { opacity: .5; }

/* ---------- 心情 / 类型 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #FCFAF7;
  font-size: 14px; color: var(--ink-2); user-select: none;
}
.chip.on { background: #FDEEE9; border-color: var(--brand-2); color: var(--brand); font-weight: 600; }

/* ---------- 附件 ---------- */
.attach-row { display: flex; gap: 10px; margin-top: 6px; }
.attach-btn { flex: 1; padding: 11px; border: 1.5px dashed #D9CDBC; border-radius: 12px; background: #FCFAF7; color: var(--ink-2); font-size: 14.5px; text-align: center; }
.attach-btn.rec { border-color: #E2A0A0; color: #B8452F; }
.preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preview .item { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: #EFEAE3; display: flex; align-items: center; justify-content: center; }
.preview .item img { width: 100%; height: 100%; object-fit: cover; }
.preview .item audio { width: 100%; height: 34px; }
.preview .item.audio { width: auto; min-width: 180px; }
.preview .del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; border: 2px solid #fff; font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.rec-live { color: #B8452F; font-weight: 600; font-size: 14px; margin-top: 8px; }

/* ---------- 打卡卡片（动态流） ---------- */
.feed-head { display: flex; align-items: center; gap: 8px; }
.feed-head .who { font-weight: 700; }
.feed-head .when { font-size: 12.5px; color: #A79B8E; margin-left: auto; }
.tagline { font-size: 12px; color: var(--brand); background: #FDEEE9; border-radius: 6px; padding: 1px 8px; display: inline-block; margin-bottom: 6px; }
.part { margin: 8px 0; }
.part .k { font-size: 12px; color: var(--gold); font-weight: 700; letter-spacing: .5px; }
.part .v { white-space: pre-wrap; word-break: break-word; }
.mediagrid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mediagrid img { width: calc(33.3% - 6px); border-radius: 10px; aspect-ratio: 1; object-fit: cover; }
.mediagrid audio { width: 100%; }
.actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.act { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px; background: #F6F1EA; color: var(--ink-2); font-size: 14px; }
.act.on { background: #FDEEE9; color: var(--brand); font-weight: 600; }
.comments { margin-top: 10px; background: #FBF8F4; border-radius: 12px; padding: 8px 12px; }
.comment { font-size: 14.5px; padding: 5px 0; border-bottom: 1px dashed #EDE5DA; }
.comment:last-child { border-bottom: none; }
.comment .au { font-weight: 700; }
.comment.admin .au { color: var(--brand); }
.comment.admin { background: #FFF6F1; margin: 4px -6px; padding: 6px 8px; border-radius: 8px; border: none; }
.comment .t { color: #A79B8E; font-size: 11.5px; margin-left: 6px; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; padding: 9px 12px; border-radius: 10px; }
.comment-form button { padding: 0 16px; border: none; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 600; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  display: flex; padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar button { flex: 1; background: none; border: none; color: #A79B8E; font-size: 12px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabbar button .ic { font-size: 20px; line-height: 1; }
.tabbar button.on { color: var(--brand); font-weight: 700; }

/* ---------- 登录 ---------- */
.login-wrap { max-width: 420px; margin: 0 auto; padding: 40px 18px; }
.login-logo { text-align: center; margin: 24px 0 10px; }
.login-logo .seal {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex; align-items: center; justify-content: center; font-family: "Noto Serif SC", serif;
  font-size: 30px; font-weight: 700; box-shadow: 0 10px 26px rgba(184,69,47,.28);
}
.login-title { font-family: "Noto Serif SC", serif; font-size: 22px; font-weight: 700; }
.login-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }

/* ---------- 统计 ---------- */
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #FCFAF7; border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; }
.stat .n { font-size: 24px; font-weight: 800; color: var(--brand); font-family: "Noto Serif SC", serif; }
.stat .l { font-size: 12px; color: var(--ink-2); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.cal .c { aspect-ratio: 1; border-radius: 6px; background: #EFEAE3; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #B5AA9C; }
.cal .c.on { background: var(--brand); color: #fff; font-weight: 700; }

.muted { color: var(--ink-2); font-size: 13.5px; }
.center { text-align: center; }
.empty { text-align: center; color: #A79B8E; padding: 34px 10px; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 100;
  background: rgba(43,38,34,.94); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap2 { flex-wrap: wrap; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #F1ECE4; color: var(--ink-2); }
.pill.green { background: #E7F4EE; color: var(--green); }
.pill.red { background: #FBEAEA; color: #C0392B; }
hr.soft { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

.btn.wecom { background: #2E7DF7; letter-spacing: .5px; }
.btn.wecom::before { content: '🏢  '; }
.copybox { background: #F4F1EC; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; color: #3A342E; }

.quote-item .qtext { font-family: "Noto Serif SC", serif; font-size: 18px; line-height: 1.6; color: #2B2622; padding-left: 12px; border-left: 3px solid var(--gold); }

/* ---------- 日期条 / 锁定提示 ---------- */
.daybar { display: flex; gap: 7px; overflow-x: auto; padding: 4px 2px 10px; }
.daychip { white-space: nowrap; padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink-2); font-size: 13px; }
.daychip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.locknote { margin-top: 10px; padding: 8px 12px; background: #F4F1EC; border-radius: 10px; color: #8A7E70; font-size: 13.5px; }

/* ---------- 国学经典诵读 ---------- */
.classic { background: linear-gradient(135deg, #FCFAF3 0%, #F7F1E3 100%); border-color: #E7DCC2; }
.classic-src { font-size: 12.5px; color: #9A7B34; letter-spacing: 1px; margin-top: 6px; }
.classic-text { font-family: "Noto Serif SC", "Songti SC", Georgia, serif; font-size: 19px; line-height: 2; color: #2B2622; margin: 12px 0; letter-spacing: 1px; }
.nextup { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #E7DCC2; }
.zy { margin: 12px 0 4px; line-height: 1.25; }
.zy .pr { display: inline-block; text-align: center; margin: 0 1px 8px; vertical-align: top; }
.zy .pr i { display: block; font-style: normal; font-family: Georgia, "Times New Roman", serif; font-size: 10.5px; color: #A88A3C; min-height: 13px; letter-spacing: .2px; white-space: nowrap; }
.zy .pr b { display: block; font-family: "Noto Serif SC", "Songti SC", serif; font-size: 19px; font-weight: 600; color: #2B2622; }
.recite-item .v { line-height: 1.7; }
.tabbar button { font-size: 11px; }
.tabbar button .ic { font-size: 19px; }

/* ---------- 周报 ---------- */
.rp-grid { display: flex; gap: 6px; margin-top: 10px; }
.rp-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rp-wd { font-size: 11px; color: #A79B8E; }
.rp-dot { width: 100%; text-align: center; font-size: 13px; opacity: .22; filter: grayscale(1); background: #F4F1EC; border-radius: 8px; padding: 4px 0; }
.rp-dot.on { opacity: 1; filter: none; background: #FDEEE9; }

/* ---------- AI 悬浮助手 ---------- */
.ai-fab { position: fixed; right: 16px; bottom: 92px; z-index: 60; width: 52px; height: 52px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 24px; box-shadow: 0 8px 22px rgba(184,69,47,.35); }
.ai-fab:active { transform: scale(.94); }
.ai-panel { position: fixed; right: 12px; bottom: 84px; z-index: 61; width: min(94vw, 380px); height: min(72vh, 560px); min-width: 260px; min-height: 300px; max-width: 96vw; max-height: 92vh; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 48px rgba(58,42,28,.22); display: flex; flex-direction: column; overflow: hidden; resize: both; }
.ai-panel.dragging { box-shadow: 0 26px 64px rgba(58,42,28,.3); }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: linear-gradient(135deg, #FFF6F1, #FDEEE9); border-bottom: 1px solid var(--line); cursor: move; user-select: none; touch-action: none; }
.ai-head::before { content: '⠿'; color: #C9BDAF; margin-right: 2px; }
.ai-head b { flex: 1; font-family: "Noto Serif SC", serif; }
.ai-close { border: none; background: none; font-size: 22px; line-height: 1; color: #A79B8E; }
.ai-body { flex: 1; overflow-y: auto; padding: 12px; background: #FCFAF7; }
.ai-msg { max-width: 84%; padding: 9px 13px; border-radius: 14px; margin-bottom: 9px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.ai-msg.ai { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-msg.me { background: var(--brand); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.ai-quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px; border-top: 1px solid var(--line); background: #fff; }
.ai-chip { white-space: nowrap; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: #FCFAF7; color: var(--ink-2); font-size: 12.5px; }
.ai-input { display: flex; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); background: #fff; }
.ai-input textarea { flex: 1; resize: none; min-height: 38px; max-height: 96px; padding: 9px 12px; border-radius: 12px; }
.ai-input button { width: 52px; border: none; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; }

/* ---------- 每日内容正文 ---------- */
.content-body details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.content-body details:last-child { border-bottom: none; }
.content-body summary {
  cursor: pointer; font-weight: 700; font-family: "Noto Serif SC", serif; font-size: 16px;
  padding: 10px 2px; list-style: none; display: flex; align-items: center; gap: 8px;
}
.content-body summary::-webkit-details-marker { display: none; }
.content-body summary::before { content: '▸'; color: var(--brand); transition: transform .15s; }
.content-body details[open] > summary::before { transform: rotate(90deg); }
.content-body summary:hover { color: var(--brand); }
.md { padding: 2px 2px 12px; color: #3A342E; font-size: 15.5px; }
.md h2 { font-size: 19px; margin: 10px 0 6px; }
.md h3 { font-size: 17px; margin: 12px 0 6px; color: var(--brand); }
.md h4 { font-size: 15.5px; margin: 12px 0 4px; color: #8a6b1f; }
.md p { margin: 7px 0; }
.md ul, .md ol { margin: 7px 0; padding-left: 22px; }
.md li { margin: 4px 0; }
.md blockquote {
  margin: 9px 0; padding: 8px 12px; background: #FFF9F0; border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0; color: #6b5620;
}
.md code { background: #F1ECE4; padding: 1px 5px; border-radius: 5px; font-size: 13.5px; }
.md strong { color: #2B2622; }
.qbox { background: linear-gradient(135deg, #FFFDF8, #FDF3E8); border-color: #F0DFC9; }
.qbox ol { margin: 8px 0 12px; padding-left: 22px; }
.qbox li { margin: 6px 0; }
.badge-new { font-size: 10px; background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }

/* ---------- 后台 ---------- */
.admin-top { background: #2B2622; color: #fff; }
.admin-top .brand small { color: #C9BDAF; }
.admin-top .tabbar-inline button { background: rgba(255,255,255,.08); border: none; color: #E8DFD4; padding: 7px 14px; border-radius: 999px; font-size: 14px; }
.admin-top .tabbar-inline button.on { background: var(--brand); color: #fff; font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-2); font-size: 12.5px; font-weight: 700; background: #FBF8F4; position: sticky; top: 0; }
.bar { height: 8px; border-radius: 999px; background: #EFEAE3; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.mini-chart { display: flex; align-items: flex-end; gap: 6px; height: 70px; }
.mini-chart .b { flex: 1; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 5px 5px 0 0; min-height: 3px; position: relative; }
.mini-chart .b span { position: absolute; bottom: -17px; left: 0; right: 0; text-align: center; font-size: 10px; color: #A79B8E; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; }
.tabs button { white-space: nowrap; padding: 7px 15px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink-2); }
.tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* ============ AI 陪伴助手 · 美化版（覆盖前面的样式） ============ */
.ai-fab {
  right: 18px; bottom: 96px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(140deg, #C64B31 0%, #E08A4E 100%);
  color: #fff; font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(184,69,47,.38), 0 2px 6px rgba(184,69,47,.2);
  transition: transform .16s ease, box-shadow .16s ease;
}
.ai-fab::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(224,138,78,.55); animation: aiPulse 2.6s ease-out infinite;
}
@keyframes aiPulse { 0% { transform: scale(.86); opacity: .9; } 70% { transform: scale(1.2); opacity: 0; } 100% { opacity: 0; } }
.ai-fab:hover { transform: translateY(-2px) scale(1.04); }
.ai-fab:active { transform: scale(.94); }

.ai-panel {
  right: 14px; bottom: 90px; z-index: 61;
  width: min(94vw, 392px); height: min(74vh, 580px);
  min-width: 268px; min-height: 320px; max-width: 96vw; max-height: 92vh;
  background: #fff; border: 1px solid #F0E4D8; border-radius: 22px;
  box-shadow: 0 24px 60px rgba(58,42,28,.24), 0 2px 8px rgba(58,42,28,.06);
  display: flex; flex-direction: column; overflow: hidden; resize: both;
  animation: aiIn .22s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes aiIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.ai-panel.dragging { box-shadow: 0 34px 76px rgba(58,42,28,.32); }

.ai-head {
  display: flex; align-items: center; gap: 9px; padding: 12px 14px;
  background: linear-gradient(135deg, #C64B31 0%, #DD7F45 100%);
  color: #fff; cursor: move; user-select: none; touch-action: none;
}
.ai-head::before { content: none; }
.ai-head .ai-grip { color: rgba(255,255,255,.62); font-size: 13px; letter-spacing: -1px; cursor: move; }
.ai-head .ai-fold { border: none; background: rgba(255,255,255,.22); color: #fff; border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 700; flex: none; }
.ai-head .ai-fold:hover { background: rgba(255,255,255,.34); }
.ai-head .ai-av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.45);
  display: flex; align-items: center; justify-content: center;
  font-family: "Noto Serif SC", serif; font-size: 14px;
}
.ai-head .ai-tt { flex: 1; line-height: 1.3; }
.ai-head .ai-tt b { display: block; font-family: "Noto Serif SC", serif; font-size: 15px; letter-spacing: .5px; }
.ai-head .ai-tt span { font-size: 11px; opacity: .85; }
.ai-close { border: none; background: rgba(255,255,255,.16); color: #fff; width: 26px; height: 26px; border-radius: 50%; font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.ai-close:hover { background: rgba(255,255,255,.3); }

.ai-body { flex: 1; overflow-y: auto; padding: 14px 12px 6px; background: linear-gradient(180deg, #FFFDFA 0%, #FAF5EF 100%); }
.ai-msg {
  max-width: 84%; padding: 10px 13px; border-radius: 16px; margin: 0 0 11px 30px;
  position: relative; font-size: 14.5px; line-height: 1.68; white-space: pre-wrap; word-break: break-word;
}
.ai-msg::before {
  content: '伴'; position: absolute; left: -30px; top: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(140deg, #C64B31, #E08A4E); color: #fff;
  font-family: "Noto Serif SC", serif; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.ai-msg.ai { background: #fff; border: 1px solid #F1E6DA; border-top-left-radius: 5px; box-shadow: 0 2px 6px rgba(58,42,28,.05); }
.ai-msg.me { background: linear-gradient(135deg, #C64B31, #DD7F45); color: #fff; margin-left: auto; border-bottom-right-radius: 5px; }
.ai-msg.me::before { display: none; }
.ai-typing { display: inline-flex; gap: 3px; align-items: center; padding: 2px 0; }
.ai-typing i { width: 5px; height: 5px; border-radius: 50%; background: #D8C6B4; animation: aiDot 1.1s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .16s; }
.ai-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes aiDot { 0%, 80%, 100% { transform: translateY(0); opacity: .55; } 40% { transform: translateY(-4px); opacity: 1; } }

.ai-quick { display: flex; gap: 7px; overflow-x: auto; padding: 9px 12px; background: #fff; border-top: 1px solid #F3EAE0; scrollbar-width: none; }
.ai-quick::-webkit-scrollbar { display: none; }
.ai-chip { white-space: nowrap; padding: 6px 12px; border-radius: 999px; border: 1px solid #EDE0D2; background: #FFFBF6; color: #8A6B52; font-size: 12.5px; transition: background .14s, border-color .14s, color .14s; }
.ai-chip:hover { background: #FDEEE9; border-color: #E7BFAE; color: var(--brand); }

.ai-input { display: flex; gap: 8px; padding: 9px 11px calc(9px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #F3EAE0; align-items: flex-end; }
.ai-input textarea { flex: 1; resize: none; min-height: 40px; max-height: 108px; padding: 10px 14px; border-radius: 20px; background: #FAF6F1; border: 1px solid #F0E6DA; }
.ai-input textarea:focus { background: #fff; }
.ai-input button { width: 44px; height: 44px; flex: none; border: none; border-radius: 50%; background: linear-gradient(140deg, #C64B31, #DD7F45); color: #fff; font-size: 16px; box-shadow: 0 4px 12px rgba(184,69,47,.3); }

/* ============ AI 陪伴助手 · 绿色主题 + 手机适配 ============ */
.ai-fab { background: linear-gradient(140deg, #2E8B6B 0%, #5BC193 100%); box-shadow: 0 10px 26px rgba(46,139,107,.4), 0 2px 6px rgba(46,139,107,.22); }
.ai-fab::after { border-color: rgba(91,193,147,.6); }
.ai-panel { border-color: #D8EDE2; }
.ai-head { background: linear-gradient(135deg, #2E8B6B 0%, #57BC8E 100%); }
.ai-head .ai-av { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.5); }
.ai-msg::before { background: linear-gradient(140deg, #2E8B6B, #5BC193); }
.ai-msg.ai { border-color: #E3F1EA; }
.ai-msg.me { background: linear-gradient(135deg, #2E8B6B, #57BC8E); }
.ai-typing i { background: #B9DBC9; }
.ai-quick { border-top-color: #E6F3EC; }
.ai-chip { border-color: #D9EDE4; background: #F7FCF9; color: #4A8471; }
.ai-chip:hover { background: #EAF7F1; border-color: #A9D9C3; color: #2E8B6B; }
.ai-input { border-top-color: #E6F3EC; }
.ai-input textarea { background: #F5FAF7; border-color: #E2F0E8; }
.ai-input textarea:focus { border-color: #A9D9C3; }
.ai-input button { background: linear-gradient(140deg, #2E8B6B, #57BC8E); box-shadow: 0 4px 12px rgba(46,139,107,.32); }

/* 点空白处关闭用的遮罩 */
.ai-scrim { position: fixed; inset: 0; background: rgba(30,24,18,.3); z-index: 59; animation: aiFade .18s ease; }
@keyframes aiFade { from { opacity: 0; } to { opacity: 1; } }

/* 手机：变成底部抽屉，不再挡在屏幕中间 */
@media (max-width: 640px) {
  .ai-panel {
    left: 8px !important; right: 8px !important; top: auto !important; bottom: 8px !important;
    width: auto !important; height: min(64vh, 500px) !important;
    min-width: 0 !important; max-width: none !important; max-height: 76vh !important;
    border-radius: 20px; resize: none;
  }
  .ai-head { border-radius: 20px 20px 0 0; padding: 13px 14px; }
  .ai-head .ai-av { width: 32px; height: 32px; font-size: 15px; }
  .ai-close { width: 34px; height: 34px; font-size: 21px; background: rgba(255,255,255,.22); }
  .ai-fab { right: 14px; bottom: 96px; width: 54px; height: 54px; }
  .ai-body { padding: 12px 12px 4px; }
}

/* ---------- 加到桌面引导 ---------- */
.a2hs {
  position: sticky; top: 0; z-index: 45;
  background: linear-gradient(135deg, #FFF7EF, #FDEDE2);
  border-bottom: 1px solid #F0DFC9;
  padding: 9px 12px;
  font-size: 13px;
}
.a2hs-row { display: flex; align-items: center; gap: 9px; }
.a2hs-ic { font-size: 19px; }
.a2hs-tt { flex: 1; line-height: 1.35; }
.a2hs-tt b { display: block; font-size: 13.5px; color: #8C2F1F; }
.a2hs-tt span { font-size: 11.5px; color: #9A8578; }
.a2hs-how { border: 1px solid #E6CDB6; background: #fff; color: #B8452F; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; white-space: nowrap; }
.a2hs-x { border: none; background: none; color: #B9A99B; font-size: 21px; line-height: 1; padding: 0 3px; }
.a2hs-steps { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #EBD9C6; }
.a2hs-steps p { margin: 5px 0; font-size: 12.5px; color: #6B6158; line-height: 1.65; }
@media (max-width: 640px) {
  .a2hs { padding: 8px 10px; }
  .a2hs-tt b { font-size: 13px; }
  .a2hs-tt span { display: none; }
  .a2hs-how { padding: 5px 10px; font-size: 12px; }
  .ai-close { width: 40px; height: 40px; font-size: 24px; }
  .ai-head .ai-fold { padding: 9px 18px; font-size: 15px; }
}

/* ---------- AI 点评草稿 ---------- */
.ai-draft { margin-top: 10px; padding: 10px 12px; background: linear-gradient(135deg, #F4FBF7, #EAF7F1); border: 1px dashed #B9DBC9; border-radius: 12px; }
.ai-draft-t { font-size: 12.5px; font-weight: 700; color: #2E8B6B; margin-bottom: 5px; }
.ai-draft-x { font-size: 14.5px; line-height: 1.7; color: #3A342E; white-space: pre-wrap; }
.spin-dark { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(46,139,107,.3); border-top-color: #2E8B6B; border-radius: 50%; animation: sp .7s linear infinite; }

/* ---------- 徽章墙 ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 8px; border-radius: 14px; background: #F7F4EF; border: 1px solid #EDE6DC; opacity: .48; filter: grayscale(.85); }
.badge.got { opacity: 1; filter: none; background: linear-gradient(160deg, #FFF8EF, #FDEEDD); border-color: #F0DCC0; box-shadow: 0 3px 10px rgba(184,69,47,.08); }
.badge .bi { font-size: 22px; line-height: 1; }
.badge .bn { font-size: 11.5px; font-weight: 700; color: #6B6158; text-align: center; }
.badge .bd { font-size: 10px; color: #A79B8E; }
.badge.got .bn { color: #8C2F1F; }
@media (max-width: 420px) { .badge-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- 分享图弹层 ---------- */
.img-modal { position: fixed; inset: 0; z-index: 80; background: rgba(30,24,18,.74); display: flex; align-items: center; justify-content: center; padding: 16px; }
.img-modal-box { background: #fff; border-radius: 18px; padding: 14px; max-width: min(94vw, 430px); max-height: 92vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.img-modal-t { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.img-modal-t b { font-family: "Noto Serif SC", serif; font-size: 15px; }
.img-modal-t button { border: none; background: none; font-size: 22px; color: #A79B8E; line-height: 1; }
.img-modal img { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); }
