/* ============================================================
   AiU Web H5 样式表 —— 严格遵循 shared/style-guide.md
   v4：全站颜色收敛到 :root CSS 变量（--primary/--primary-dark/--bg/--card/
   --text/--sub/--accent/--soft/--border/--danger），html[data-theme] 切换三套主题
   （v5 只剩 pink 粉紫·渐变（默认，白底毛玻璃）/ mono 黑白·简笔（磨砂），色板与 HealthCore.THEMES 对齐）
   新增组件：体重滚轮选择器 / 校园跑弹层 / 体重趋势 SVG 卡 / 抽屉今日计划 / BMI 标签
   无框架、无 CDN，纯手写；≤720px 移动端单列
   ============================================================ */

/* ---------- v5 主题变量（:root = 粉紫·渐变默认；JS 按 settings.theme 设 html[data-theme]，只剩 pink/mono） ---------- */
:root {
  --primary: #C7B7EC;        /* 主色（按钮/进度环/强调线） */
  --primary-dark: #A896DE;   /* 主色深（hover/数字强调文字） */
  --bg: #FFFFFF;             /* 页面背景：白底 */
  --bg-deco: radial-gradient(58% 34% at 14% 0%, rgba(244, 214, 240, .45), rgba(255, 255, 255, 0) 62%),
             radial-gradient(52% 30% at 88% 6%, rgba(205, 208, 250, .40), rgba(255, 255, 255, 0) 60%); /* 顶部极淡粉紫渐变点缀，不大面积铺色 */
  --card: rgba(255, 255, 255, .62); /* 毛玻璃半透明卡片底 */
  --card-solid: #FFFFFF;             /* 需要不透明底场景的兜底 */
  --text: #3B3552; --sub: #8D88A6;
  --accent: #F2A6C8; --accent-soft: #FDEFF6;
  --soft: #F5F0FD; --border: #E6DEF8;
  --danger: #EF7A7A;
  --shadow-color: rgba(150, 130, 220, .10);
  --glass-blur: blur(14px) saturate(1.25);
  --glass-border: rgba(255, 255, 255, .7);
}
/* 黑白·简笔：灰阶 + 磨砂半透明 + 细线（间距柔和化见文末 v4 段） */
[data-theme="mono"] {
  --primary: #333333; --primary-dark: #111111;
  --bg: #FAFAFA;
  --bg-deco: radial-gradient(58% 34% at 14% 0%, rgba(0, 0, 0, .035), rgba(250, 250, 250, 0) 62%),
             radial-gradient(52% 30% at 88% 6%, rgba(0, 0, 0, .025), rgba(250, 250, 250, 0) 60%);
  --card: rgba(255, 255, 255, .66); --card-solid: #FFFFFF;
  --text: #222222; --sub: #8A8A8A;
  --accent: #555555; --accent-soft: #F1F1F1;
  --soft: #F1F1F1; --border: #DCDCDC;
  --danger: #B85450;
  --shadow-color: rgba(0, 0, 0, 0);
  --glass-blur: blur(12px) saturate(1.1);
  --glass-border: rgba(0, 0, 0, .08);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* v18：滚动条槽位常驻——页面高矮切换时（如首页 vs 反馈页）文档宽度不再因滚动条出现/消失而变化，
   配合 .layout-content 保证切 tab 内容区不横向跳动 */
html { scrollbar-gutter: stable; overflow-y: scroll; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-deco), var(--bg); /* v5：白底 + 顶部极淡渐变点缀（不滚动跟随） */
  background-attachment: fixed;
  color: var(--text);                /* 主文字 */
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: 120px;         /* 给底部固定栏 + 免责声明条留空间 */
}
/* v5 毛玻璃通透质感：模块容器半透明底 + 背景模糊（不支持 backdrop-filter 的环境自动退化为半透明实底） */
.card, .modal, .drawer, .bottom-bar, .topbar, .day-item, .meal-card, .tile,
.met-card, .plan-card, .hm-card, .picker-modal {
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- 顶部固定介绍条 + 四 tab 导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px var(--shadow-color);
}
.topbar-inner {
  max-width: 1024px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px 6px;
  flex-wrap: wrap;
}
.brand { flex: 1; min-width: 240px; }
.brand-logo { font-size: 20px; font-weight: 700; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }
/* v10：品牌图标——紫粉渐变莫比乌斯环，色带沿环流动 + 整体轻微摆动 */
.mobius { overflow: visible; animation: mobiusTilt 6s ease-in-out infinite; }
.mobius-loop { stroke-dasharray: 42 22; animation: mobiusFlow 3.2s linear infinite; }
@keyframes mobiusFlow { to { stroke-dashoffset: -64; } }
@keyframes mobiusTilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .mobius, .mobius-loop { animation: none; } }
.brand-slogan { font-size: 12px; color: var(--sub); margin-top: 2px; }

/* tab 栏：等宽 tab，文字居中，四个 tab 文字前置 SVG 图标（v18）；当前 tab 下方短横线指示条 */
.tabs {
  max-width: 1024px; margin: 0 auto;
  display: flex; align-items: stretch;
  padding: 0 16px;
}
.tab-btn {
  flex: 1; position: relative;
  background: none; border: none;
  padding: 10px 4px 12px;
  font-size: 15px; color: var(--sub);
  display: flex; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
}
/* v18：tab 图标——sprite 隐藏容器 + 图标本体，颜色随文字（currentColor） */
.tab-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.tab-ico { width: 16px; height: 16px; flex: none; display: block; fill: currentColor; }
.tab-btn.home { font-size: 16px; }         /* 首页 tab 字号略大 */
.tab-btn.active { color: var(--primary-dark); }
.tab-btn.active::after {                   /* 绿色短横线指示条 */
  content: ""; position: absolute; left: 50%; bottom: 4px;
  transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 2px; background: var(--primary);
}

/* ---------- 主区域与视图 ---------- */
.main { max-width: 1024px; margin: 0 auto; padding: 16px; }
.view { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-back { margin-bottom: 8px; }

/* ---------- v18：公共内容容器 LayoutContent ----------
   全站唯一的页面主内容容器规则：以首页为准（max-width 1120 + margin:0 auto，
   左右 padding 由 .main 统一给），五个 tab 与方案/反馈视图全部引用，
   切换页面时左右边界严格对齐，不再各页自写一套宽度。 */
.layout-content { width: 100%; max-width: 1120px; margin: 0 auto; }

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  background: var(--card); border-radius: 16px; padding: 16px;
  box-shadow: 0 4px 16px var(--shadow-color);
  margin-bottom: 16px;
}
.card-title { font-size: 18px; margin-bottom: 4px; }
.card-sub { font-size: 13px; color: var(--sub); margin-bottom: 12px; }

/* （v17.2：AI 生成角标遮挡标题文字，已删除，.ai-tag 样式一并移除） */

