/* 训练手册
   版式：单列（最宽 640px），顶部细栏 + 底部固定标签栏；只有"当前动作"和"今天的计划"用卡片强调。
   视觉线索取自器械本身：配重片的叠片、橙色插销、机架的钢灰。 */
:root {
  --bg: #F1F4F3;
  --surface: #FFFFFF;
  --surface-2: #E6EBE9;
  --ink: #16201D;
  --ink-2: #4F5C58;
  --ink-3: #7A8783;
  --line: #D3DBD8;
  --accent: #E25E14;        /* 配重插销橙 */
  --accent-ink: #FFFFFF;
  --accent-soft: #FCE6D8;
  --steel: #2D5A7B;         /* 机架钢蓝 */
  --steel-soft: #DDE8F0;
  --good: #1F7F55;
  --good-soft: #DCF0E6;
  --warn: #A86A12;
  --warn-soft: #FBEFD9;
  --bad: #BF3434;
  --bad-soft: #F9E0E0;
  --fig: #16201D;
  --fig-far: #A3AEAA;
  --mach: #8A9692;
  --mach-fill: #DFE5E3;
  --pad: #C3CDC9;
  --chart: #2D5A7B;

  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "DIN Alternate", "DIN Condensed", "Bahnschrift", "Roboto Condensed", -apple-system, system-ui, sans-serif;
  --r: 14px;
  --tabbar-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1211; --surface: #161C1A; --surface-2: #1E2624; --ink: #E5EBE8; --ink-2: #A3AFAB; --ink-3: #74817D;
    --line: #29332F; --accent: #FF7A2F; --accent-ink: #1B0D04; --accent-soft: #3A2316; --steel: #82B2D6; --steel-soft: #1B2A35;
    --good: #4CC28B; --good-soft: #17301F; --warn: #E3A64A; --warn-soft: #33270F; --bad: #F06A6A; --bad-soft: #3A1B1B;
    --fig: #E5EBE8; --fig-far: #5B6864; --mach: #7F8C88; --mach-fill: #222B28; --pad: #3A4541; --chart: #82B2D6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1211; --surface: #161C1A; --surface-2: #1E2624; --ink: #E5EBE8; --ink-2: #A3AFAB; --ink-3: #74817D;
  --line: #29332F; --accent: #FF7A2F; --accent-ink: #1B0D04; --accent-soft: #3A2316; --steel: #82B2D6; --steel-soft: #1B2A35;
  --good: #4CC28B; --good-soft: #17301F; --warn: #E3A64A; --warn-soft: #33270F; --bad: #F06A6A; --bad-soft: #3A1B1B;
  --fig: #E5EBE8; --fig-far: #5B6864; --mach: #7F8C88; --mach-fill: #222B28; --pad: #3A4541; --chart: #82B2D6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-ui);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0; }
a { color: var(--steel); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---------- 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.topbar-in { width: 100%; max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .02em; }
.brand-mark { width: 22px; height: 22px; }
.sync {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 3px 10px 3px 8px; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
}
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.sync.ok::before { background: var(--good); }
.sync.busy::before { background: var(--steel); }
.sync.warn::before { background: var(--warn); }

/* ---------- 主体 */
.view { max-width: 640px; margin: 0 auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 18px; outline: none; }
.view > * { min-width: 0; }
.boot { color: var(--ink-3); text-align: center; padding: 40px 0; }
.eyebrow { font-size: 13px; color: var(--ink-2); letter-spacing: .04em; }
.muted { color: var(--ink-2); font-size: 14px; }
.small { font-size: 13px; }
.sec-title { font-size: 15px; font-weight: 700; color: var(--ink-2); letter-spacing: .04em; margin-bottom: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h3 { font-size: 17px; }

.banner { border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.banner.go { background: var(--good-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); }
.banner.info { background: var(--steel-soft); border: 1px solid color-mix(in srgb, var(--steel) 30%, transparent); }
.banner.warn { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.banner .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 按钮 */
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; min-height: 44px; padding: 0 16px;
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-steel { background: var(--steel); border-color: var(--steel); color: var(--surface); }
.btn-block { width: 100%; min-height: 52px; font-size: 17px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--steel); font-weight: 600; font-size: 14px; }

/* ---------- 今天 */
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero h2 { font-size: 30px; display: flex; align-items: center; gap: 12px; }
.hero .sub { color: var(--ink-2); font-size: 15px; }
.wl {
  font-family: var(--font-num); font-size: 26px; width: 44px; height: 44px; border-radius: 10px;
  display: inline-grid; place-items: center; background: var(--ink); color: var(--bg); position: relative;
}
.wl::after { content: ""; position: absolute; right: -4px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.badge { font-family: var(--font-num); font-size: 15px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; display: inline-grid; place-items: center; background: var(--ink); color: var(--bg); }
.badge.free { background: var(--surface-2); color: var(--ink-2); font-family: var(--font-ui); font-size: 12px; }

.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plan-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.plan-row:first-child { border-top: 0; padding-top: 2px; }
.plan-name { font-weight: 650; color: var(--ink); text-decoration: none; }
.plan-target { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; white-space: nowrap; }
.plan-sug { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink-2); }
.plan-sug b { color: var(--accent); font-family: var(--font-num); font-weight: 700; font-size: 15px; }
.tagline { font-size: 12px; border-radius: 6px; padding: 1px 6px; margin-left: 6px; background: var(--surface-2); color: var(--ink-2); vertical-align: 2px; }

.week { display: flex; flex-direction: column; gap: 10px; }
.week-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.wd i {
  font-style: normal; width: 100%; max-width: 40px; height: 34px; border-radius: 8px; border: 1px dashed var(--line);
  display: grid; place-items: center; font-family: var(--font-num); font-size: 16px; color: var(--ink-3);
}
.wd.plan i { border-style: solid; border-color: var(--line); background: var(--surface); }
.wd.done i { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.wd.tennis i { border-style: solid; border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); font-family: var(--font-ui); font-size: 11px; }
.wd.today span { color: var(--accent); font-weight: 700; }

.diet dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14.5px; }
.diet dt { font-family: var(--font-num); color: var(--ink-2); white-space: nowrap; }
.diet dd { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 2px; gap: 2px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 4px 12px; font-size: 14px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- 训练中：配重片样式的进度条 */
.stackbar { display: flex; gap: 4px; align-items: stretch; }
.stackbar button {
  flex: 1 1 0; min-width: 0; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  font-family: var(--font-num); font-size: 15px; color: var(--ink-2); position: relative; padding: 0;
}
.stackbar button.part { background: var(--surface-2); color: var(--ink); }
.stackbar button.full { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.stackbar button.skip { background: repeating-linear-gradient(135deg, var(--surface-2) 0 4px, var(--surface) 4px 8px); color: var(--ink-3); }
.stackbar button.cur { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--ink); }
.stackbar button.cur::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); }
.stackbar .fin { flex: 0 0 44px; font-family: var(--font-ui); font-size: 13px; }

.ex-head { display: flex; flex-direction: column; gap: 4px; }
.ex-head h2 { font-size: 24px; }
.target { font-size: 15px; }
.target b { font-family: var(--font-num); font-size: 18px; }
.sug { font-size: 14px; color: var(--ink-2); }
.sug b { color: var(--accent); font-family: var(--font-num); font-size: 17px; }
.sug.pain { color: var(--bad); }
.superset { font-size: 13px; color: var(--steel); background: var(--steel-soft); border-radius: 8px; padding: 6px 10px; }
.swapped { font-size: 14px; background: var(--warn-soft); border-radius: 8px; padding: 8px 10px; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }

.cues { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cues li { display: flex; gap: 8px; font-size: 15px; font-weight: 550; }
.cues li::before { content: ""; flex: 0 0 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--accent); }

.seat { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.seat b { color: var(--ink); }
.seat-edit { display: flex; gap: 8px; width: 100%; }
.seat-edit input { flex: 1; min-width: 0; }

.sets { display: flex; flex-direction: column; gap: 8px; }
.sets-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); }
.setrow { display: flex; align-items: center; gap: 8px; }
.setno {
  flex: 0 0 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  font-family: var(--font-num); font-size: 17px; color: var(--ink-2); padding: 0;
}
.setrow.done .setno { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper { flex: 1 1 0; min-width: 0; display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); overflow: hidden; height: 44px; }
.stepper button { flex: 0 0 38px; border: 0; background: var(--surface-2); font-size: 20px; color: var(--ink); padding: 0; }
.stepper label { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 2px; padding-top: 7px; }
.stepper input {
  width: 100%; min-width: 0; border: 0; background: transparent; text-align: right; font-family: var(--font-num);
  font-size: 21px; font-variant-numeric: tabular-nums; padding: 0; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }
.stepper:focus-within { border-color: var(--accent); }
.stepper .u { font-size: 12px; color: var(--ink-3); white-space: nowrap; padding-right: 4px; }
.setrow.done .stepper { background: var(--surface-2); }
.clockbtn { flex: 0 0 56px; height: 44px; border-radius: 11px; border: 1px solid var(--steel); background: var(--steel-soft); color: var(--steel); font-weight: 600; font-size: 14px; padding: 0; font-family: var(--font-num); }
.clockbtn.on { background: var(--steel); color: var(--surface); }
.set-tools { display: flex; gap: 8px; flex-wrap: wrap; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 14px; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }
.chip.pain[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.feelrow { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }

.train-nav { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.ex-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.swaplist { display: flex; flex-direction: column; gap: 6px; }
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--bad-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

details.more { border-top: 1px solid var(--line); padding-top: 10px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--steel); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: " ▾"; }
details.more[open] summary::after { content: " ▴"; }
details.more > .guide { margin-top: 12px; }

/* ---------- 示意图 */
.figure { background: var(--surface-2); border-radius: 12px; padding: 6px 6px 8px; }
.fig-stage { position: relative; }
.fig-svg { display: block; width: 100%; height: auto; max-height: 260px; }
.fig-thumb { display: block; width: 100%; height: auto; }
.fig-cap { text-align: center; font-size: 14px; font-weight: 600; color: var(--ink-2); min-height: 22px; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fig-pair figure { margin: 0; }
.fig-pair figcaption { text-align: center; font-size: 13px; color: var(--ink-2); }
.fig-play { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; padding: 0; }
.i-pause, .i-play { display: block; width: 12px; height: 12px; }
.i-pause { border-left: 4px solid var(--ink-2); border-right: 4px solid var(--ink-2); }
.i-play { width: 0; height: 0; border-left: 11px solid var(--ink-2); border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }

.fg-torso { stroke: var(--fig); stroke-width: 9; stroke-linecap: round; fill: none; }
.fg-limb { stroke: var(--fig); stroke-width: 6.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.fg-far { stroke: var(--fig-far); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.fg-head { fill: var(--fig); }
.fg-hand { fill: var(--fig); }
.fg-topbody { fill: var(--fig-far); opacity: .55; }
.floor { stroke: var(--line); stroke-width: 2; }
.mc-frame { stroke: var(--mach); stroke-width: 3.5; stroke-linecap: round; fill: none; }
.mc-rail { stroke: var(--mach); stroke-width: 2; opacity: .7; }
.mc-rod { stroke: var(--mach); stroke-width: 1.5; opacity: .7; }
.mc-cable { stroke: var(--ink-3); stroke-width: 1.3; }
.mc-rope { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.mc-lever { stroke: var(--mach); stroke-width: 4; stroke-linecap: round; }
.mc-fill { fill: var(--mach-fill); stroke: var(--mach); stroke-width: 2; stroke-linecap: round; }
.mc-padfill { fill: var(--pad); }
.mc-pad { stroke: var(--pad); stroke-linecap: round; fill: none; }
.mc-move { stroke: var(--accent); stroke-linecap: round; fill: none; }
.mc-move-fill { fill: var(--accent); }
.mc-handle { fill: var(--mach-fill); stroke: var(--mach); stroke-width: 2; }
.mc-pivot { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.mc-plate { fill: var(--mach-fill); stroke: var(--mach); stroke-width: 1; }
.mc-plate-disc { fill: var(--mach-fill); stroke: var(--mach); stroke-width: 2.5; }
.mc-pin { fill: var(--accent); }
.trk { stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 4 4; fill: none; opacity: .75; }
.trk-head { fill: var(--accent); opacity: .85; }
.lbl-ln { stroke: var(--ink-3); stroke-width: 1; }
.lbl-dot { fill: var(--accent); }
.lbl-bg { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.lbl-tx { fill: var(--ink); font: 600 10.5px var(--font-ui); text-anchor: middle; }
.fig-note { fill: var(--ink-3); font: 10px var(--font-ui); }

/* ---------- 动作库 */
.rules ol { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: r; }
.rules li { display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; counter-increment: r; }
.rules li::before { content: counter(r); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--font-num); display: grid; place-items: center; font-size: 14px; }
.rules b { font-size: 15px; }
.rules span { font-size: 14px; color: var(--ink-2); }
.tips { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }

.exlist { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.exitem { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 10px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.exitem .fig-thumb { background: var(--surface-2); border-radius: 8px; }
.exitem b { font-size: 15px; line-height: 1.3; }
.exitem span { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.exitem .no { font-family: var(--font-num); color: var(--ink-3); font-size: 12px; }
.avoid { display: flex; flex-wrap: wrap; gap: 6px; }
.avoid span { font-size: 13px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--bad); }

.back { font-size: 15px; text-decoration: none; color: var(--steel); font-weight: 600; }
.guide { display: flex; flex-direction: column; gap: 16px; }
.guide h4 { margin: 0 0 6px; font-size: 15px; color: var(--ink-2); letter-spacing: .04em; }
.guide p, .guide li { font-size: 15.5px; }
.guide ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 8px; }
.guide ol.steps li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; counter-increment: s; }
.guide ol.steps li::before { content: counter(s); font-family: var(--font-num); font-size: 15px; width: 24px; height: 24px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; margin-top: 1px; }
.guide ul.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.mistakes { display: flex; flex-direction: column; gap: 8px; }
.mistake { display: grid; grid-template-columns: 1fr; gap: 2px; border-left: 3px solid var(--line); padding-left: 10px; }
.mistake .x { color: var(--ink-2); font-size: 14.5px; }
.mistake .x::before { content: "✗ "; color: var(--bad); font-weight: 700; }
.mistake .v { font-size: 15px; font-weight: 550; }
.mistake .v::before { content: "✓ "; color: var(--good); font-weight: 700; }
.mine { background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; }
.mine ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.video { display: inline-flex; align-items: center; gap: 6px; }

.form { display: grid; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.field input, .field select, .field textarea, .seat-edit input {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; color: var(--ink); font-size: 16px; min-width: 0;
}
.field textarea { min-height: 76px; resize: vertical; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- 记录 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat b { display: block; font-family: var(--font-num); font-size: 26px; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--ink-2); }
.hist { display: flex; flex-direction: column; }
.hrow { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 2px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.hrow:first-child { border-top: 0; }
.hrow .d { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.hrow .s { font-size: 13.5px; color: var(--ink-2); }
.hrow .f { font-size: 13px; color: var(--ink-2); }
.month { font-size: 13px; color: var(--ink-3); margin: 14px 0 2px; letter-spacing: .04em; }
.exsets { display: flex; flex-direction: column; gap: 8px; }
.exsets div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.exsets div:first-child { border-top: 0; }
.exsets .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
.exsets .n { font-size: 13px; color: var(--ink-2); grid-column: 1 / -1; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { fill: var(--ink-3); font: 11px var(--font-num); }
.ch-line { stroke: var(--chart); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--chart); opacity: .1; }
.ch-dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.ch-dot.approx { fill: var(--surface); stroke: var(--chart); stroke-width: 1.6; }
.ch-end { fill: var(--ink); font: 700 13px var(--font-num); }
.ch-target { stroke: var(--good); stroke-width: 1.4; stroke-dasharray: 5 4; }
.ch-target-tx { fill: var(--good); font: 11px var(--font-ui); }
.ch-cross { stroke: var(--ink-3); stroke-width: 1; }
.ch-tip { position: absolute; top: 4px; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.ch-tip b { font-family: var(--font-num); font-size: 15px; }
.ch-empty { color: var(--ink-3); font-size: 14px; padding: 18px 0; text-align: center; }
.ch-legend { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 身体 */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .l { font-size: 13px; color: var(--ink-2); }
.kpi .v { font-family: var(--font-num); font-size: 30px; line-height: 1.1; }
.kpi .v small { font-size: 14px; color: var(--ink-2); margin-left: 2px; }
.kpi .d { font-size: 13px; }
.kpi .d.good { color: var(--good); }
.kpi .d.warn { color: var(--warn); }
.brow { display: grid; grid-template-columns: 5.2em 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.brow:first-child { border-top: 0; }
.brow .d { font-family: var(--font-num); }
.brow .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.brow .n { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 底部：休息计时 + 标签栏 */
body.resting { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 120px); }
.rest {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); z-index: 30;
  padding: 0 12px 8px; pointer-events: none;
}
.rest-in {
  pointer-events: auto; max-width: 616px; margin: 0 auto; background: var(--ink); color: var(--bg); border-radius: 16px;
  padding: 10px 12px 12px; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.rest-label { font-size: 13px; opacity: .8; }
.rest-time { font-family: var(--font-num); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.rest-btns { display: flex; gap: 6px; grid-row: span 2; }
.rest-btns button { border: 1px solid color-mix(in srgb, var(--bg) 30%, transparent); background: transparent; color: var(--bg); border-radius: 10px; height: 40px; min-width: 46px; font-family: var(--font-num); font-size: 15px; }
.rest-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--bg) 25%, transparent); overflow: hidden; }
.rest-bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.rest.over .rest-in { background: var(--accent); color: var(--accent-ink); }
.rest.over .rest-btns button { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; position: relative; }
.tabbar a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--ink); font-weight: 600; }
.tabbar a.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tabbar a .dot-live { position: absolute; top: 8px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- 登录、提示 */
.login { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.login-box h2 { font-size: 26px; }
.login-box .brand-mark { width: 44px; height: 44px; }
.login-box input { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 14px; font-size: 17px; }
.login-msg { color: var(--bad); font-size: 14px; min-height: 20px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 96px); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 18px rgba(0,0,0,.2);
}

@media (min-width: 560px) {
  .exlist { grid-template-columns: 1fr 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
