/* ═══════════════════════════════════════════════════════════════
   身体日报 · Design Token（方向 A · Editorial Personal OS）
   纸张白 + 墨色 + 朱红。hairline 代替卡片，阅读感代替看板感。
   ═══════════════════════════════════════════════════════════════ */
:root {
  --paper: #FAF7F1;
  --ink: #1B1A17;
  --ink-2: #57534A;
  --ink-3: #8A8478;
  --ink-4: #B0A996;
  --hairline: #DDD5C7;
  --hairline-soft: #EDE7DA;
  --accent: #C8441C;
  --accent-soft: rgba(200, 68, 28, 0.07);
  /* 状态色：只承载状态，不做装饰 */
  --ok: #3E7C59;
  --warn: #A8721F;
  --danger: #B23A2E;
  --mono: ui-monospace, "SF Mono", "Courier New", monospace;
  --sans: "Helvetica Neue", -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1A1917;
    --ink: #E9E4D8;
    --ink-2: #A8A294;
    --ink-3: #6E6A5E;
    --ink-4: #4E4B44;
    --hairline: #36342F;
    --hairline-soft: #292724;
    --accent: #E0693B;
    --accent-soft: rgba(224, 105, 59, 0.1);
    --ok: #5F9C77;
    --warn: #C99A45;
    --danger: #D06A5B;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

#app { max-width: 560px; margin: 0 auto; }
.view { padding: 0 24px calc(96px + env(safe-area-inset-bottom)); min-height: 100dvh; }

/* ── 报头 ── */
.date-line {
  padding-top: 28px;
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono);
  font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em;
}

.masthead {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--ink);
}
.masthead .kicker { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }
.hero-num {
  font-size: 104px; font-weight: 200; letter-spacing: -0.04em; line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.hero-num small { font-size: 20px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); margin-left: 8px; }
.hero-delta { margin-top: 16px; font-size: 15px; color: var(--accent); }
.hero-delta b { font-weight: 600; }
.hero-empty { font-size: 15px; color: var(--ink-3); margin-top: 16px; }

/* ── 版面分区：hairline，不是卡片 ── */
section.col {
  padding: 28px 0;
  border-bottom: 1px solid var(--hairline);
}
section.col:last-child { border-bottom: none; }
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px;
}
.sec-name { font-size: 17px; font-weight: 600; }
.sec-no { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }
.note { font-size: 13px; color: var(--ink-3); margin-top: 10px; line-height: 1.7; }
.note b { color: var(--ink-2); font-weight: 600; }

/* ── 趋势图：页面的结构，不是容器里的组件 ── */
.chart-wrap { position: relative; margin: 4px -24px 0; padding: 0 24px; }
.chart-wrap svg { display: block; width: 100%; touch-action: pan-y; }
.chart-tip {
  position: absolute; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em;
  padding: 5px 8px; white-space: nowrap;
  opacity: 0; transition: opacity 150ms ease-out;
}
.chart-tip.show { opacity: 1; }

/* ── 今日 check-in：清单，不是按钮墙 ── */
.checkline {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 14px 0;
  min-height: 48px;
  font-size: 16px; color: var(--ink);
  background: none; border: none;
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer; text-align: left;
  transition: color 150ms ease-out;
  font-family: var(--sans);
}
.checkline:last-child { border-bottom: none; }
.checkline:active { transform: scale(0.99); }
.circ {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--ink-4); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--paper);
  transition: background 150ms ease-out, border-color 150ms ease-out;
}
.checkline.done { color: var(--ink-3); }
.checkline.done .circ { background: var(--ink); border-color: var(--ink); }
.checkline .dose { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-4); }

/* 本周点阵：一行小圆点，不带任何框 */
.weekdots { margin-top: 20px; }
.weekdots .wd-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 13px; color: var(--ink-3);
}
.wd-row .wd-name { width: 76px; flex-shrink: 0; }
.wd-row .wd-days { display: flex; gap: 8px; flex: 1; }
.wd-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--hairline);
}
.wd-dot.on { background: var(--ink); }
.wd-head { font-family: var(--mono); font-size: 10px; color: var(--ink-4); }

/* ── 接下来 ── */
.next-line { font-size: 15px; line-height: 2; color: var(--ink-2); }
.next-line b { color: var(--ink); font-weight: 600; }
.next-line .accent { color: var(--accent); font-weight: 600; }