/* ---------- 按钮 ---------- */
.btn { border: none; border-radius: 999px; padding: 10px 20px; font-size: 15px; transition: all .15s; }
.btn-primary { background: var(--primary); color: #FFFFFF; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sub { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn-sub:hover { background: var(--soft); }
.btn-text { background: none; color: var(--sub); }
.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: #d95f5f; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* 微信登录大按钮（绿底，比常规主按钮更醒目） */
.btn-wx { background: var(--primary); color: #FFFFFF; width: 100%; font-size: 16px; padding: 13px 20px; }
.btn-wx:hover { background: var(--primary-dark); }

/* ---------- chip 标签：浅绿底+主色文字，选中态绿底白字 ---------- */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--soft); color: var(--primary-dark); border: none;
  border-radius: 999px; padding: 6px 14px; font-size: 13px;
}
.chip.sel { background: var(--primary); color: #FFFFFF; }
.chip .chip-x { margin-left: 6px; font-weight: 700; }
/* v11：自定义食物热量单位切换（大卡/千焦） */
.cf-unit-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 4px; }
.cf-unit-chip.sel { background: var(--primary); color: #FFFFFF; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-label { display: block; font-size: 13px; color: var(--text); font-weight: 700; margin-bottom: 6px; }
.input {
  width: 100%; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); font-family: inherit;
}
.input:focus { outline: none; border-color: var(--primary); }
.input-sm { width: 90px; }
.tag-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.tag-input-row .input { flex: 1; }
.form-actions { text-align: center; margin: 18px 0; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

/* ============================================================
   v2 弹窗通用（登录 / 建档 / 选食 / 日详情 / 植物陪伴）
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(43,58,66,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  position: relative;
  width: 480px; max-width: 100%;
  max-height: 86vh; overflow-y: auto;
  background: var(--card); border-radius: 16px; padding: 20px;
  box-shadow: 0 12px 40px rgba(43,58,66,.25);
  animation: fadein .2s ease;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-title { font-size: 18px; margin-bottom: 4px; }
.modal-sub { font-size: 12px; color: var(--sub); margin-bottom: 12px; }
.modal-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0; color: var(--sub); font-size: 12px;
}
.modal-divider::before, .modal-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.modal-skip { text-align: center; margin-top: 10px; }
.login-modal .btn-wx + .modal-divider { margin-top: 16px; }

/* ============================================================
   v2 首页 8 大区块
   ============================================================ */

/* ① 周目标条 */
.week-bar { padding: 12px 16px; }
.wb-row { display: flex; align-items: center; justify-content: space-between; font-size: 15px; cursor: pointer; }
.wb-row b { color: var(--accent); }
.wb-arrow { font-size: 10px; color: var(--sub); }

/* 一键演示数据小字入口 */
.seed-line { text-align: center; margin: -6px 0 12px; }
.seed-line .btn { color: var(--sub); font-size: 12px; text-decoration: underline dotted; }

/* ② 近 7 天日期条 */
.day-strip { display: flex; justify-content: space-between; gap: 4px; margin-bottom: 14px; }
.day-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  background: var(--card); border: none; border-radius: 12px;
  padding: 6px 2px; box-shadow: 0 2px 8px var(--shadow-color);
  color: var(--sub);
}
.day-item .d-week { font-size: 11px; }
.day-item .d-num { font-size: 15px; font-weight: 700; color: var(--text); }
.day-item:hover { border-color: var(--primary); }
.day-item.today {
  background: var(--primary); transform: scale(1.12);   /* 今日高亮放大 */
  box-shadow: 0 4px 14px var(--shadow-color);
}
.day-item.today .d-week, .day-item.today .d-num { color: #FFFFFF; }

/* v4 首页单列：右侧「今日计划」灰区侧栏已删除，三条计划移入个人中心抽屉 */
.home-cols { display: block; }
.home-main-col { min-width: 0; }

/* ③ 「还可吃」主卡 */
.h-main { padding: 18px 16px 14px; }
.badge-plan {
  position: absolute; top: 10px; right: 12px;
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; cursor: pointer;
}
.badge-plan i {                                /* 红点角标 */
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}
.hm-top { display: flex; align-items: center; gap: 14px; }
.hm-left { flex: 1; min-width: 0; }
.hm-label { font-size: 13px; color: var(--sub); }
.hm-big { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 6px; }
.hm-big b { font-size: 42px; font-weight: 800; color: var(--primary-dark); line-height: 1.1; }
.hm-big span { font-size: 13px; color: var(--sub); }
.hm-row { font-size: 13px; color: var(--sub); }
.hm-row b { color: var(--text); }
.btn-gradient {
  margin-top: 10px; width: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #FFFFFF; border: none; border-radius: 999px;
  padding: 11px 16px; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 14px var(--shadow-color); transition: filter .15s;
}
.btn-gradient:hover { filter: brightness(1.06); }
/* conic 环形进度（摄入/目标占比） */
.hm-ring {
  width: 104px; height: 104px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.hm-ring-in {
  width: 82px; height: 82px; border-radius: 50%; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.hm-ring-in b { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.hm-ring-in span { font-size: 10px; color: var(--sub); }
/* 底部 4 个迷你进度条：碳水/蛋白质/脂肪/糖（v13：字号加大，10px 太小看不清） */
.mini-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 6px; }
.mb .mb-label { font-size: 13px; color: var(--sub); margin-bottom: 3px; white-space: nowrap; }
.mb-track { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.mb-fill { height: 100%; border-radius: 999px; transition: width .3s; }

/* ④ 今日计划任务清单 */
.task-item {
  display: flex; align-items: flex-start; gap: 8px; width: 100%;
  background: none; border: none; text-align: left;
  padding: 7px 2px; font-size: 14px; color: var(--text);
  border-bottom: 1px dashed var(--border);
}
.task-item:last-of-type { border-bottom: none; }
.task-check {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px;
  border-radius: 50%; border: 2px solid var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: #FFFFFF;
}
.task-item.done .task-check { background: var(--primary); }
.task-item.done > span:last-child { color: var(--sub); text-decoration: line-through; }

/* ⑤ 三餐卡 */
.meal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.meal-card {
  position: relative; background: var(--card); border-radius: 16px; padding: 12px;
  box-shadow: 0 4px 16px var(--shadow-color); cursor: pointer;
}
.mc-head { display: flex; justify-content: space-between; align-items: center; }
.mc-head b { font-size: 15px; }
.mc-plus {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--soft); color: var(--primary-dark); border: none;
  font-size: 16px; font-weight: 700; line-height: 1;
}
.mc-plus:hover { background: var(--primary); color: #FFFFFF; }
.mc-kcal { font-size: 18px; font-weight: 800; color: var(--primary-dark); margin-top: 4px; }
.mc-kcal span { font-size: 11px; font-weight: 400; color: var(--sub); }
.mc-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.mc-bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.mc-detail { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 4px; cursor: auto; }
.mc-detail .mini-item { padding: 5px 0; }

/* ⑥ 运动卡 */
.sc-head { display: flex; justify-content: space-between; align-items: center; }
.sc-kcal { font-size: 24px; font-weight: 800; color: var(--primary-dark); margin-top: 2px; }
.sc-kcal span { font-size: 12px; font-weight: 400; color: var(--sub); }
.sc-bar { margin: 6px 0 10px; }
.sc-wear { font-size: 13px; color: var(--text); margin-top: 8px; }
.demo-tag-inline { font-size: 11px; color: var(--accent); margin-left: 6px; }

/* ⑦ 组件宫格（2 列小卡） */
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: var(--card); border-radius: 16px; padding: 12px; text-align: center;
  box-shadow: 0 4px 16px var(--shadow-color);
  display: flex; flex-direction: column;   /* v17.5：竖向弹性，按钮用 margin-top:auto 钉到底，同行各 tile 按钮同一水平线 */
}
.tile > button { margin-top: auto; }
.tile-ico { font-size: 22px; }
.tile-name { font-size: 13px; font-weight: 700; margin: 2px 0 4px; }
.tile-state { font-size: 12px; color: var(--sub); margin-bottom: 6px; min-height: 18px; }
.tile-state b { color: var(--primary-dark); font-size: 15px; }
.tile-weight { display: flex; gap: 6px; justify-content: center; }
.tile-weight .input-sm { width: 70px; }

/* （v17.2：宫格管理面板模块已删除，.grid-manage/.gm-* 样式一并移除） */

/* ⑧ 底部固定栏（仅首页 tab 显示） */
.homebar {
  position: fixed; left: 0; right: 0; bottom: 34px; z-index: 60;
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 14px;
}
.hb-spacer { display: none; } /* v17.2：右侧管理按钮删除后胶囊改为居中，占位符不再需要 */
.hb-pill {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #FFFFFF; border: none; border-radius: 999px;
  padding: 12px 28px; font-size: 16px; font-weight: 700;
  box-shadow: 0 6px 18px var(--shadow-color);
}
/* （v17.2：底部栏右侧宫格管理按钮已删除，.hb-right/.hb-ico 样式一并移除） */

/* ============================================================
   植物 AI 形象：左下角圆形悬浮头像 + CSS 摇曳/呼吸动画
   stage 不同：emoji 由 JS 切换，光环色由 box-shadow 内联设置
   ============================================================ */
.plant-avatar {
  position: fixed; left: 14px; bottom: 54px; z-index: 65;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--card); border: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  animation: plantBreathe 3.2s ease-in-out infinite;   /* 呼吸缩放 */
}
.pa-emoji {
  font-size: 28px; display: inline-block;
  transform-origin: 50% 90%;
  animation: plantSway 2.6s ease-in-out infinite;      /* 摇曳 */
}
@keyframes plantSway {
  0%, 100% { transform: rotate(-7deg); }
  50%      { transform: rotate(7deg); }
}
@keyframes plantBreathe {
  0%, 100% { box-shadow: 0 0 0 3px rgba(43,182,154,.18), 0 4px 16px rgba(43,182,154,.25); }
  50%      { box-shadow: 0 0 0 8px rgba(43,182,154,.10), 0 4px 16px rgba(43,182,154,.25); }
}
/* 各阶段光环底色（box-shadow 由 JS 覆盖具体颜色，这里做渐变装饰层） */
.plant-avatar.stage-0 { background: radial-gradient(circle at 50% 70%, #F3EEE4, #FFFFFF 70%); }
.plant-avatar.stage-1 { background: radial-gradient(circle at 50% 70%, var(--soft), #FFFFFF 70%); }
.plant-avatar.stage-2 { background: radial-gradient(circle at 50% 70%, #FBEEF4, #FFFFFF 70%); }
.plant-avatar.stage-3 { background: radial-gradient(circle at 50% 70%, #F9E4EC, #FFFFFF 70%); }

/* 陪伴弹层 */
.plant-greet {
  background: var(--soft); border-radius: 12px; padding: 12px;
  margin: 10px 0 12px; font-size: 14px; color: var(--primary-dark); line-height: 1.8;
}
.pg-line + .pg-line { margin-top: 6px; }
.pg-stage { font-size: 12px; color: var(--sub); border-top: 1px dashed var(--border); padding-top: 6px; }
.plant-reply { margin-top: 12px; }
.plant-reply .fb-comfort {
  background: var(--soft); border-radius: 12px; padding: 12px;
  font-size: 14px; color: var(--primary-dark); margin-bottom: 10px;
}
.plant-modal #btn-plant-plan { margin-top: 12px; }

/* 历史日只读弹窗 */
.day-sum { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 8px; }
.day-sum b { color: var(--primary-dark); font-size: 16px; }

/* ============================================================
   以下为 v1 完整保留的共享组件样式（图表/收支/方案/反馈/抽屉）
   ============================================================ */

/* ---------- 代谢结果数字卡 ---------- */
.met-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.met-card {
  background: var(--card); border-radius: 16px; padding: 16px; text-align: center;
  box-shadow: 0 4px 16px var(--shadow-color);
}
.met-num { font-size: 26px; font-weight: 800; color: var(--primary-dark); }
.met-num .unit { font-size: 13px; font-weight: 400; color: var(--sub); }
.met-name { font-size: 14px; margin-top: 2px; }
/* 「计算依据」灰字区：全站复用 basis-block */
.basis-block {
  background: var(--bg); border-radius: 12px; padding: 10px 12px;
  font-size: 12px; color: var(--sub); line-height: 1.8;
  margin-top: 10px;
}
.basis-block .basis-title { font-weight: 700; color: var(--sub); margin-bottom: 2px; }

/* ---------- 饮食：食物列表 / 份量选择（选食弹窗复用） ---------- */
.food-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  max-height: 300px; overflow-y: auto; margin: 10px 0;
}
.food-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px; font-size: 13px; text-align: left;
}
.food-item:hover { border-color: var(--primary); }
.food-item.sel { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }
.food-item .fi-kcal { display: block; font-size: 11px; color: var(--sub); }
.food-item.sel .fi-kcal { color: var(--soft); }
.food-item .fi-custom { color: var(--accent); font-size: 11px; }
.food-item.sel .fi-custom { color: #FFD9AE; }
/* v5：自定义食物的编辑/删除小按钮（点选按钮不触发选中，由 JS 拦截） */
.food-item .fi-edit, .food-item .fi-del {
  display: inline-block; margin-left: 6px; font-size: 12px; cursor: pointer;
  color: var(--primary-dark); opacity: .75;
}
.food-item .fi-del { color: var(--danger); }
.food-item .fi-edit:hover, .food-item .fi-del:hover { opacity: 1; }

.food-picker {
  background: var(--soft); border-radius: 12px; padding: 12px; margin: 10px 0;
}
.picker-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.picker-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.macro-line { font-size: 13px; color: var(--primary-dark); margin-bottom: 10px; }
.macro-line b { font-size: 16px; }
.custom-food { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 6px; }
#d-custom-form { margin-top: 10px; }

/* 饮食汇总条 + 近7天柱状 */
.diet-summary { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.sum-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 8px; }
.sum-bar b { color: var(--primary-dark); font-size: 16px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 70px; padding: 4px 0; }
.bar-col { flex: 1; text-align: center; font-size: 10px; color: var(--sub); }
.bar {
  width: 100%; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 3px;
  transition: height .3s;
}
.bar.demo { background: var(--accent); }   /* 演示数据柱用 accent 色区分 */

/* ---------- 运动估算 / 热量收支 ---------- */
.est-line { background: var(--soft); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 8px 0 12px; }
.est-line b { color: var(--primary-dark); font-size: 18px; }
.balance {
  margin-top: 16px; background: var(--bg); border-radius: 12px; padding: 14px;
}
.balance-big { text-align: center; margin-bottom: 10px; }
.balance-big .bd-num { font-size: 30px; font-weight: 800; }
.balance-big .bd-deficit { color: var(--accent); }   /* 缺口：橙 */
.balance-big .bd-surplus { color: var(--danger); }   /* 超出目标：柔和红 */
.balance-big .bd-desc { font-size: 13px; color: var(--sub); }
/* 双色进度条：摄入橙、消耗绿 */
.pbar { height: 14px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 6px 0; position: relative; }
.pbar-fill { height: 100%; border-radius: 999px; transition: width .3s; }
.pbar-in { background: var(--accent); }
.pbar-burn { background: var(--primary); }
.pbar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); }
/* 双色条容器：绝对定位的目标线标记 */
.pbar-wrap { position: relative; }
.pbar-target {
  position: absolute; top: 4px; bottom: 4px; width: 2px;
  background: var(--text); border-radius: 2px; opacity: .55;
}

.mini-list { margin-top: 12px; }
.mini-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.mini-item:last-child { border-bottom: none; }
/* v16：mi-del/mi-edit 通用化——此前 .mi-del 仅在 .mini-item 内生效，运动明细 .ex-line 里的删除按钮落成原生方框样式 */
.mi-del { color: var(--danger); background: none; border: none; font-size: 12px; cursor: pointer; }

/* ---------- 穿戴模拟 ---------- */
.demo-tag {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border: 1px dashed var(--accent); border-radius: 8px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; margin: 8px 0;
}
.wear-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.wear-item { background: var(--bg); border-radius: 12px; padding: 10px; font-size: 12px; }
.wear-item .wi-date { color: var(--sub); margin-bottom: 4px; }
.wear-item b { color: var(--primary-dark); font-size: 14px; }

/* ---------- AI 方案：状态卡 / 方案卡 ---------- */
.seed-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border-radius: 16px; padding: 10px 16px; margin-bottom: 16px;
  box-shadow: 0 4px 16px var(--shadow-color); flex-wrap: wrap;
}
.status-body { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
/* 环形评分：conic-gradient 实现 */
.score-ring {
  width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.score-inner {
  width: 96px; height: 96px; border-radius: 50%; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-inner .sc-num { font-size: 30px; font-weight: 800; color: var(--primary-dark); line-height: 1.1; }
.score-inner .sc-label { font-size: 12px; color: var(--sub); }
.status-info { flex: 1; min-width: 220px; }
.status-info .st-level { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.status-info .st-desc { font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.reason-hi { color: var(--accent); font-weight: 700; font-size: 13px; }

.plan-title-row { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.plan-title-row h3 { font-size: 18px; }
.plan-hint { font-size: 12px; color: var(--sub); }

.diet-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sport-plans { display: grid; grid-template-columns: repeat(3, 1fr) 200px; gap: 16px; }
.plan-card {
  position: relative; background: var(--card); border-radius: 16px; padding: 16px;
  box-shadow: 0 4px 16px var(--shadow-color);
  border: 2px solid transparent; display: flex; flex-direction: column;
}
.plan-card.chosen { border-color: var(--primary); }
.plan-card h4 { font-size: 16px; margin-bottom: 2px; }
.plan-card .pc-desc { font-size: 12px; color: var(--sub); margin-bottom: 8px; }
.plan-card .pc-kcal { font-size: 20px; font-weight: 800; color: var(--primary-dark); }
.meal-block { margin: 8px 0; font-size: 13px; }
.meal-slot { font-weight: 700; color: var(--primary); font-size: 13px; margin-bottom: 2px; }
.meal-item-line { display: flex; justify-content: space-between; color: var(--text); }
.meal-item-line .mi-kcal { color: var(--sub); }
.meal-total { text-align: right; font-size: 12px; color: var(--sub); border-top: 1px dashed var(--border); padding-top: 2px; }
.pc-macros { font-size: 12px; color: var(--sub); margin-top: 4px; }
.pc-note { font-size: 12px; color: var(--accent); margin-top: 4px; }
.pc-foot { margin-top: auto; padding-top: 10px; }
.chosen-flag { color: var(--primary); font-size: 12px; font-weight: 700; }

/* 提醒暂停条 */
.reminder-off {
  background: var(--accent-soft); color: var(--accent); border-radius: 12px;
  padding: 10px 16px; font-size: 13px; margin-bottom: 16px; font-weight: 700;
}

/* 空状态：居中浅灰文案 + 主按钮 */
.empty { text-align: center; padding: 34px 16px; color: var(--sub); }
.empty .empty-ico { font-size: 34px; margin-bottom: 6px; }
.empty .empty-text { font-size: 14px; margin-bottom: 14px; }

/* ---------- 反馈页 ---------- */
.fb-group { margin-bottom: 14px; }
.fb-reply .fb-comfort {
  background: var(--soft); border-radius: 12px; padding: 12px;
  font-size: 14px; color: var(--primary-dark); margin-bottom: 10px;
}
.fb-adjust { font-size: 14px; margin-bottom: 8px; }
.fb-adjust b { display: block; margin-bottom: 4px; }
.fb-adjust li { margin-left: 18px; font-size: 13px; }
.fb-effect { font-size: 12px; color: var(--sub); }

/* ---------- 身体 tab ---------- */
.body-entry-row { display: flex; gap: 10px; flex-wrap: wrap; }
.disclaimer-card .text-sub { line-height: 1.8; }

/* ---------- 「我的数据」抽屉 ---------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(43,58,66,.4); z-index: 90;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: 420px; max-width: 92vw; background: var(--card);
  box-shadow: -6px 0 24px var(--shadow-color);
  display: flex; flex-direction: column;
  animation: slidein .25s ease;
}
@keyframes slidein { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { font-size: 18px; color: var(--primary-dark); }
.drawer-body { overflow-y: auto; padding: 16px; flex: 1; }
.data-block { border-bottom: 1px solid var(--border); padding: 10px 0; }
.data-title { font-size: 14px; margin-bottom: 8px; }
.data-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.data-row p { font-size: 12px; }
.data-list { max-height: 150px; overflow-y: auto; }
.data-list .mini-item { padding: 6px 4px; }
.danger-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 开关组件 */
.switch {
  width: 46px; height: 26px; border-radius: 999px; border: none;
  background: var(--border); position: relative; flex-shrink: 0; transition: background .2s;
}
.switch .switch-dot {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s;
}
.switch.on { background: var(--primary); }
.switch.on .switch-dot { left: 23px; }

/* ---------- 小程序二维码占位卡（v2：挪到身体 tab 底部，桌面端居中） ---------- */
.qr-card {
  width: 108px; padding: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  text-align: center;
}
.qr-card.qr-center { margin: 16px auto 0; }
.qr-img { width: 88px; height: 88px; object-fit: contain; }
.qr-grid {
  width: 88px; height: 88px; margin: 0 auto;
  background-color: var(--card);
  /* 两层 45° 渐变错位拼出 8x8 黑白方块，模拟二维码 */
  background-image:
    linear-gradient(45deg, var(--text) 25%, transparent 25%, transparent 75%, var(--text) 75%),
    linear-gradient(45deg, var(--text) 25%, transparent 25%, transparent 75%, var(--text) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
  border: 3px solid var(--text);
  position: relative;
}
/* 二维码三个定位角（装饰） */
.qr-grid::before, .qr-grid::after {
  content: ""; position: absolute;
  width: 22px; height: 22px;
  background: var(--card); border: 4px solid var(--text);
}
.qr-grid::before { top: 2px; left: 2px; }
.qr-grid::after  { top: 2px; right: 2px; }
.qr-text { font-size: 10px; color: var(--sub); margin-top: 4px; line-height: 1.4; }

/* ---------- toast 轻提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 132px; transform: translateX(-50%);
  background: rgba(43,58,66,.92); color: #FFFFFF;
  padding: 10px 20px; border-radius: 999px; font-size: 14px;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- 底部免责声明条 ---------- */
.disclaimer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: var(--soft); color: var(--sub);
  font-size: 11px; text-align: center; padding: 8px 12px; line-height: 1.5;
}

/* 通用辅助 */
.text-sub { color: var(--sub); font-size: 12px; }

/* ---------- 响应式：≤720px 移动端（单列布局） ---------- */
@media (max-width: 720px) {
  .topbar-inner { gap: 8px; padding: 10px 12px 4px; }
  .brand-slogan { font-size: 11px; }
  .tabs { padding: 0 8px; }
  .tab-btn { font-size: 14px; }
  .main { padding: 12px; }
  .met-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .food-list { grid-template-columns: 1fr 1fr; }
  .wear-grid { grid-template-columns: 1fr 1fr; }
  .diet-plans { grid-template-columns: 1fr; }   /* 卡片单列 */
  .sport-plans { grid-template-columns: 1fr; }
  .home-cols { display: block; }                /* v3：<900px 单列，侧栏堆叠在主列下方 */
  .qr-card.qr-center { display: none; }         /* 移动端空间有限，隐藏二维码卡（小程序场景本身即入口） */
  .status-body { justify-content: center; }
  .hm-big b { font-size: 36px; }
}

/* ============================================================
   v3 布局修订样式（个人中心抽屉 / 日期补录视图 / 分段彩色条 /
   经期月历 / 自定饮食方案 / 可拖拽植物形象）
   ============================================================ */

/* ---- 右上角个人中心按钮 ---- */
.account-btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--soft); border: 1px solid var(--border); font-size: 19px;
  box-shadow: 0 2px 8px var(--shadow-color);
}
.account-btn:hover { background: var(--border); border-color: var(--primary); }

/* ---- 个人中心抽屉内的账户块 ---- */
.acc-nick { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 4px; }
.acc-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px;
}
.acc-jump { display: flex; gap: 8px; flex-wrap: wrap; }
.freq-chips { max-height: 220px; overflow-y: auto; }

/* ---- 弹窗通用加宽（当日数据视图 / 自定方案） ---- */
.modal-wide { width: 560px; }

/* ---- 当日数据视图（补录） ---- */
.day-sec { border-top: 1px dashed var(--border); margin-top: 12px; padding-top: 10px; }
.day-sec h4 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-sec h4 .text-sub { font-weight: 400; }
.sec-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; font-size: 14px; }
.sec-row b { color: var(--primary-dark); }
.sec-add-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.sec-add-row .input { width: 120px; }
.sec-add-row select.input { width: auto; flex: 1; min-width: 140px; }
.day-badge {
  display: inline-block; background: #FFE4E1; color: var(--danger);
  border-radius: 999px; font-size: 11px; padding: 1px 8px; margin-left: 6px;
}
.day-record-note { margin-top: 10px; }

/* ---- v3 记餐弹窗：自定义食物放大常驻 ---- */
.custom-food-lg { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; }
.custom-food-lg .cf-title { font-size: 14px; color: var(--primary-dark); margin-bottom: 8px; }
.custom-food-lg .form-grid-2 { gap: 8px; }
.custom-food-lg #cf-save { margin-top: 8px; }

/* ---- 运动：数字加大 + 分段彩色消耗条 + 记录行修改按钮 ---- */
.sc-kcal { font-size: 30px; }
.ex-line { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 15px; }
.ex-line:last-child { border-bottom: none; }
.ex-line b { color: var(--primary-dark); font-size: 20px; }
.ex-line .ex-ops { display: flex; gap: 10px; }
.mi-edit { color: var(--primary); background: none; border: none; font-size: 13px; cursor: pointer; }
.mini-list .ex-line span:first-child { flex: 1; min-width: 0; }
.seg-bar { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.seg-fill { display: flex; height: 100%; border-radius: 999px; overflow: hidden; transition: width .3s; }
.seg-fill i { display: block; height: 100%; }
.seg-fill i + i { border-left: 2px solid #FFFFFF; }

/* ---- 体重卡：N 天未更新橙色提示 ---- */
.tile-warn { color: var(--accent); font-weight: 700; font-size: 12px; margin-top: 2px; }
.tile-date { font-size: 11px; color: var(--sub); }

/* ---- 经期月历（自绘 7 列网格） ---- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 10px; }
.cal-tip { font-size: 13px; color: var(--primary-dark); font-weight: 700; text-align: center; flex: 1; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week span { text-align: center; font-size: 12px; color: var(--sub); padding: 2px 0; }
.cal-grid { margin-bottom: 10px; }
.cal-day {
  position: relative; min-height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 13px; padding: 4px 2px;
}
.cal-day:hover { border-color: var(--primary); }
.cal-day.empty-cell { border: none; background: none; }
.cal-day.period { background: #FFE8D9; border-color: #FFC79E; }      /* 本次经期：accent 浅底 */
.cal-day.predict { border: 2px dashed var(--accent); }                     /* 预测下次：虚线圈 */
.cal-day.start::after {
  content: "●"; position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  font-size: 8px; color: var(--danger);
}
.cal-day.today { outline: 2px solid var(--primary); outline-offset: -2px; font-weight: 700; }
.cal-day .cal-s { display: block; font-size: 10px; color: var(--sub); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--sub); margin-bottom: 8px; }
.cal-legend .lg-item { display: inline-flex; align-items: center; gap: 4px; }
.cal-legend .lg-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.lg-start { background: var(--danger); }
.lg-period { background: #FFE8D9; border: 1px solid #FFC79E; }
.lg-predict { background: var(--card); border: 2px dashed var(--accent); }
.lg-today { background: var(--card); outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---- 自定饮食方案 ---- */
.cp-entry-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap; }
.cp-row { display: grid; grid-template-columns: minmax(0, 2fr) 74px 88px 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.cp-row .cp-del { background: none; border: none; color: var(--danger); font-size: 15px; }
.cp-sum { background: var(--soft); border-radius: 10px; padding: 8px 12px; margin: 10px 0 4px; }
.custom-tag {
  position: absolute; top: 12px; right: 12px;
  background: var(--primary); color: #FFFFFF;
  font-size: 11px; padding: 2px 10px; border-radius: 999px;
}
.plan-card .cp-del-btn { margin-left: 8px; }

/* ---- v3 植物形象：可拖拽悬浮，松手停留任意位置（v4：位置存 {x,y}，不再吸附左右缘） ---- */
.plant-avatar {
  position: fixed; left: -10px; bottom: auto; top: 160px;
  touch-action: none; user-select: none; z-index: 65;
}
.plant-avatar.dragging { animation: none; cursor: grabbing; }
.plant-avatar.dragging .pa-emoji { animation: none; }

/* ============================================================
   v4 新增样式（体重滚轮选择器 / 校园跑 / 体重趋势 SVG / 抽屉今日计划 / BMI / 主题微调）
   ============================================================ */

/* ---- v4 运动页按钮行（保存 + 校园跑并排） ---- */
.e-btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- v4 体重滚轮选择器：scroll-snap 居中吸附，触摸/鼠标滚轮均可滚 ---- */
.wt-wheel-wrap {
  position: relative; height: 220px; overflow: hidden;
  background: var(--bg); border-radius: 12px; margin: 8px 0 4px;
}
.wt-wheel {
  height: 220px; overflow-y: scroll; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;                 /* Firefox 隐藏滚动条 */
}
.wt-wheel::-webkit-scrollbar { display: none; }
.wt-pad { height: 88px; scroll-snap-align: none; }   /* (220-44)/2：让首尾项可滚到中线 */
.wt-item {
  height: 44px; line-height: 44px; text-align: center;
  scroll-snap-align: center;
  font-size: 15px; color: var(--sub); transition: color .15s;
}
.wt-item.wt-sel { color: var(--primary-dark); font-weight: 800; font-size: 19px; }
.wt-indicator {
  position: absolute; left: 10px; right: 10px; top: 50%; height: 44px;
  transform: translateY(-50%); pointer-events: none;
  border-top: 1px solid var(--primary); border-bottom: 1px solid var(--primary);
  border-radius: 6px; background: var(--soft); opacity: .35;
}
.wt-current { text-align: center; font-size: 26px; font-weight: 800; color: var(--primary-dark); }
.wt-current small { font-size: 13px; color: var(--sub); font-weight: 400; }

/* ---- v4 体重变化趋势卡：时间窗切换按钮 + 手写内联 SVG 折线 ---- */
.wt-ranges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.wt-range-btn {
  background: var(--card); color: var(--sub);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 16px; font-size: 13px;
}
.wt-range-btn.on { background: var(--primary); border-color: var(--primary); color: #FFFFFF; font-weight: 700; }
.wt-svg { width: 100%; height: auto; display: block; margin-top: 4px; }
.wt-svg .wt-line { fill: none; stroke: var(--primary-dark); stroke-width: 2.5; stroke-linejoin: round; }
.wt-svg .wt-dot { fill: var(--card); stroke: var(--primary-dark); stroke-width: 2; }
.wt-svg .wt-val { font-size: 12px; fill: var(--text); font-weight: 700; }
.wt-svg .wt-axis { font-size: 11px; fill: var(--sub); }
.wt-svg .wt-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 4; }
.wt-svg .wt-delta { font-size: 13px; font-weight: 700; }
.wt-svg .wt-delta.dn { fill: var(--primary-dark); }
.wt-svg .wt-delta.up { fill: var(--accent); }
.wt-empty {
  background: var(--bg); border-radius: 12px; padding: 22px 12px;
  text-align: center; font-size: 14px; color: var(--sub);
}

/* ---- v4 BMI 卡等级标签 ---- */
.bmi-level { font-size: 15px; font-weight: 800; }
.bmi-ok { color: var(--primary-dark); }
.bmi-thin { color: var(--accent); }
.bmi-high { color: var(--danger); }

/* ---- v4 抽屉内今日计划（原首页 h-tasks 搬入，任务行沿用 .task-item 样式） ---- */
#acc-tasks .task-item { font-size: 13px; color: var(--text); }
#acc-tasks .text-sub { margin-top: 6px; }

/* ---- v4 黑白·简笔主题：模块间距柔和、去阴影、细线简笔感（字体不变） ---- */
[data-theme="mono"] .card, [data-theme="mono"] .meal-card,
[data-theme="mono"] .tile, [data-theme="mono"] .met-card,
[data-theme="mono"] .plan-card, [data-theme="mono"] .seed-bar {
  box-shadow: none; border: 1px solid var(--border);
}
[data-theme="mono"] .card { border-radius: 10px; margin-bottom: 24px; }
[data-theme="mono"] .day-item { box-shadow: none; border: 1px solid var(--border); }
[data-theme="mono"] .topbar { box-shadow: none; }
[data-theme="mono"] .hm-ring-in, [data-theme="mono"] .score-inner { box-shadow: none; }

/* ============ v6：sun 三态切换效果开关（移植自 E:\sun，light/sunset/dark，无音效） ============
   独立于应用主题系统：只作用于 .sun-toggle 组件自身，data-mood 由 app.js 切换并持久化。
   注册为自定义属性使轨道渐变、旋钮底色、图标色在切换时平滑过渡而非跳变。 */
@property --sun-bg   { syntax: "<color>"; inherits: true; initial-value: #1A1A1A; }
@property --sun-t1   { syntax: "<color>"; inherits: true; initial-value: #2D253A; }
@property --sun-t2   { syntax: "<color>"; inherits: true; initial-value: #574777; }
@property --sun-t3   { syntax: "<color>"; inherits: true; initial-value: #6A578F; }
@property --sun-stop { syntax: "<color>"; inherits: true; initial-value: #BEADD6; }
@property --sun-knob { syntax: "<color>"; inherits: true; initial-value: #1A1A1A; }
@property --sun-glyph{ syntax: "<color>"; inherits: true; initial-value: #AB8CF0; }
@property --sun-rim  { syntax: "<color>"; inherits: true; initial-value: #574777; }

.sun-toggle {
  /* 顶栏紧凑尺寸：整宽约 150px，与头像按钮等高 */
  --sun-w: 150px; --sun-h: 44px; --sun-pad: 4px;
  --sun-knob-size: calc(var(--sun-h) - var(--sun-pad) * 2);
  --sun-travel: calc((var(--sun-w) - var(--sun-pad) * 2 - var(--sun-knob-size)) / 2);
  --sun-heavy: cubic-bezier(0.65, 0, 0.35, 1);
  --sun-settle: cubic-bezier(0.16, 1, 0.3, 1);
  --sun-t: 700ms;
  /* dark 默认组（未初始化前的兜底观感与原版一致） */
  --sun-bg: #1A1A1A; --sun-t1: #2D253A; --sun-t2: #574777; --sun-t3: #6A578F;
  --sun-stop: #BEADD6; --sun-knob: #1A1A1A; --sun-glyph: #AB8CF0; --sun-rim: #574777;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  width: var(--sun-w);
  height: var(--sun-h);
  padding: var(--sun-pad);
  border-radius: 999px;
  background: linear-gradient(120deg, var(--sun-t1) 0%, var(--sun-t2) 55%, var(--sun-t3) 100%);
  box-shadow: inset 0 0 0 1px var(--sun-rim);
  flex: none;
  transition:
    --sun-t1 var(--sun-t) var(--sun-heavy), --sun-t2 var(--sun-t) var(--sun-heavy),
    --sun-t3 var(--sun-t) var(--sun-heavy), --sun-stop var(--sun-t) var(--sun-heavy),
    --sun-knob var(--sun-t) var(--sun-heavy), --sun-glyph var(--sun-t) var(--sun-heavy),
    --sun-rim var(--sun-t) var(--sun-heavy);
}
.sun-toggle[data-mood="light"] {
  --sun-t1: #EEE9F6; --sun-t2: #DCCFF6; --sun-t3: #C4B0EE;
  --sun-stop: #6A578F; --sun-knob: #FFFFFF; --sun-glyph: #6A578F; --sun-rim: #C4B0EE;
}
.sun-toggle[data-mood="sunset"] {
  --sun-t1: #574777; --sun-t2: #B4607E; --sun-t3: #E2A06E;
  --sun-stop: #FFF4EC; --sun-knob: #2D253A; --sun-glyph: #E2A06E; --sun-rim: #E2C184;
}
/* 首帧恢复存档态时禁用过渡 */
.sun-toggle.is-instant, .sun-toggle.is-instant * { transition: none !important; }

.sun-toggle__stop {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  height: var(--sun-knob-size);
  padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--sun-stop);
  opacity: 0.75; cursor: pointer;
  transition: opacity 300ms ease;
  -webkit-tap-highlight-color: transparent;
}
.sun-toggle__stop:hover { opacity: 1; }
.sun-toggle__stop[aria-checked="true"] { opacity: 0; }
.sun-toggle__stop:focus-visible { opacity: 1; outline: 2px solid var(--sun-glyph); outline-offset: 2px; }
.sun-toggle__stop svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 600ms var(--sun-settle);
}
.sun-toggle__stop[data-mood="light"]:hover svg { transform: rotate(45deg) scale(1.1); }
.sun-toggle__stop[data-mood="dark"]:hover svg { transform: rotate(-18deg) scale(1.1); }
.sun-toggle__stop[data-mood="sunset"]:hover svg { transform: translateY(-2px) scale(1.1); }

/* 旋钮：重缓动滑动；内部 face 在移动中压扁回弹（JS Web Animations） */
.sun-toggle__knob {
  position: absolute; z-index: 2;
  top: var(--sun-pad); left: var(--sun-pad);
  width: var(--sun-knob-size); height: var(--sun-knob-size);
  pointer-events: none;
  transform: translateX(calc(var(--sun-i, 0) * var(--sun-travel)));
  transition: transform 640ms var(--sun-heavy);
}
.sun-toggle__face {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--sun-knob);
  color: var(--sun-glyph);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22), inset 0 0 0 1px var(--sun-rim);
}
.sun-toggle .glyph {
  position: absolute;
  width: 30px; height: 30px;
  overflow: visible;
  opacity: 0;
  transform: rotate(-70deg) scale(0.5);
  transition: opacity 360ms ease, transform 760ms var(--sun-settle);
}
.sun-toggle .ray, .sun-toggle .sun-core, .sun-toggle .moon-body, .sun-toggle .star,
.sun-toggle .sunset-glow, .sun-toggle .sunset-sun, .sun-toggle .sunset-ripple {
  transform-box: fill-box; transform-origin: center;
}
.sun-toggle[data-mood="light"] .glyph--sun,
.sun-toggle[data-mood="dark"] .glyph--moon,
.sun-toggle[data-mood="sunset"] .glyph--sunset {
  opacity: 1; transform: rotate(0deg) scale(1);
  transition-delay: 160ms;
}
.sun-toggle .ray { stroke: #E2A06E; stroke-width: 2.4; stroke-linecap: round; transform-origin: center bottom; }
.sun-toggle .sun-rays { transform-origin: 24px 24px; transform-box: view-box; }
.sun-toggle[data-mood="light"] .ray { animation: sunchine 520ms var(--sun-settle) calc(260ms + var(--n) * 55ms) backwards; }
.sun-toggle[data-mood="light"] .sun-rays { animation: sunspin 26s linear 900ms infinite; }
.sun-toggle[data-mood="light"] .sun-core { animation: suncorein 700ms var(--sun-settle) 160ms backwards; }
.sun-toggle .star { fill: #F6F6F4; opacity: 0; }
.sun-toggle[data-mood="dark"] .star {
  animation:
    sunstarin 520ms var(--sun-settle) calc(420ms + var(--d) * 120ms) forwards,
    suntwinkle 2.6s ease-in-out calc(1100ms + var(--d) * 380ms) infinite;
}
.sun-toggle[data-mood="dark"] .moon-body { animation: sunmoonin 800ms var(--sun-settle) 160ms backwards; }
.sun-toggle .sunset-line { stroke: #E2C184; stroke-width: 1.8; stroke-linecap: round; }
.sun-toggle .sunset-ripple { stroke: #E2A06E; stroke-width: 1.6; stroke-linecap: round; opacity: 0.75; }
.sun-toggle .sunset-glow { opacity: 0; }
.sun-toggle[data-mood="sunset"] .sunset-glow {
  animation:
    sunglowin 900ms var(--sun-settle) 200ms forwards,
    sunbreathe 3.4s ease-in-out 1100ms infinite;
}
.sun-toggle[data-mood="sunset"] .sunset-sun { animation: sunsink 900ms var(--sun-settle) 160ms backwards; }
.sun-toggle[data-mood="sunset"] .sunset-ripple {
  animation:
    sunripple 600ms var(--sun-settle) calc(500ms + var(--n) * 120ms) backwards,
    sunshimmer 3.4s ease-in-out calc(1100ms + var(--n) * 300ms) infinite;
}
/* 原版 ray-in 改名 sunchine，避免与全站其它 ray-in 潜在冲突 */
@keyframes sunchine { from { transform: scaleY(0); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .sun-toggle, .sun-toggle * { transition: none !important; animation: none !important; }
  .sun-toggle .star, .sun-toggle .sunset-glow { opacity: 1; }
}
/* sun 开关配套动画帧（移植自 E:\sun\style.css，名称加 sun 前缀防冲突：sunchine 见上） */
@keyframes sunspin   { to { transform: rotate(360deg); } }
@keyframes suncorein { from { transform: scale(0.6); } }
@keyframes sunmoonin { from { transform: rotate(-35deg) scale(0.7); } }
@keyframes sunstarin { from { opacity: 0; transform: scale(0) rotate(-45deg); } to { opacity: 1; transform: scale(1) rotate(0deg); } }
@keyframes suntwinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
@keyframes sunglowin { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes sunbreathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.12); } }
@keyframes sunsink   { from { transform: translateY(-9px); } }
@keyframes sunripple { from { transform: scaleX(0); opacity: 0; } }
@keyframes sunshimmer { 0%, 100% { opacity: 0.75; } 50% { opacity: 0.35; } }

/* ============ v8：关怀语改为植物 AI 形象旁的聊天气泡（尖角指向植物，4s 自动消失） ============
   位置由 JS 依据 #plant-avatar 实时计算（positionGreet），此处只负责外观与弹出动画。
   动画刻意用 opacity/scale（不写 transform，避免与 JS 内联定位的 transform 冲突）。 */
.greet-float {
  position: fixed; z-index: 90;
  max-width: 240px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px var(--shadow-color);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  pointer-events: none;
  animation: greetPop 4s ease forwards;
}
/* 气泡尖角：一个旋转 45° 的小方块，贴在有尖角的一侧 */
.greet-float::after {
  content: ""; position: absolute; top: calc(50% - 6px);
  width: 12px; height: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  transform: rotate(45deg);
}
/* 植物在气泡左侧 → 尖角朝左 */
.greet-float.greet-right::after { left: -7px; border-right: none; border-top: none; }
/* 植物在气泡右侧 → 尖角朝右 */
.greet-float.greet-left::after { right: -7px; border-left: none; border-bottom: none; }
/* 两侧都放不下 → 贴在植物下方，尖角朝上 */
.greet-float.greet-below { transform: translateX(-50%); transform-origin: center bottom; }
.greet-float.greet-below::after { left: calc(50% - 6px); top: -7px; border-right: none; border-bottom: none; }
@keyframes greetPop {
  0%   { opacity: 0; scale: 0.8; }
  12%  { opacity: 1; scale: 1; }
  84%  { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 0.92; }
}

/* ============ v10.1：开场动画（人工修订版） ============
   背景：动态莫比乌斯环——与顶栏图标完全同款：紫粉渐变描边 ∞，
   dash 色带沿环流动（mobiusFlow）+ 整体 ±4° 摆动（mobiusTilt），不加雾化、不加额外高光层；
   文字：仅英文连笔倾斜花体「meet a better self」，整行 mask 匀速扫过 = 从左到右连续逐字母书写；
   全程 4s：书写 0.5s 起笔 + 2.4s 写完，停留后 0.6s 淡出。 */
#splash {
  position: fixed; inset: 0; z-index: 9000;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #fdfbff 55%, #f5f0fd 100%);
  display: flex; justify-content: center; align-items: center;
  overflow: clip;
}
#splash.splash-out { animation: splashFade 0.6s ease both; }
@keyframes splashFade { from { opacity: 1; } to { opacity: 0; } }

.splash-wrap { position: relative; display: flex; justify-content: center; align-items: center; }
/* 背景莫比乌斯环：与顶栏图标同款动效——dash 色带沿环流动 + ±4° 摆动（参数与 .mobius 一致） */
.splash-mobius {
  width: min(74vmin, 560px);
  overflow: visible;
  filter: drop-shadow(0 10px 26px rgba(164, 139, 232, 0.3));
  animation: mobiusTilt 6s ease-in-out infinite;
}
.sm-band {
  fill: none;
  stroke: url(#smg);
  stroke-width: 6.5;
  stroke-linecap: round;
  opacity: 0.9;
  stroke-dasharray: 42 22;
  animation: mobiusFlow 3.2s linear infinite;
}

/* 中央花体标语：mask 渐变带整行匀速右→左退，笔迹从左到右连续写出 */
.splash-text {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
  white-space: nowrap;
}
.splash-en {
  display: inline-block;
  font-family: 'Segoe Script', 'Brush Script MT', 'Lucida Handwriting', cursive;
  font-style: italic;
  font-size: clamp(26px, 5.6vmin, 44px);
  color: #3B3552;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 14px rgba(255, 255, 255, 0.65);
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-size: 240% 100%; mask-size: 240% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
  animation: splashWrite 2.4s linear forwards;
  animation-delay: 0.5s;
}
@keyframes splashWrite {
  to { -webkit-mask-position: 0% 0; mask-position: 0% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-mobius, .sm-band { animation: none; }
  .splash-en { animation-duration: 0.01s; animation-delay: 0s; }
}

/* ---------- v14：身体页 AI 科普小站 + 基础档案折叠头 ---------- */
.know-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 6px 0 8px; }
.know-text { font-size: 14px; color: var(--sub); line-height: 1.7; margin: 0; }
.know-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.fold-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fold-head .card-sub { margin-bottom: 0; }

/* =====================================================================
   v17：自建 SVG 表情库 + PC 桌面化（方案C 响应式）
   —— 窄屏（<1024px）完全维持原移动布局；宽屏顶栏转左侧品牌栏、首页双列
   ===================================================================== */

/* ---- SVG 图标基线：跟随字号与文字颜色 ---- */
.ui-ico { width: 1.05em; height: 1.05em; vertical-align: -0.18em; flex: none; }

/* ---- hero 收支行（图二形态：标签 + 值/目标 + 进度条） ---- */
.hm-line { display: grid; grid-template-columns: 64px 108px 1fr; align-items: center; gap: 8px; margin-top: 7px; font-size: 13px; }
.hm-line .hl-label { color: var(--sub); }
.hm-line .hl-val { color: var(--sub); white-space: nowrap; }
.hm-line .hl-val b { color: var(--text); font-size: 14px; }
.hm-line .hl-track { height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; }
.hm-line .hl-track i { display: block; height: 100%; border-radius: 999px; transition: width .3s; }

/* ---- 「?」计算依据：小圆钮 + 点击浮层 ---- */
.q-wrap { position: relative; display: inline-flex; align-items: center; margin-left: 6px; vertical-align: 1px; }
.q-btn {
  width: 17px; height: 17px; border-radius: 50%;
  border: 1px solid var(--primary); background: rgba(164,139,232,.10);
  color: var(--primary-dark); font-size: 11px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.q-btn:hover { background: var(--primary); color: #fff; }
.q-pop {
  display: none; position: absolute; z-index: 80;
  left: 22px; top: -6px; width: 280px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(80,60,140,.18);
  padding: 10px 12px; font-size: 12px; color: var(--sub); font-weight: 400; line-height: 1.7; text-align: left;
}
.q-pop.open { display: block; }
.q-pop b { display: block; color: var(--text); margin-bottom: 2px; }
.met-card .q-pop, .basis-block .q-pop { left: auto; right: 0; top: 22px; }
.basis-block { display: flex; align-items: center; gap: 4px; }
.basis-block b { color: var(--sub); font-weight: 700; }

/* ---- 三餐标题行（快速记一餐入口） ---- */
.meals-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 8px; }
.meals-head b { font-size: 15px; }

/* ---- 今日时间线卡 ---- */
.h-timeline .tl-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; cursor: pointer; }
.h-timeline .tl-head b { font-size: 15px; }
.tl-row { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; cursor: pointer; }
.tl-row:hover .tl-body { color: var(--primary-dark); }
.tl-time { font-size: 12px; color: var(--sub); width: 40px; flex: none; font-variant-numeric: tabular-nums; padding-top: 1px; }
.tl-dot {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(164,139,232,.12); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.tl-body { flex: 1; min-width: 0; font-size: 13px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.tl-kcal { font-size: 12px; color: var(--accent); font-weight: 700; }
/* v17.2：时间线列表固定为 4 条记录高度（每条约 36px），超出滚动查看 */
.tl-list { max-height: 180px; overflow-y: auto; padding-right: 4px; }
.tl-list::-webkit-scrollbar { width: 6px; }
.tl-list::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

/* ===================== PC 宽屏（≥1024px）：方案C ===================== */
@media (min-width: 1024px) {
  /* 顶栏 → 左侧固定品牌导航栏 */
  .topbar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 224px; z-index: 50;
    border-bottom: none; border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(164,139,232,.14), rgba(242,166,200,.10) 46%, var(--card) 100%), var(--card);
    display: flex; flex-direction: column;
  }
  .topbar-inner { max-width: none; flex: none; flex-direction: column; align-items: stretch; gap: 10px; padding: 20px 14px 6px; flex-wrap: nowrap; }
  .brand { min-width: 0; }
  .brand-slogan { font-size: 11px; line-height: 1.5; margin-top: 6px; }
  .account-btn { position: absolute; top: 18px; right: 14px; }
  .sun-toggle { margin-top: auto; align-self: center; }
  .topbar .tabs {
    flex: 1; max-width: none; margin: 10px 0 0; padding: 0 8px;
    flex-direction: column; align-items: stretch; gap: 2px; overflow-y: auto;
  }
  .tab-btn { flex: none; text-align: center; padding: 12px 14px; border-radius: 12px; font-size: 18px; gap: 10px; }
  /* v18.1：PC 导航栏字号与图标整体放大（15px/16px → 18px/24px），首页不再单独小一号 */
  .tab-ico { width: 24px; height: 24px; }
  .tab-btn.home { font-size: 18px; }
  .tab-btn:hover { background: rgba(164,139,232,.10); }
  .tab-btn.active { background: rgba(164,139,232,.16); font-weight: 700; }
  .tab-btn.active::after { left: 4px; top: 50%; bottom: auto; transform: translateY(-50%); width: 3px; height: 18px; }

  /* 主区让开左栏 */
  body { padding-left: 224px; }
  .main { max-width: 1280px; padding: 26px 34px 160px; }
  .homebar { left: 224px; }

  /* 首页：方案二——时间线（2fr）与运动卡（1fr）并排成一行，其余整宽。
     v18：宽度不再自定（原 max-width:1120px; margin:0），改由公共 .layout-content 统一约束，
     这里只做网格重排；DOM 与移动端单列顺序不变。 */
  .home-col {
    display: grid; width: 100%;
    grid-template-columns: 2fr 1fr; column-gap: 18px; row-gap: 6px;
    grid-template-areas:
      "main  main"
      "mk    mk"
      "meals meals"
      "tl    sport"
      "grid  grid";
  }
  #h-main     { grid-area: main; }
  .meals-head { grid-area: mk; }
  #h-meals    { grid-area: meals; width: 100%; }
  #h-timeline { grid-area: tl; width: 100%; align-self: start; }
  #h-sport    { grid-area: sport; width: 100%; align-self: start; }
  #h-grid     { grid-area: grid; }
  #h-cols, .home-cols { display: block; }
  #h-meals { grid-template-columns: repeat(4, 1fr); }
  /* 喝水/体重/轻断食/生理期/便便 等宫格并排成一行 */
  .tile-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

  /* hero 与时间线融入背景：去掉卡片边界（底色/阴影/圆角/内边距），大数字与时间线直接坐在页面底色上（方案C 观感） */
  #h-main.card, #h-timeline.card { background: transparent; box-shadow: none; border: none; border-radius: 0; padding: 2px 0 0; margin-bottom: 8px; }
  .hm-top { gap: 32px; }
  .hm-big b { font-size: 52px; }

  /* 其余 tab（v18：宽度规则已删除，统一由 .layout-content 提供，与首页左右边界完全对齐） */
  /* v17.5：身体/饮食模块较少，PC 竖向居中，消除底部大片留白（min-height 为下限，内容超高时不裁切） */
  #view-diet, #view-body {
    display: flex; flex-direction: column; justify-content: center;
    min-height: calc(100vh - 220px);
  }
  #view-body .card, #met-cards, #met-preview, #wt-chart { max-width: none; }
  .met-grid { grid-template-columns: repeat(4, 1fr); }

  /* 弹窗限宽居中（PC 上不再全屏） */
  .modal { max-width: 720px; }
}
