/* ============================================================
   健康管家 · 设计系统 v2（肾友管家改版）
   ------------------------------------------------------------
   来源：kidney-care-design/spec/（机器可读规格）+ pages/style.css（定稿原型）
     · 颜色/圆角/阴影/动效全部照搬《肾友管家-定义文档.md》§3，不得新增色值
     · 绿/黄/红**只**表达判定与状态；饮水一律蓝；减重组一律暖色
     · 最小字号 11px（适老化）；大数字用 tabular-nums
     · prefers-reduced-motion 下必须关掉全部动画（无障碍硬要求）

   为什么单独一个文件而不是改 app.css：
     原型是「视觉与交互的权威参照」，而 app.css 里是旧版布局（顶部标题栏 +
     网格标签栏）。这里用后加载的样式覆盖同名 token 与外壳，旧视图（record /
     trend / plan / settings / foods）不做改动也能一起变新样式，
     出问题只需删掉 index.html 里的这一行 <link> 即可回退。
   ============================================================ */

:root {
  /* 主色 · 医疗青 */
  --primary: #0F766E;
  --primary-2: #14B8A6;
  --primary-light: #CCFBF1;
  --primary-deep: #134E4A;
  --bg: #F1F5F4;
  --card: #FFFFFF;
  --line: #E5E7EB;
  --text: #1F2937; --text-2: #6B7280; --text-3: #9CA3AF;
  /* 红黄绿三色语义（判定与状态专用，不作装饰） */
  --green: #16A34A; --green-bg: #F0FDF4; --green-line: #BBF7D0;
  --amber: #D97706; --amber-bg: #FFFBEB; --amber-line: #FDE68A;
  --red: #DC2626;   --red-bg: #FEF2F2;   --red-line: #FECACA;
  --blue: #2563EB;  --blue-bg: #EFF6FF;
  /* 减重维度专用强调色 */
  --amber-deep: #C2410C;
  --kcal: #F97316; --sugar: #EC4899;
  /* 拍照页深色底 */
  --camera-bg: #0C2622; --camera-accent: #5EEAD4; --camera-text: #99F6E4; --camera-chip: #CCFBF1;
  --radius: 20px; --radius-s: 14px;
  --shadow: 0 1px 3px rgba(31,41,55,.06), 0 4px 14px -6px rgba(31,41,55,.08);
  --ease: cubic-bezier(.22,1,.36,1);
  --app-max: 414px;

  /* ---- 旧变量名 → 新语义（app.css 里的旧视图仍引用它们，别删） ---- */
  --brand: var(--primary);
  --brand-dark: var(--primary-deep);
  --brand-soft: var(--primary-light);
  --green-soft: var(--green-bg);
  --yellow: var(--amber);
  --yellow-soft: var(--amber-bg);
  --red-soft: var(--red-bg);
  --fg: var(--text);
  --muted-color: var(--text-2);
}

/* ---------- 底座：纵向 flex + 414px 居中列 ----------
   ⚠️ body 必须是 flex-direction:column。用横向 flex 时，页面底部的说明文字
   会成为并列子元素，把主体列挤出居中位置，而固定底栏始终按视口居中 → 底栏与
   主体横向错位（原型里踩过这个坑，spec/routes-and-pages.json.layoutPitfall）。 */
html { -webkit-text-size-adjust: 100%; }

body {
  background: #DDE6E3;
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

#shell {
  width: 100%;
  max-width: var(--app-max);
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(15,40,35,.12);
}

/* ---------- 顶部导航（子页面） ---------- */
#topbar {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: var(--app-max);
  height: calc(var(--top-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  display: flex; align-items: center; gap: 10px;
  z-index: 50;
  background: rgba(241,245,244,.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229,231,235,.6);
}
#shell:not(.with-topbar) #topbar { display: none; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-h b { font-size: 15px; font-weight: 700; }
.card-h a { font-size: 13px; color: var(--primary); font-weight: 600; }
/* 旧视图的 .card-head 与 .card-h 同义，一起统一 */
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }

