/* =========================================================
   FitPulse Mobile · 手机端样式
   ========================================================= */
:root {
  --bg: #040a16;
  --card-a: rgba(17, 34, 62, .82);
  --card-b: rgba(7, 16, 31, .92);
  --line: rgba(96, 165, 250, .13);
  --line-2: rgba(96, 165, 250, .28);
  --txt: #e8f2ff;
  --dim: #7d93b4;
  --faint: #4d6484;
  --cyan: #38bdf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: rgba(56, 189, 248, .3); }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---------- 背景 ---------- */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(70, 140, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 140, 255, .05) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000 20%, transparent 80%);
  mask-image: radial-gradient(120% 70% at 50% 0%, #000 20%, transparent 80%);
}
.glow { position: absolute; border-radius: 50%; filter: blur(70px); }
.g1 { width: 340px; height: 340px; top: -150px; right: -120px; background: radial-gradient(circle, rgba(29, 78, 216, .5), transparent 70%); }
.g2 { width: 300px; height: 300px; bottom: -140px; left: -100px; background: radial-gradient(circle, rgba(14, 165, 233, .28), transparent 70%); }

/* ---------- 骨架 ---------- */
.app { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 10px;
  background: linear-gradient(180deg, rgba(4, 10, 22, .97) 55%, rgba(4, 10, 22, 0));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.top-date { font-size: 20px; font-weight: 650; letter-spacing: .3px; }
.top-sub { font-size: 11px; color: var(--dim); margin-top: 1px; }
.top-btn {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(56, 120, 220, .12); border: 1px solid var(--line-2); color: #7dd3fc;
}
.top-btn .ico { width: 19px; height: 19px; }

.screen {
  flex: 1; display: flex; flex-direction: column; gap: 12px;
  padding: 6px 16px calc(104px + env(safe-area-inset-bottom));
}
body.no-tabs .screen { padding-bottom: 40px; }

/* ---------- 卡片 ---------- */
.card {
  position: relative; border-radius: 20px; padding: 16px;
  background: linear-gradient(165deg, var(--card-a), var(--card-b));
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -30px #000, inset 0 1px 0 rgba(255, 255, 255, .05);
  overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(120% 80% at 0% 0%, rgba(56, 189, 248, .07), transparent 60%);
}
.card > * { position: relative; }
.card-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-hd h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: .3px; }
.card-hd span { font-size: 11px; color: var(--dim); }
.muted { color: var(--faint) !important; }

/* ---------- 首页 ---------- */
.hero { display: flex; flex-direction: column; align-items: center; padding: 14px 16px 16px; }
.ring-wrap { position: relative; width: 198px; height: 198px; margin: 2px auto 6px; }
.ring { width: 100%; height: 100%; transform: rotate(0deg); }
.ring-bg { fill: none; stroke: rgba(96, 165, 250, .12); stroke-width: 11; }
.ring-fg { fill: none; stroke-width: 11; stroke-linecap: round; filter: drop-shadow(0 0 7px rgba(56, 189, 248, .55)); transition: stroke-dashoffset 1s cubic-bezier(.22, .8, .26, 1); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.ring-label { font-size: 10.5px; letter-spacing: 2px; color: var(--dim); }
.ring-value {
  font-size: 44px; font-weight: 650; line-height: 1.05; letter-spacing: -1.5px;
  background: linear-gradient(180deg, #fff, #7dd3fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ring-unit { font-size: 10.5px; color: var(--faint); font-family: var(--mono); }

.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-top: 8px; }
.hero-stats > div { display: flex; flex-direction: column; align-items: center; gap: 1px; border-right: 1px solid var(--line); }
.hero-stats > div:last-child { border-right: 0; }
.hero-stats b { font-size: 19px; font-weight: 600; }
.hero-stats b.over { color: var(--amber); }
.hero-stats span { font-size: 10.5px; color: var(--dim); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 13px 4px 11px; border-radius: 16px; color: var(--txt);
  border: 1px solid var(--line); background: rgba(12, 26, 48, .7);
  transition: transform .15s, background .15s;
}
.action:active { transform: scale(.97); }
.action .ico { width: 23px; height: 23px; margin-bottom: 5px; }
.action span { font-size: 13px; font-weight: 600; letter-spacing: .2px; }
.action em { font-style: normal; font-size: 9px; color: var(--dim); letter-spacing: .2px; }
.action.cam { border-color: rgba(56, 189, 248, .3); background: linear-gradient(160deg, rgba(56, 189, 248, .18), rgba(8, 20, 40, .7)); }
.action.cam .ico { color: #7dd3fc; }
.action.voice { border-color: rgba(52, 211, 153, .3); background: linear-gradient(160deg, rgba(52, 211, 153, .15), rgba(8, 20, 40, .7)); }
.action.voice .ico { color: #6ee7b7; }
.action.manual { border-color: rgba(167, 139, 250, .3); background: linear-gradient(160deg, rgba(167, 139, 250, .15), rgba(8, 20, 40, .7)); }
.action.manual .ico { color: #c4b5fd; }
.action.move { border-color: rgba(251, 191, 36, .3); background: linear-gradient(160deg, rgba(251, 191, 36, .15), rgba(8, 20, 40, .7)); }
.action.move .ico { color: #fcd34d; }

/* ---------- 宏量 ---------- */
.macros { display: flex; flex-direction: column; gap: 10px; }
.macro-row { display: flex; flex-direction: column; gap: 5px; }
.mr-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--dim); }
.mr-head span { display: flex; align-items: center; gap: 6px; color: #c7d9ef; }
.mr-head i { width: 7px; height: 7px; border-radius: 2px; }
.mr-head em { font-style: normal; font-size: 11px; color: var(--dim); }
.mr-track { height: 5px; border-radius: 4px; background: rgba(56, 120, 220, .14); overflow: hidden; }
.mr-track i { display: block; height: 100%; border-radius: 4px; transition: width .6s; }
.fib-row { margin-top: 10px; font-size: 11px; color: var(--dim); }
.fib-row b { color: #cfe4ff; font-weight: 500; }

.water-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--dim); }
.water-row:first-of-type { margin-top: 12px; }
.water-row .ico { width: 15px; height: 15px; color: #7dd3fc; }
.water-row b { margin-left: auto; font-size: 13px; color: #bae6fd; font-weight: 500; }
.water-row > em { font-style: normal; font-size: 10.5px; color: var(--faint); margin-left: -4px; }
.weight-inp {
  margin-left: auto; width: 78px; height: 34px; text-align: center;
  border-radius: 9px; background: rgba(4, 12, 24, .9); border: 1px solid var(--line-2);
  color: var(--txt); font-size: 16px; -webkit-appearance: none; appearance: none;
}
.weight-inp::-webkit-outer-spin-button, .weight-inp::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mini-btn { height: 28px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(56, 189, 248, .1); color: #7dd3fc; font-size: 11px; }

/* ---------- 计划 vs 实际 ---------- */
.mini-cmp { display: flex; flex-direction: column; gap: 13px; }
.mc-row { display: flex; flex-direction: column; gap: 6px; }
.mc-top { display: flex; justify-content: space-between; align-items: baseline; }
.mc-top span { font-size: 11.5px; color: var(--dim); }
.mc-top em { font-style: normal; font-size: 12px; color: #dbeafe; }
.mc-top em i { font-style: normal; font-size: 10px; color: var(--faint); }
.mc-top em.good { color: #6ee7b7; }
.mc-top em.bad { color: #fda4af; }
.mc-top em.low { color: #93c5fd; }
.mc-track { position: relative; height: 6px; border-radius: 4px; background: rgba(56, 120, 220, .14); }
.mc-track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #1d4ed8, #38bdf8); box-shadow: 0 0 8px rgba(56, 189, 248, .45); }
.mc-track b { position: absolute; top: -4px; width: 2px; height: 14px; border-radius: 2px; background: var(--amber); box-shadow: 0 0 6px rgba(251, 191, 36, .7); }

/* ---------- 时间线 ---------- */
.meal-group { padding-top: 10px; border-top: 1px dashed var(--line); margin-top: 10px; }
.meal-group:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.mg-hd { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #c7d9ef; margin-bottom: 5px; }
.mg-hd .dot { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.mg-hd b { font-weight: 500; }
.mg-hd em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--faint); }
.mg-add { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(56, 189, 248, .08); color: #7dd3fc; margin-left: 6px; }
.mg-add .ico { width: 13px; height: 13px; }
.food-row { display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 14px; font-size: 13.5px; color: #d7e6fa; }
.fr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.food-row em { font-style: normal; font-size: 10.5px; color: var(--faint); }
.food-row b { width: 44px; text-align: right; font-size: 12.5px; font-weight: 500; color: #eaf4ff; }
.fr-del { width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: transparent; color: #3f5674; }
.fr-del .ico { width: 12px; height: 12px; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb { padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(4, 12, 24, .8); aspect-ratio: 1; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0 10px; color: var(--faint); font-size: 12.5px; text-align: center; }
.empty .ico { width: 26px; height: 26px; color: #3b5372; }
.empty p { margin: 0; line-height: 1.7; }
.empty.small { padding: 14px 0; }

/* ---------- 趋势 ---------- */
.weight-big { display: flex; align-items: baseline; gap: 4px; margin-bottom: 2px; }
.weight-big b { font-size: 40px; font-weight: 650; letter-spacing: -1.5px; }
.weight-big span { font-size: 12px; color: var(--dim); }
.weight-big em { margin-left: auto; font-style: normal; font-size: 12px; color: #6ee7b7; }
.ranges { display: flex; gap: 3px; padding: 2px; border-radius: 9px; background: rgba(4, 12, 24, .7); border: 1px solid var(--line); }
.range { border: 0; background: transparent; color: var(--faint); font-size: 10.5px; padding: 3px 7px; border-radius: 7px; }
.range.on { background: rgba(56, 189, 248, .16); color: #a5e3ff; }
.chart-wrap { position: relative; width: 100%; margin-top: 6px; }
.chart-wrap canvas { width: 100%; display: block; }
.chart-tip {
  position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0; transition: opacity .12s;
  padding: 6px 8px; border-radius: 8px; font-size: 10px; color: #dbeafe; line-height: 1.6;
  background: rgba(6, 16, 32, .96); border: 1px solid rgba(96, 165, 250, .3);
  box-shadow: 0 10px 24px -12px #000; z-index: 5; white-space: nowrap;
}
.chart-tip b { display: block; font-size: 9.5px; color: #7dd3fc; margin-bottom: 1px; font-weight: 500; }
.tip-row { display: flex; align-items: center; gap: 4px; }
.tip-row i { width: 6px; height: 6px; border-radius: 2px; }
.legend { display: flex; gap: 14px; margin-top: 6px; font-size: 10px; color: var(--faint); }
.legend span { display: flex; align-items: center; gap: 5px; }
.ln { width: 14px; height: 0; border-top: 2px solid #38bdf8; }
.ln.dash { border-top-style: dashed; border-color: #60a5fa; opacity: .8; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stat-grid > div { background: rgba(7, 16, 31, .92); padding: 11px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-grid b { font-size: 18px; font-weight: 600; }
.stat-grid span { font-size: 10px; color: var(--dim); }
.note { margin: 12px 0 0; font-size: 11.5px; line-height: 1.75; color: var(--dim); }

/* ---------- 我的 ---------- */
.goal-card .goal-big { display: flex; align-items: baseline; gap: 6px; }
.goal-big b { font-size: 34px; font-weight: 650; letter-spacing: -1px; }
.goal-big span { font-size: 12px; color: var(--dim); }
.goal-bar { height: 6px; border-radius: 4px; background: rgba(56, 120, 220, .15); margin: 10px 0 6px; overflow: hidden; }
.goal-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2563eb, #22d3ee); box-shadow: 0 0 10px rgba(56, 189, 248, .6); }
.goal-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); }
.goal-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.goal-nums > div { display: flex; flex-direction: column; gap: 1px; }
.goal-nums span { font-size: 10px; color: var(--dim); }
.goal-nums b { font-size: 16px; font-weight: 600; }
.link { background: none; border: 0; color: var(--cyan); font-size: 12px; padding: 0; }

.list-card { border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(165deg, var(--card-a), var(--card-b)); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 14px 16px; background: transparent; border: 0; border-bottom: 1px solid rgba(96, 165, 250, .07); color: var(--txt); font-size: 14px; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.list-row .ico { color: #7dd3fc; width: 18px; height: 18px; }
.list-row .ai-ico { color: #c4b5fd; }
.list-row span { flex: 1; }
.list-row em { font-style: normal; font-size: 10.5px; color: var(--faint); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .chev { width: 14px; height: 14px; color: #3b5372; }
.list-row.danger, .list-row.danger .ico { color: #fda4af; }
.foot-note { text-align: center; font-size: 10px; color: #3b5372; line-height: 1.8; margin: 4px 0 8px; }

/* ---------- 底部 Tab ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 4px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(4, 10, 22, .92), rgba(4, 10, 22, .99) 45%);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(96, 165, 250, .1);
}
.tab {
  flex: 1; height: 52px; border: 0; border-radius: 14px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #5b7295; font-size: 10.5px;
}
.tab .ico { width: 21px; height: 21px; }
.tab.on { color: #7dd3fc; background: rgba(56, 189, 248, .1); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  font-size: 15px; font-weight: 550; color: var(--txt);
  transition: transform .12s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .4; }
.btn-primary { background: linear-gradient(135deg, #2563eb, #0ea5e9); color: #fff; box-shadow: 0 10px 24px -14px rgba(14, 165, 233, .95), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-ghost { background: rgba(56, 120, 220, .1); border-color: var(--line-2); color: #c3dbf7; }
.btn-ai { background: linear-gradient(135deg, #6d28d9, #2563eb); color: #fff; box-shadow: 0 10px 24px -14px rgba(124, 58, 237, .9); }
.btn-block { width: 100%; }
.btn-lg { height: 54px; font-size: 16px; border-radius: 16px; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }

.search { position: relative; margin-bottom: 8px; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #4f6787; }
.search input {
  width: 100%; height: 46px; padding: 0 14px 0 36px; border-radius: 13px;
  background: rgba(4, 12, 24, .85); border: 1px solid var(--line-2);
  color: var(--txt); font-size: 16px; outline: none;
}
.search input::placeholder { color: #46618a; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { position: relative; display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11px; color: var(--dim); }
.field.full { margin: 10px 0; }
.field > em { position: absolute; right: 12px; bottom: 15px; font-style: normal; font-size: 11px; color: var(--faint); pointer-events: none; }
.inp {
  width: 100%; height: 48px; padding: 0 34px 0 12px; border-radius: 13px;
  background: rgba(4, 12, 24, .8); border: 1px solid rgba(96, 165, 250, .2);
  color: var(--txt); font-size: 16px; outline: none; -webkit-appearance: none; appearance: none;
}
.inp:focus { border-color: rgba(56, 189, 248, .6); box-shadow: 0 0 0 3px rgba(56, 189, 248, .1); }
select.inp { background-image: linear-gradient(45deg, transparent 50%, #6d86a9 50%), linear-gradient(135deg, #6d86a9 50%, transparent 50%); background-position: calc(100% - 16px) 21px, calc(100% - 11px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.seg2 { display: flex; height: 48px; padding: 3px; gap: 3px; border-radius: 13px; background: rgba(4, 12, 24, .8); border: 1px solid rgba(96, 165, 250, .2); }
.seg2 button { flex: 1; border: 0; border-radius: 10px; background: transparent; color: var(--dim); font-size: 14px; }
.seg2 button.on { background: linear-gradient(135deg, rgba(37, 99, 235, .6), rgba(14, 165, 233, .4)); color: #fff; }

.goal-preview { margin-top: 4px; padding: 12px; border-radius: 13px; background: rgba(56, 189, 248, .05); border: 1px solid var(--line); }
.gp-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--dim); padding: 3px 0; }
.gp-row b { color: #dbeafe; font-weight: 500; }
.gp-warn { margin: 8px 0 0; font-size: 10.5px; color: #fcd34d; line-height: 1.6; }
.gp-ok { margin: 8px 0 0; font-size: 10.5px; color: #6ee7b7; }

/* ---------- 浮层 ---------- */
.mask { position: fixed; inset: 0; z-index: 40; background: rgba(2, 6, 14, .66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: 92vh; height: 92dvh;
  display: flex; flex-direction: column;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #0a1830, #050c18 70%);
  border-top: 1px solid rgba(96, 165, 250, .25);
  box-shadow: 0 -30px 60px -30px #000;
  transform: translateY(101%);
  transition: transform .34s cubic-bezier(.2, .8, .25, 1);
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--kb, 0px));
}
.sheet.show { transform: translateY(0); }
.sheet-hd { position: relative; padding: 10px 18px 4px; }
.grab { width: 38px; height: 4px; border-radius: 2px; background: rgba(150, 180, 220, .3); margin: 0 auto 12px; }
.sheet-title { font-size: 17px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.sheet-title span { font-size: 11px; color: var(--faint); font-weight: 400; }
.sheet-x { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--dim); display: grid; place-items: center; }
.sheet-x .ico { width: 15px; height: 15px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 12px 18px 20px; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-top: 1px solid var(--line);
  background: rgba(5, 12, 24, .92);
}
.foot-sum { flex: 1; display: flex; align-items: baseline; gap: 2px; }
.foot-sum b { font-size: 24px; font-weight: 650; letter-spacing: -.8px; }
.foot-sum span { font-size: 11px; color: var(--dim); }
.foot-sum em { font-style: normal; font-size: 10.5px; color: var(--faint); margin-left: 8px; }
.sheet-foot .btn { min-width: 120px; }

.seg { display: flex; margin: 6px 18px 0; padding: 3px; gap: 3px; border-radius: 13px; background: rgba(4, 12, 24, .8); border: 1px solid var(--line); }
.seg-btn { flex: 1; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--dim); font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.seg-btn .ico { width: 16px; height: 16px; }
.seg-btn.on { background: linear-gradient(135deg, rgba(37, 99, 235, .62), rgba(14, 165, 233, .42)); color: #fff; }

/* 语音 */
.voice-pane { text-align: center; }
.mic {
  width: 108px; height: 108px; border-radius: 50%; margin: 10px auto 8px;
  display: grid; place-items: center;
  border: 1px solid rgba(56, 189, 248, .45);
  background: radial-gradient(circle at 50% 35%, rgba(56, 189, 248, .3), rgba(8, 20, 40, .92));
  color: #7dd3fc; box-shadow: 0 0 42px -12px rgba(56, 189, 248, .75);
}
.mic .ico { width: 40px; height: 40px; }
.mic.listening { color: #fff; animation: pulse 1.3s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, .5), 0 0 42px -12px rgba(56, 189, 248, .75); }
  100% { box-shadow: 0 0 0 22px rgba(56, 189, 248, 0), 0 0 42px -12px rgba(56, 189, 248, .75); }
}
.mic-tip { font-size: 12px; color: var(--dim); margin: 0 0 12px; }
.voice-text {
  width: 100%; min-height: 84px; padding: 12px; border-radius: 14px;
  background: rgba(4, 12, 24, .85); border: 1px solid var(--line-2); color: var(--txt);
  font-size: 16px; line-height: 1.6; resize: none; outline: none;
}
.voice-text:focus { border-color: rgba(56, 189, 248, .55); }
.voice-actions { display: flex; gap: 8px; margin-top: 10px; }
.voice-actions .btn { flex: 1; }
.tiny { font-size: 10.5px; color: var(--faint); line-height: 1.7; margin: 10px 0 0; }
.note { font-size: 11.5px; color: var(--dim); line-height: 1.8; margin: 0 0 12px; }
.note b { color: #cfe4ff; font-weight: 500; }

/* 照片 */
.photo-pane { display: flex; flex-direction: column; gap: 10px; }
.photo-drop {
  height: 148px; border-radius: 16px; border: 1px dashed rgba(96, 165, 250, .35);
  background: rgba(56, 189, 248, .05); color: #7dd3fc;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.photo-drop .ico { width: 34px; height: 34px; margin-bottom: 4px; }
.photo-drop b { font-size: 14px; font-weight: 600; }
.photo-drop span { font-size: 10.5px; color: var(--dim); }
.photo-preview { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.photo-preview img { width: 100%; max-height: 230px; object-fit: cover; display: block; }
.retake { position: absolute; right: 8px; bottom: 8px; height: 30px; padding: 0 12px; border-radius: 9px; background: rgba(4, 10, 22, .8); border: 1px solid var(--line-2); color: #cfe4ff; font-size: 11px; }
.photo-actions { display: flex; gap: 8px; }
.photo-actions .btn { flex: 1; }

/* 手动 */
.food-list { max-height: 260px; overflow-y: auto; margin-top: 4px; }
.pick-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 10px; border: 0; border-bottom: 1px solid rgba(96, 165, 250, .07); background: transparent; color: var(--txt); font-size: 14px; text-align: left; }
.pick-row:active { background: rgba(56, 120, 220, .12); }
.pick-row em { font-style: normal; font-size: 10.5px; color: var(--faint); }

/* 草稿 */
.draft { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 6px; }
.empty-draft { font-size: 11.5px; color: var(--faint); text-align: center; padding: 14px 0; }
.draft-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(96, 165, 250, .06); }
.di-name { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.di-grams { width: 62px; height: 34px; text-align: center; border-radius: 9px; background: rgba(4, 12, 24, .9); border: 1px solid var(--line-2); color: var(--txt); font-size: 16px; -webkit-appearance: none; appearance: none; }
.di-grams::-webkit-outer-spin-button, .di-grams::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.draft-item > em { font-style: normal; font-size: 10.5px; color: var(--faint); }
.draft-item > b { width: 44px; text-align: right; font-size: 13px; color: #dbeafe; }
.di-min { font-size: 11px; color: var(--dim); font-style: normal; }
.di-del { width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: transparent; color: #3f5674; }
.di-del .ico { width: 12px; height: 12px; }
.draft-item.extra { border-bottom-style: dashed; }

.meal-pick { display: flex; align-items: center; gap: 5px; margin-top: 14px; }
.meal-pick > span { font-size: 11px; color: var(--faint); margin-right: 2px; }
.meal-btn { flex: 1; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: rgba(4, 12, 24, .6); color: var(--dim); font-size: 12px; }
.meal-btn.on { background: rgba(56, 189, 248, .16); border-color: rgba(56, 189, 248, .4); color: #a5e3ff; }

.preset { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 14px; font-size: 11px; color: var(--faint); }
.preset button { height: 28px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: rgba(56, 120, 220, .08); color: #9ecdf2; font-size: 11px; }
.ai-actions { display: flex; gap: 8px; }
.ai-actions .btn { flex: 1; }

/* 新手引导 */
.onboard { padding: 6px 2px 20px; }
.ob-kicker { font-size: 9.5px; letter-spacing: 3px; color: #3f618f; }
.onboard h1 { font-size: 27px; line-height: 1.35; margin: 10px 0 6px; font-weight: 650; letter-spacing: -.4px; background: linear-gradient(90deg, #fff, #9ad9ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ob-sub { font-size: 12.5px; color: var(--dim); margin: 0 0 18px; line-height: 1.7; }
.onboard .btn-block { margin-top: 14px; }
.ob-foot { text-align: center; font-size: 10px; color: #3b5372; margin-top: 12px; }

/* 查看照片 */
.viewer { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; background: rgba(0, 0, 0, .94); }
.viewer.show { display: grid; }
.viewer img { max-width: 100%; max-height: 88dvh; border-radius: 8px; }
.viewer-x { position: absolute; top: calc(env(safe-area-inset-top) + 16px); right: 16px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .1); border: 0; color: #fff; display: grid; place-items: center; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 120;
  transform: translate(-50%, 14px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; max-width: 80vw;
  background: rgba(8, 20, 40, .97); border: 1px solid rgba(96, 165, 250, .3);
  color: #dbeafe; font-size: 12.5px; text-align: center;
  box-shadow: 0 18px 40px -18px #000;
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: rgba(52, 211, 153, .45); }
.toast.bad { border-color: rgba(251, 113, 133, .5); color: #fecdd3; }

/* 文件选择：用透明定位代替 display:none，Safari 上 programmatic click 更稳 */
.file-input { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.sheet-body { overscroll-behavior: contain; }

/* 选中项卡片（食物/运动共用） */
.picked { margin-top: 10px; padding: 12px; border-radius: 14px; border: 1px solid rgba(56, 189, 248, .25); background: rgba(10, 26, 50, .62); }
.picked-head { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.picked-head b { font-size: 13.5px; color: #eaf4ff; }
.picked-head span { font-size: 10px; color: var(--faint); }
.grams { display: flex; align-items: center; gap: 8px; }
.grams .input, .grams .inp { height: 40px; flex: 1; min-width: 0; padding: 0 12px; }
.grams > span { font-size: 11px; color: var(--dim); flex: none; }
.grams .num { width: 92px; flex: none; text-align: center; font-size: 18px; padding: 0 8px; -webkit-appearance: none; appearance: none; }
.grams .num::-webkit-outer-spin-button, .grams .num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.quick { display: flex; gap: 6px; margin: 9px 0; }
.quick button { flex: 1; padding: 8px 0; font-size: 11px; border-radius: 8px; border: 1px solid var(--line); background: rgba(56, 120, 220, .08); color: var(--dim); }
.quick button:active { background: rgba(56, 189, 248, .16); }
.pick-preview { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 10px; padding: 8px 10px; border-radius: 9px; background: rgba(4, 12, 24, .7); }
.pick-preview span { font-size: 14px; color: #7dd3fc; }
.pick-preview em { font-style: normal; font-size: 9.5px; color: var(--faint); }

/* 运动记录 */
.ex-sum { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(56, 189, 248, .06); border: 1px solid var(--line); font-size: 12px; color: var(--dim); margin-bottom: 12px; }
.ex-sum .ico { width: 15px; height: 15px; color: #7dd3fc; }
.ex-sum b { margin-left: auto; color: #dbeafe; font-weight: 500; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 10px; }
.chip { padding: 5px 11px; border-radius: 20px; font-size: 11px; border: 1px solid var(--line); background: rgba(56, 120, 220, .08); color: var(--dim); }
.chip.on { background: rgba(56, 189, 248, .16); border-color: rgba(56, 189, 248, .4); color: #a5e3ff; }
.ex-list2 { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.ex-item { display: flex; align-items: center; gap: 8px; padding: 10px 8px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--txt); text-align: left; width: 100%; }
.ex-item.on { background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .3); }
.ex-n { flex: 1; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-item em { font-style: normal; font-size: 9.5px; color: var(--faint); flex: none; }
.ex-item b { font-size: 12.5px; color: #7dd3fc; font-weight: 500; flex: none; }
.ex-item b i { font-style: normal; font-size: 8.5px; color: var(--faint); margin-left: 2px; }
.ex-today { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.ex-today-hd { font-size: 10.5px; color: var(--faint); margin-bottom: 2px; }
.ex-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12.5px; color: #d7e6fa; }
.ex-row > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-row em { font-style: normal; font-size: 10.5px; color: var(--faint); }
.ex-row b { width: 46px; text-align: right; color: #6ee7b7; font-size: 12px; }
.ex-row button { width: 22px; height: 22px; border: 0; background: transparent; color: #3f5674; display: grid; place-items: center; }
.ex-row button .ico { width: 11px; height: 11px; }

/* 健康同步 */
.health-steps { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.hs { display: flex; gap: 10px; font-size: 12px; color: var(--dim); line-height: 1.7; }
.hs b { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #7dd3fc; background: rgba(56, 189, 248, .12); border: 1px solid rgba(56, 189, 248, .3); }
.copy-box { padding: 10px 12px; border-radius: 10px; background: rgba(4, 12, 24, .9); border: 1px solid var(--line-2); font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; color: #a5e3ff; word-break: break-all; line-height: 1.6; margin-bottom: 10px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; color: #a5e3ff; }

/* 小屏适配 */
@media (max-width: 360px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .ring-wrap { width: 174px; height: 174px; }
  .ring-value { font-size: 38px; }
  .action span { font-size: 13px; }
  .mc-row em { min-width: 64px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