/* ── 趋势页 ── */
.seg {
  display: flex; gap: 20px;
  padding: 4px 0 20px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 8px;
}
.seg button {
  background: none; border: none; cursor: pointer;
  font-family: var(--sans);
  font-size: 15px; color: var(--ink-3);
  padding: 10px 0; min-height: 44px;
  position: relative;
  transition: color 150ms ease-out;
}
.seg button.active { color: var(--ink); font-weight: 600; }
.seg button.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -21px;
  height: 2px; background: var(--accent);
}
.trend-hero { padding: 32px 0 8px; }
.trend-hero .t-num {
  font-size: 64px; font-weight: 200; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.trend-hero .t-num small { font-size: 16px; font-weight: 400; color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
.trend-hero .t-sub { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.fixed-note {
  font-size: 13px; color: var(--ink-3);
  text-align: center; padding: 24px 0 8px; line-height: 1.7;
}

/* ── 训练页：内容即判断，不用徽章 ── */
.ex-block { padding: 26px 0; border-bottom: 1px solid var(--hairline); }
.ex-block:last-child { border-bottom: none; }
.ex-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ex-name { font-size: 17px; font-weight: 600; }
.ex-last { font-family: var(--mono); font-size: 11px; color: var(--ink-4); letter-spacing: 0.04em; }
.ex-weight { font-size: 44px; font-weight: 300; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ex-weight small { font-size: 14px; color: var(--ink-3); margin-left: 6px; font-weight: 400; }
.ex-detail { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.ex-verdict { margin-top: 10px; font-size: 15px; }
.ex-verdict.up { color: var(--accent); font-weight: 600; }
.ex-verdict.flat { color: var(--ink-3); }
.ex-spark { margin-top: 12px; height: 32px; }
.ex-spark svg { display: block; width: 100%; height: 32px; }
.ex-empty { font-size: 14px; color: var(--ink-3); padding: 8px 0 4px; }

/* ── 记录页：下划线输入，不像表单系统 ── */
.log-section { padding: 28px 0; border-bottom: 1px solid var(--hairline); }
.log-section:last-child { border-bottom: none; }
.field-row { display: flex; gap: 20px; align-items: flex-end; margin: 18px 0; }
.field { flex: 1; }
.field label { display: block; font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.field input, .field select {
  width: 100%;
  background: none; border: none;
  border-bottom: 1px solid var(--ink-4);
  border-radius: 0;
  padding: 8px 0;
  font-family: var(--sans);
  font-size: 28px; font-weight: 300; color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-height: 48px;
}
.field input:focus, .field select:focus { outline: none; border-bottom-color: var(--accent); }
.field input::placeholder { color: var(--ink-4); }
.field select { font-size: 20px; }
.confirm {
  display: block; width: 100%;
  min-height: 52px;
  background: var(--ink); color: var(--paper);
  border: none; cursor: pointer;
  font-family: var(--sans); font-size: 16px; font-weight: 600;
  margin-top: 8px;
  transition: transform 120ms ease-out, opacity 150ms ease-out;
}
.confirm:active { transform: scale(0.98); }
details.more { margin-top: 18px; }
details.more summary {
  min-height: 44px; display: flex; align-items: center;
  font-size: 14px; color: var(--ink-3); cursor: pointer; list-style: none;
}
details.more summary::before { content: "+"; margin-right: 8px; font-family: var(--mono); }
details.more[open] summary::before { content: "–"; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 4px; }
.more-grid .field input { font-size: 20px; }

/* ── 华为健康：安静的一行 ── */
.huawei { padding: 24px 0; }
.huawei summary {
  display: flex; align-items: baseline; gap: 10px;
  min-height: 44px; cursor: pointer; list-style: none;
  font-size: 14px; color: var(--ink-3);
}
.huawei summary::-webkit-details-marker { display: none; }
.huawei .h-name { color: var(--ink-2); font-weight: 600; }
.huawei .h-state { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-4); margin-left: auto; }
.huawei ol { padding: 8px 0 4px 20px; font-size: 13px; color: var(--ink-3); line-height: 2; }

/* ── 空态 / 错误态 ── */
.empty { padding: 20px 0; font-size: 14px; color: var(--ink-3); line-height: 1.8; }
.empty .empty-big {
  display: block; font-size: 32px; font-weight: 200; color: var(--ink-4);
  font-variant-numeric: tabular-nums; margin-bottom: 4px;
}
.error-box { padding: 48px 0; text-align: center; }
.error-box p { color: var(--danger); font-size: 14px; margin-bottom: 16px; }
.retry {
  background: none; border: 1px solid var(--hairline); color: var(--ink-2);
  padding: 12px 28px; min-height: 44px; cursor: pointer;
  font-family: var(--sans); font-size: 14px;
}

/* ── 底部导航：四个词 ── */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(560px, 100%);
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.tab {
  flex: 1; min-height: 58px;
  background: none; border: none; cursor: pointer;
  font-family: var(--sans);
  font-size: 14px; color: var(--ink-3);
  transition: color 150ms ease-out;
}
.tab.active { color: var(--ink); font-weight: 600; }

/* ── 即时反馈 ── */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  font-size: 13px; padding: 10px 18px;
  opacity: 0; transition: opacity 200ms ease-out;
  pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }

/* ── 桌面端：同一产品自然扩展，不做 Dashboard ── */
@media (min-width: 720px) {
  .view { padding-left: 32px; padding-right: 32px; }
  .hero-num { font-size: 128px; }
}

/* ── 动效退化 ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