/* ---------- 状态 pill ---------- */
.pill { font-size: 11px; padding: 4px 11px; border-radius: 99px; font-weight: 700; white-space: nowrap; }
.pill-ok { background: var(--green-bg); color: var(--green); }
.pill-warn { background: var(--amber-bg); color: var(--amber); }
.pill-bad { background: var(--red-bg); color: var(--red); }
.pill-info { background: var(--blue-bg); color: var(--blue); }

/* ---------- 大数字 ---------- */
.big-num { font-size: 40px; font-weight: 800; color: var(--primary-deep);
  letter-spacing: -1.5px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.big-num .u { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0; }

/* ---------- 进度条（进入页面即「生长」，延迟 0.3s） ---------- */
.bar { height: 8px; border-radius: 99px; background: #E9EFED; overflow: hidden; }
.bar i, .bar > i { display: block; height: 100%; border-radius: 99px; width: 0;
  background: var(--primary); transition: width 1.1s var(--ease) .3s; }
.bar.green > i { background: var(--green); }
.bar.yellow > i { background: var(--amber); }
.bar.red > i { background: var(--red); }
/* 额度条配色：daily-quotas.json → barColorRules（<70% 指标色 / 70–100% 琥珀 / >100% 红） */
.bar.lv-warn > i { background: var(--amber) !important; }
.bar.lv-over > i { background: var(--red) !important; }

/* ---------- 环形进度（SVG，r=54） ---------- */
.ring-wrap { position: relative; width: 130px; height: 130px; margin: 4px auto; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-wrap .track { fill: none; stroke: #E9EFED; stroke-width: 11; }
.ring-wrap .prog { fill: none; stroke: var(--primary); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 339.29; stroke-dashoffset: 339.29; transition: stroke-dashoffset 1.4s var(--ease) .3s; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center b { font-size: 24px; font-weight: 800; color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.ring-center span { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* ---------- 列表行 ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #F3F4F6; }
.row:last-child { border-bottom: none; }
.row .em { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center;
  justify-content: center; font-size: 21px; flex-shrink: 0; background: var(--bg); }
.row .tx { flex: 1; min-width: 0; }
.row .tx b { font-size: 14px; font-weight: 600; display: block; }
.row .tx span { font-size: 12px; color: var(--text-2); display: block; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-go { font-size: 12px; color: var(--primary); background: var(--primary-light);
  border-radius: 99px; padding: 7px 14px; font-weight: 700; flex-shrink: 0; border: 0;
  transition: transform .15s var(--ease); }
.btn-go:active { transform: scale(.93); }
.ck { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff;
  transition: all .25s var(--ease); background: #fff; }
.ck.on { background: var(--green); border-color: var(--green); animation: popIn .35s var(--ease); }
.st { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 99px; flex-shrink: 0; }
.st-g { background: var(--green-bg); color: var(--green); }
.st-y { background: var(--amber-bg); color: var(--amber); }
.st-r { background: var(--red-bg); color: var(--red); }

/* ---------- 底部导航（5 项固定；「拍摄」凸起 FAB） ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-max);
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; z-index: 60;
}
#tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10px; font-weight: 600; color: var(--text-3);
  background: transparent; border: 0; padding: 0; min-height: 0; transition: color .2s;
}
#tabbar .tab svg, #tabbar .tab .tab-ico {
  width: 23px; height: 23px; font-size: 20px; line-height: 1;
  stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s var(--ease);
}
#tabbar .tab.on, #tabbar .tab.is-active { color: var(--primary); font-weight: 700; }
#tabbar .tab.on svg, #tabbar .tab.is-active .tab-ico { transform: translateY(-2px) scale(1.08); }
/* ⚠️ 凸起按钮的负 margin 只加在 .fab 上；加到 .tab 上会让图标与文字基线整体上移，
   与其它四个 Tab 错位（原型踩坑记录，见 spec/routes-and-pages.json.tabbar.cameraTab.pitfall）。 */
#tabbar .tab-cam { justify-content: flex-start; padding-top: 10px; }
#tabbar .tab-cam .fab {
  width: 52px; height: 52px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-top: -26px; position: relative; z-index: 2;
  animation: pulse 2.6s ease-in-out infinite;
}
#tabbar .tab-cam .fab svg { width: 25px; height: 25px; stroke: #fff; transform: none; }
#tabbar .tab-cam span { color: var(--text-2); margin-top: 2px; font-weight: 600; }

/* ---------- 红绿灯（规则说明 / 判定图例） ---------- */
.traffic { display: flex; gap: 10px; }
.tl { flex: 1; border-radius: 16px; padding: 14px 8px; text-align: center; }
.tl .ic { font-size: 24px; }
.tl .nm { font-size: 13px; font-weight: 800; margin-top: 5px; }
.tl .ds { font-size: 10px; margin-top: 2px; opacity: .75; }
.tl-g { background: var(--green-bg); color: var(--green); }
.tl-y { background: var(--amber-bg); color: var(--amber); }
.tl-r { background: var(--red-bg); color: var(--red); }

/* ---------- 判定灯组（食物详情：灯依次点亮 300/700/1100ms） ---------- */
.judge { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 18px 0 8px; }
.jl { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 22px; filter: grayscale(1) opacity(.35); transition: all .4s var(--ease); }
.jl.lit { filter: none; transform: scale(1.12); animation: popIn .5s var(--ease); }
.jl-g { background: var(--green-bg); border: 2.5px solid var(--green); }
.jl-y { background: var(--amber-bg); border: 2.5px solid var(--amber); }
.jl-r { background: var(--red-bg); border: 2.5px solid var(--red); }
.verdict { text-align: center; padding: 14px; border-radius: 16px; animation: popIn .5s var(--ease) both; }

/* ---------- 提示条 ---------- */
.advice { border-radius: 16px; padding: 13px 14px; font-size: 13px; line-height: 1.65; }
.advice b { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 4px; }
.ad-blue { background: var(--blue-bg); border: 1px solid #BFDBFE; color: #1E40AF; }
.ad-amber { background: var(--amber-bg); border: 1px solid var(--amber-line); color: #92400E; }

/* ---------- 标签 / 徽标 ---------- */
.badge { border-radius: 99px; padding: 3px 9px; font-size: 11px; font-weight: 700;
  background: #EEF1F3; color: var(--text-2); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.yellow { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: #EEF1F3; color: var(--text-2); }
.badge.info { background: var(--blue-bg); color: var(--blue); }

/* ---------- 页签 / 分段 ---------- */
.seg { display: flex; background: #E9EFED; border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: none; background: transparent; padding: 9px 4px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all .25s var(--ease); }
.seg button.on, .seg button.is-active { background: #fff; color: var(--primary-deep); box-shadow: 0 1px 4px rgba(31,41,55,.12); }
/* 吃饭｜饮水 双页签 */
.split-tabs { display: flex; background: #E9EFED; border-radius: 13px; padding: 3px; gap: 2px; }
.split-tabs a, .split-tabs button { flex: 1; text-align: center; padding: 10px 2px; border-radius: 11px;
  font-size: 13.5px; font-weight: 700; color: var(--text-2); border: 0; background: transparent;
  transition: all .25s var(--ease); }
.split-tabs a.on, .split-tabs button.on { background: #fff; color: var(--primary-deep); box-shadow: 0 1px 4px rgba(31,41,55,.12); }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 8px 15px;
  font-size: 13px; color: var(--text-2); transition: all .2s var(--ease); }
.chip.hot { background: var(--primary-light); color: var(--primary-deep); border-color: transparent; font-weight: 700; }
.chip.on, .chip.is-active { background: var(--primary); color: #fff; border-color: transparent; font-weight: 700; }

/* ---------- 开关 ---------- */
.switch { width: 46px; height: 27px; border-radius: 99px; background: #D6DDDB; position: relative;
  flex-shrink: 0; border: none; padding: 0; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: left .25s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--green); }
.switch.on::after { left: 21.5px; }

/* ---------- 搜索框 ---------- */
.search { display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 14px; transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }
.search svg { width: 17px; height: 17px; stroke: var(--text-3); fill: none; stroke-width: 2; flex-shrink: 0; }
.search input { border: none; outline: none; flex: 1; min-width: 0; font-size: 14px; background: transparent; color: var(--text); }
.search input::placeholder { color: var(--text-3); }

/* ---------- 底部弹层（动效 translateY 105% → 0，0.4s） ---------- */
.sheet-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .3s; }
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; bottom: 0; left: 50%; z-index: 90;
  transform: translateX(-50%) translateY(105%);
  width: 100%; max-width: var(--app-max); background: #fff;
  border-radius: 24px 24px 0 0; padding: 12px 18px calc(20px + var(--safe-bottom));
  transition: transform .4s var(--ease); max-height: 82vh; overflow-y: auto; }
.sheet.show { transform: translateX(-50%) translateY(0); }
.sheet .grab { width: 38px; height: 4px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font-size: 16px; font-weight: 700; margin: 0; }

/* ---------- 主按钮 / 幽灵按钮 ---------- */
.btn-main { display: block; width: 100%; border: none; background: var(--primary); color: #fff;
  border-radius: 15px; padding: 15px; font-size: 15px; font-weight: 700; text-align: center;
  transition: transform .15s var(--ease), background .2s; }
.btn-main:active { transform: scale(.97); background: var(--primary-deep); }
.btn-ghost { display: block; width: 100%; border: none; background: transparent; color: var(--text-2);
  padding: 13px; font-size: 13px; font-weight: 600; text-align: center; }
.btn-ghost:active { background: rgba(31,41,55,.04); }

/* ---------- 骨架屏 ---------- */
.skel { border-radius: 12px; background: linear-gradient(90deg,#EEF2F1 25%,#F7FAF9 50%,#EEF2F1 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ---------- 时间线（提醒中心） ---------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding: 8px 0; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 15px; width: 11px; height: 11px;
  border-radius: 50%; background: #fff; border: 2.5px solid var(--text-3); transition: all .3s; }
.tl-item.done::before { border-color: var(--green); background: var(--green); }
.tl-item.next::before { border-color: var(--primary); background: #fff; animation: blink 1.8s ease-in-out infinite; }
.tl-item b { font-size: 14px; display: block; font-weight: 600; }
.tl-item span { font-size: 12px; color: var(--text-2); }
.tl-item .tm { float: right; font-size: 12px; color: var(--text-3); font-weight: 700; }

/* ---------- 连续打卡（小树） ---------- */
.streak { background: linear-gradient(135deg,#134E4A,#0F766E); border-radius: var(--radius);
  padding: 16px; color: #fff; }
.streak .s-top { display: flex; justify-content: space-between; align-items: center; }
.streak b { font-size: 15px; }
.streak p { font-size: 12px; opacity: .8; margin: 4px 0 0; }
.streak .days { display: flex; gap: 6px; margin-top: 12px; }
.streak .days i { flex: 1; height: 7px; border-radius: 99px; background: rgba(255,255,255,.25); transition: background .4s; }
.streak .days i.lit { background: var(--camera-accent); }

/* ---------- 卡片网格（六宫格入口 / 四宫格指标） ---------- */
.shot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shot-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shot-card { background: #fff; border-radius: 16px; padding: 15px; color: var(--text);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 7px;
  border: 0; text-align: left; transition: transform .15s var(--ease); }
.shot-card:active { transform: scale(.96); }
.shot-card .em { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; background: var(--primary-light); }
.shot-card b { font-size: 14px; }
.shot-card span { font-size: 11.5px; color: var(--text-2); line-height: 1.45; }
.shot-card .k { font-size: 11px; color: var(--text-2); }
.shot-card .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.shot-card .v .u { font-size: 11px; font-weight: 600; color: var(--text-2); }
.shot-card .t { font-size: 10px; font-weight: 700; color: var(--text-2); }

/* ---------- 空状态 / 拖拽手柄 ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--text-3); }
.empty .em { font-size: 38px; margin-bottom: 10px; display: block; }
.empty .ico { font-size: 30px; display: block; margin-bottom: 6px; }
.empty p { font-size: 13px; line-height: 1.6; margin: 0; white-space: pre-line; }
.drag-handle { width: 20px; height: 20px; flex-shrink: 0; opacity: .35; }
.drag-handle::before { content: "⋯⋯"; display: block; font-size: 15px; letter-spacing: -2px;
  color: var(--text); transform: rotate(90deg); }

/* ---------- 拍摄中心（深色取景区，P02 / P06） ---------- */
.cam-page { background: var(--camera-bg); color: #fff; min-height: 100vh;
  display: flex; flex-direction: column; }
.cam-top { display: flex; justify-content: space-between; align-items: center;
  padding: calc(var(--safe-top) + 14px) 16px 6px; }
.cam-top a, .cam-top button { color: var(--camera-text); font-size: 14px; font-weight: 600;
  background: transparent; border: 0; }
.cam-title { font-size: 15px; font-weight: 700; }
.stage { position: relative; height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.stage-inner { text-align: center; position: relative; z-index: 3; padding: 0 30px; }
.mode-hint { color: var(--camera-text); font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.mode-sub { color: var(--camera-accent); font-size: 12px; opacity: .75; line-height: 1.6; }
.mode-icon { font-size: 44px; margin-bottom: 14px; }
.vignette { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(6,26,22,.75) 100%); }
.corner { position: absolute; width: 58px; height: 58px; border: 3.5px solid var(--camera-accent); border-radius: 8px; }
.c1 { top: 16%; left: 8%; border-right: none; border-bottom: none; }
.c2 { top: 16%; right: 8%; border-left: none; border-bottom: none; }
.c3 { bottom: 33%; left: 8%; border-right: none; border-top: none; }
.c4 { bottom: 33%; right: 8%; border-left: none; border-top: none; }
.scanline { position: absolute; left: 10%; right: 10%; height: 2.5px; border-radius: 99px;
  background: linear-gradient(90deg,transparent,var(--camera-accent) 30%,var(--camera-text) 50%,var(--camera-accent) 70%,transparent);
  animation: scan 2.4s ease-in-out infinite; box-shadow: 0 0 14px rgba(94,234,212,.7); }
.barcode-line { position: absolute; left: 14%; right: 14%; height: 3px; border-radius: 99px;
  background: linear-gradient(90deg,transparent,#F87171 20%,#FCA5A5 50%,#F87171 80%,transparent);
  box-shadow: 0 0 16px rgba(248,113,113,.8); animation: barcodescan 2s ease-in-out infinite; }
.lens-hint { color: var(--camera-text); font-size: 15px; font-weight: 700; margin-bottom: 12px;
  animation: blink 2.2s ease-in-out infinite; }
.mode-bar { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 10px; scrollbar-width: none; }
.mode-bar::-webkit-scrollbar { display: none; }
.mode-chip { flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: var(--camera-chip);
  border-radius: 99px; padding: 9px 16px; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: all .22s var(--ease); }
.mode-chip.on { background: var(--camera-chip); color: var(--camera-bg); border-color: var(--camera-chip); font-weight: 700; }
.mode-chip:active { transform: scale(.95); }
/* 结果区：浅色圆角卡片，色彩语义回到浅色体系 */
.result-wrap { flex: 1; background: var(--bg); color: var(--text);
  border-radius: 26px 26px 0 0; padding: 18px 16px 120px; min-height: 300px; }
.res { display: none; }
.res.on { display: block; animation: fadeUp .5s var(--ease) both; }
.res-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.res-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.val-row { display: flex; gap: 10px; margin-top: 12px; }
.val { flex: 1; background: #fff; border-radius: 15px; padding: 12px 6px; text-align: center;
  border: 1.5px solid transparent; position: relative; touch-action: none; user-select: none; }
.val .n { font-size: 23px; font-weight: 800; color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.val .l { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.val .t { font-size: 10.5px; font-weight: 700; margin-top: 3px; }
/* 按住上下滑动微调时的反馈（behavior-rules.json → ocrAndManualAdjust.feedback） */
.val.drag { background: var(--primary-light); border-color: var(--primary); }
.val.drag .n { transform: scale(1.16); transition: transform .2s var(--ease); }
.val .arrows { position: absolute; right: 8px; top: 8px; font-size: 10px; color: var(--primary); display: none; }
.val.drag .arrows { display: block; animation: blink 1.2s ease-in-out infinite; }
.val .chg { position: absolute; right: 8px; top: 8px; font-size: 10px; font-weight: 700;
  background: var(--amber-bg); color: var(--amber); border-radius: 99px; padding: 2px 7px; }
/* 配料表 / 营养成分表 */
.nutri-table { background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.nutri-table .tr { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid #F3F4F6; font-size: 13.5px; }
.nutri-table .tr:last-child { border-bottom: none; }
.nutri-table .tr.hi b { color: var(--red); }
.nutri-table .tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 8px; }
.ingre { background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow);
  margin-top: 12px; font-size: 13.5px; line-height: 1.85; color: var(--text-2); }
.ingre mark { background: #FEE2E2; color: #B91C1C; font-weight: 700; padding: 1px 4px; border-radius: 4px; }

/* ---------- 饮水页（P05） ---------- */
.cup-wrap { display: flex; align-items: flex-end; gap: 22px; padding: 6px 4px 0; }
.cup { position: relative; width: 96px; height: 126px; border: 3px solid #C9D6D3; border-top: none;
  border-radius: 6px 6px 18px 18px; overflow: hidden; background: #F7FAF9; flex-shrink: 0; }
.cup .water { position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  background: linear-gradient(180deg,#7DD3FC,#38BDF8); transition: height 1s var(--ease) .2s; }
.cup .wave { position: absolute; left: -10%; right: -10%; top: -8px; height: 14px;
  border-radius: 50%; background: rgba(255,255,255,.45); }
.cup .ticks { position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: space-between; padding: 8px 0; }
.cup .ticks i { display: block; height: 1px; background: #D5E1DE; margin-left: auto; width: 14px; }
.cup .ticks i.big { width: 22px; background: #B9CBC7; }
.cup-meta { flex: 1; min-width: 0; }
.cup-meta .now { font-size: 36px; font-weight: 800; color: var(--primary-deep); line-height: 1;
  font-variant-numeric: tabular-nums; }
.cup-meta .goal { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.cup-meta .left { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  color: var(--amber); background: var(--amber-bg); border-radius: 99px; padding: 5px 11px; margin-top: 10px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 4px; }
.qbtn { border: 1.5px solid var(--line); background: #fff; border-radius: 15px; padding: 14px 4px;
  font-size: 14px; font-weight: 700; color: var(--primary-deep); transition: all .18s var(--ease); }
.qbtn span { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 600; margin-top: 3px; }
.qbtn:active { transform: scale(.94); background: var(--primary-light); border-color: var(--primary); }
.qbtn.custom { border-style: dashed; color: var(--text-2); }
.hour-grid { display: flex; gap: 4px; margin-top: 10px; }
.hour-grid i { flex: 1; height: 26px; border-radius: 6px; background: #E9EFED; }
.hour-grid i.done { background: linear-gradient(180deg,#7DD3FC,#38BDF8); }
.hour-grid i.part { background: #BAE6FD; }
.hour-legend { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); margin-top: 5px; }
.log-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid #F3F4F6; }
.log-row:last-child { border-bottom: none; }
.log-row .em { width: 36px; height: 36px; border-radius: 11px; background: var(--blue-bg);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.log-row .tx { flex: 1; min-width: 0; }
.log-row .tx b { font-size: 13.5px; display: block; }
.log-row .tx span { font-size: 11.5px; color: var(--text-2); }
.log-row .ml { font-size: 13px; font-weight: 700; color: #0284C7; }
.drink-warn { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); color: var(--text); border: 0; text-align: left; }
.drink-warn .em { font-size: 24px; }
.drink-warn b { font-size: 14px; display: block; }
.drink-warn span { font-size: 11.5px; color: var(--text-2); line-height: 1.5; }

/* ---------- 动效（时长与曲线照搬《定义文档》§3.5） ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes scan { 0% { top: 12%; } 50% { top: 70%; } 100% { top: 12%; } }
@keyframes barcodescan { 0% { top: 30%; } 50% { top: 62%; } 100% { top: 30%; } }
@keyframes pulse { 0%,100% { transform: scale(1); box-shadow: 0 8px 20px rgba(15,118,110,.4); }
  50% { transform: scale(1.05); box-shadow: 0 12px 26px rgba(15,118,110,.55); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes wavemove { 0%,100% { height: 12px; opacity: .5; } 50% { height: 44px; opacity: 1; } }

.anim { animation: fadeUp .55s var(--ease) both; }
.d1 { animation-delay: .06s } .d2 { animation-delay: .13s } .d3 { animation-delay: .2s }
.d4 { animation-delay: .27s } .d5 { animation-delay: .34s } .d6 { animation-delay: .41s }

/* 语音波形（7 根 5px 竖条，逐条延迟 0.12s） */
.wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 56px; margin: 6px 0 10px; }
.wave i { width: 5px; border-radius: 99px; background: var(--primary-2); height: 12px;
  animation: wavemove 1s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .12s } .wave i:nth-child(3) { animation-delay: .24s }
.wave i:nth-child(4) { animation-delay: .36s } .wave i:nth-child(5) { animation-delay: .48s }
.wave i:nth-child(6) { animation-delay: .6s }  .wave i:nth-child(7) { animation-delay: .72s }

/* ⚠️ 无障碍硬要求：系统开启「减弱动态效果」时关掉全部动画 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 旧视图兼容（app.css 里的类在这里统一到新设计） ---------- */
.muted { color: var(--text-2); font-size: 13px; }
.section-title { font-size: 13px; color: var(--text-2); font-weight: 700; }
.btn { border-radius: 15px; font-size: 14px; font-weight: 600; min-height: 44px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.stat .v, .stat-grid .v { font-variant-numeric: tabular-nums; }
.disclaimer { border-radius: var(--radius-s); font-size: 12px; line-height: 1.7; }
.proto-note { max-width: var(--app-max); margin: 14px auto 30px; text-align: center;
  font-size: 11px; color: #8AA09B; line-height: 1.7; padding: 0 20px; }
/* 只给读屏用的文字（判定必须同时有文字/图标，不能只靠颜色） */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- 餐盘识别 / 条形码结果行（P02） ---------- */
.dish-row { display: flex; align-items: center; gap: 11px; background: #fff; border-radius: 16px;
  padding: 12px 14px; margin-bottom: 9px; box-shadow: var(--shadow); }
.dish-row .em { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 19px; flex-shrink: 0; background: var(--bg); }
.dish-row .tx { flex: 1; min-width: 0; }
.dish-row .tx b { font-size: 14px; display: block; }
.dish-row .tx span { font-size: 11.5px; color: var(--text-2); }
.portion-tag { font-size: 11px; font-weight: 700; background: var(--bg); color: var(--text-2);
  border-radius: 99px; padding: 4px 10px; }
.note-mini { font-size: 11.5px; color: var(--text-3); margin-top: 10px; line-height: 1.6; text-align: center; }
/* 快门 / 微调轨道（P06） */
.shutter { width: 68px; height: 68px; border-radius: 50%; background: #fff;
  border: 4px solid rgba(255,255,255,.35); margin: 10px auto 0; }
.shutter:active { transform: scale(.94); }
.bp-track { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-3); margin-top: 6px; }

/* ---------- 提醒中心（P03） ---------- */
.day-bar { display: flex; justify-content: space-between; gap: 4px; padding: 2px 0; }
.day-cell { flex: 1; text-align: center; padding: 9px 0; border-radius: 12px; font-size: 11px;
  color: var(--text-2); transition: all .2s var(--ease); }
.day-cell b { display: block; font-size: 14.5px; color: var(--text); font-weight: 700; margin-top: 2px; }
.day-cell.on { background: #fff; box-shadow: var(--shadow); }
.day-cell.on b { color: var(--primary-deep); }
.day-cell .pt { display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--primary-2); margin-top: 4px; }
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-line .bar { flex: 1; }
.progress-line span { font-size: 12px; font-weight: 700; color: var(--primary-deep); white-space: nowrap; }
.merged-tip { background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: 14px;
  padding: 12px 14px; font-size: 12.5px; line-height: 1.6; color: #92400E; }

/* ---------- 我的指标（P04） ---------- */
.metric-tabs { display: flex; background: #E9EFED; border-radius: 13px; padding: 3px; gap: 2px; }
.metric-tabs button { flex: 1; text-align: center; padding: 9px 2px; border-radius: 11px; font-size: 13px;
  font-weight: 600; color: var(--text-2); background: transparent; border: 0; transition: all .25s var(--ease); }
.metric-tabs button.on { background: #fff; color: var(--primary-deep); box-shadow: 0 1px 4px rgba(31,41,55,.12); }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin-top: 12px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  height: 100%; justify-content: flex-end; }
.chart .col i { width: 100%; border-radius: 8px 8px 4px 4px; height: 0;
  transition: height 1s var(--ease) .3s; display: block; }
.chart .col span { font-size: 10px; color: var(--text-3); }
.chart .col b { font-size: 9.5px; color: var(--text-2); font-weight: 600; }

/* ---------- 运动打卡（P09） ---------- */
.checkin-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: 99px;
  padding: 9px 18px; margin-top: 0; font-size: 13px; font-weight: 700; color: #fff;
  background: var(--primary); text-align: center; flex: none; }
.checkin-btn.done { background: var(--green-bg); color: var(--green); animation: popIn .4s var(--ease); }
.auto-sync { font-size: 11.5px; color: var(--text-2); line-height: 1.6; display: flex;
  align-items: center; justify-content: center; gap: 6px; margin-top: 8px; }

/* ---------- 食物详情（P07） ---------- */
.food-hero { position: relative; padding: 26px 16px 20px; text-align: center;
  background: linear-gradient(180deg,#F0FDF4,#F7FBFA); }
.food-hero .em { font-size: 58px; display: inline-block; animation: popIn .6s var(--ease) both .15s; }
.food-hero h2 { font-size: 21px; font-weight: 800; margin-top: 8px; }
.food-hero p { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.eaten-ok { display: none; margin-top: 12px; background: var(--green-bg); border: 1px solid var(--green-line);
  border-radius: 14px; padding: 13px; text-align: center; animation: popIn .5s var(--ease); }
.eaten-ok.show { display: block; }

#topbar .topbar-title { font-size: 17px; font-weight: 700; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#topbar-back {
  width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line); background: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 17px; line-height: 1;
  transition: transform .15s var(--ease);
}
#topbar-back:active { transform: scale(.9); }
#topbar-back[hidden] { display: none !important; }
#topbar .icon-btn { color: var(--primary); min-width: 40px; min-height: 40px; font-size: 18px; }

/* ---------- 页面主体 ---------- */
#view {
  padding: calc(var(--safe-top) + 14px) 16px calc(110px + var(--safe-bottom));
  max-width: var(--app-max);
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 100vh;
}
#shell.with-topbar #view { padding-top: calc(var(--safe-top) + var(--top-h) + 12px); }
/* 拍摄中心自带深色底，页面主体不能再有灰色间隙 */
#shell.cam-route { background: var(--camera-bg); }
#shell.cam-route #view { padding: 0 0 calc(110px + var(--safe-bottom)); gap: 0; }

/* 问候区（每个一级页自己的标题，不再依赖顶栏） */
.greet { padding: 2px 0 2px; }
.greet h2 { font-size: 22px; font-weight: 800; letter-spacing: .2px; margin: 0; }
.greet p { font-size: 13px; color: var(--text-2); margin: 3px 0 0; }
