/* 极简精密仪表风格 · 深炭默认 + 纯白浅色一键切换 */
:root,
[data-theme="dark"] {
  --bg: #111214;
  --surface: #181a1e;
  --surface-2: #202329;
  --well: #121417;
  --line: #272b33;
  --line-soft: #1f2329;
  --ink: #f3f4f6;
  --sub: #9097a4;
  --muted: #616875;
  --accent: #2dd49e;
  --accent-dim: #1fb887;
  --accent-bg: rgba(45, 212, 158, 0.12);
  --accent-line: rgba(45, 212, 158, 0.34);
  --accent-ink: #071913;
  --warn: #e59556;
  --warn-bg: rgba(229, 149, 86, 0.13);
  --warn-line: rgba(229, 149, 86, 0.36);
  --danger: #e06c6c;
  --danger-bg: rgba(224, 108, 108, 0.13);
  --shadow-bar: 0 -8px 28px rgba(0, 0, 0, 0.42);
  --shadow-pop: 0 14px 36px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --well: #f1f3f6;
  --line: #e2e6ec;
  --line-soft: #edf0f5;
  --ink: #111317;
  --sub: #606773;
  --muted: #9299a5;
  --accent: #0f9d6e;
  --accent-dim: #0b845c;
  --accent-bg: rgba(15, 157, 110, 0.1);
  --accent-line: rgba(15, 157, 110, 0.32);
  --accent-ink: #ffffff;
  --warn: #c8691f;
  --warn-bg: rgba(200, 105, 31, 0.1);
  --warn-line: rgba(200, 105, 31, 0.32);
  --danger: #c74646;
  --danger-bg: rgba(199, 70, 70, 0.1);
  --shadow-bar: 0 -4px 20px rgba(17, 19, 23, 0.06);
  --shadow-pop: 0 12px 30px rgba(17, 19, 23, 0.14);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
  overscroll-behavior-y: none;
  color-scheme: dark;
}
[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

body.has-timer {
  padding-bottom: calc(152px + env(safe-area-inset-bottom));
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

.num {
  font-variant-numeric: tabular-nums;
}

.hide {
  display: none !important;
}

/* 顶部固定实色头栏：保证滚屏时绝无半截字露在顶上 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}

.topbar-inner {
  max-width: 620px;
  margin: 0 auto;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.top-left {
  min-width: 0;
  flex: 1;
}

.top-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.94);
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  display: block;
}

.top-progress {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.prog-track {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.prog-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.prog-meta {
  font-size: 11.5px;
  color: var(--sub);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 主内容容器 */
.main {
  max-width: 620px;
  margin: 0 auto;
  padding: 12px 14px 16px;
}

/* 课次切换条（顺序循环 A/B/C/D） */
.cycle-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-bottom: 10px;
}
.cycle-strip::-webkit-scrollbar {
  display: none;
}

.cycle-btn {
  flex: 1 0 auto;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--sub);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cycle-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.cycle-btn .next-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.cycle-btn.active .next-dot {
  background: var(--accent);
}

/* 快捷开关行：右膝保护 / 右肩保护 / 35分保底 */
.mode-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.mode-chip {
  height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--sub);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.mode-chip:active {
  transform: scale(0.97);
}

.mode-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.mode-chip.on-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}
.mode-chip.on-warn .dot {
  background: var(--warn);
}

.mode-chip.on-accent {
  background: var(--accent-bg);
  border-color: var(--accent-line);
  color: var(--accent);
}
.mode-chip.on-accent .dot {
  background: var(--accent);
}

/* 极薄热身折叠条（默认一行不占首屏） */
.warm-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.warm-head {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.warm-head-l {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.warm-chk {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--well);
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  padding: 0;
}

.warm-chk.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.warm-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.warm-meta {
  font-size: 11.5px;
  color: var(--sub);
}

.warm-body {
  border-top: 1px solid var(--line-soft);
  padding: 8px 13px 11px;
}

.warm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--sub);
  border-bottom: 1px solid var(--line-soft);
}
.warm-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.warm-tbtn {
  flex: none;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.warm-tbtn:active {
  background: var(--accent-bg);
  border-color: var(--accent-line);
  color: var(--accent);
}

/* 动作卡片：干净结构线，无杂乱阴影 */
.ex-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 12px 11px;
  margin-bottom: 10px;
  transition: border-color 0.18s ease;
}

.ex-card.done {
  border-color: var(--accent-line);
}

.ex-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.ex-title-wrap {
  min-width: 0;
  flex: 1;
}

.ex-name-btn {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--ink);
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ex-name-btn:active {
  opacity: 0.72;
}

.ex-subline {
  margin-top: 3px;
  font-size: 12px;
  color: var(--sub);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-mini {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid var(--line);
  color: var(--sub);
  background: var(--well);
}

.tag-mini.warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

.tag-mini.accent {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent-line);
}

.ex-more {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
}

.ex-more svg {
  width: 17px;
  height: 17px;
  display: block;
}

.ex-more:active {
  background: var(--surface-2);
  color: var(--ink);
}

.ex-note-line {
  margin: 4px 0 8px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--well);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--sub);
  line-height: 1.45;
}

/* 双渐进自动加重提示条 */
.prog-sug {
  width: 100%;
  margin: 4px 0 9px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--accent-line);
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.prog-sug:active {
  opacity: 0.8;
}

/* 每组表格表头与每组行 */
.set-hdr {
  display: grid;
  grid-template-columns: 22px 52px 1fr 0.82fr 38px;
  gap: 6px;
  align-items: center;
  padding: 4px 2px 6px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
}

.set-hdr span:nth-child(3),
.set-hdr span:nth-child(4),
.set-hdr span:nth-child(5) {
  text-align: center;
}

.set-hdr.no-wt {
  grid-template-columns: 24px 56px 1fr 48px 38px;
}

.set-row {
  display: grid;
  grid-template-columns: 22px 52px 1fr 0.82fr 38px;
  gap: 6px;
  align-items: center;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line-soft);
  transition: opacity 0.16s ease, background 0.16s ease;
}

.set-row:last-of-type {
  border-bottom: 0;
}

.set-row.no-wt {
  grid-template-columns: 24px 56px 1fr 48px 38px;
}

.set-row.checked {
  background: var(--accent-bg);
  border-radius: 9px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 2px -3px;
  border-bottom-color: transparent;
}

.set-idx {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.set-row.checked .set-idx {
  color: var(--accent);
}

.set-prev {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 步进输入组：- 数字 +（单手免键盘） */
.stepper {
  display: flex;
  align-items: center;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 9px;
  height: 36px;
  overflow: hidden;
}

.set-row.checked .stepper {
  border-color: var(--accent-line);
  background: var(--surface);
}

.step-btn {
  width: 28px;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
}

.step-btn:active {
  background: var(--surface-2);
  color: var(--ink);
}

.step-inp {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  padding: 0 2px;
  -webkit-appearance: none;
}

.step-inp:focus {
  outline: none;
  background: var(--accent-bg);
}

.step-inp::-webkit-outer-spin-button,
.step-inp::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hold-mini {
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  padding: 0 4px;
}

.hold-mini:active {
  background: var(--accent-bg);
  color: var(--accent);
}

/* 打勾大按钮 */
.set-chk {
  width: 38px;
  height: 36px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--well);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.set-chk:active {
  transform: scale(0.92);
}

.set-chk.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.set-chk svg {
  width: 16px;
  height: 16px;
  display: block;
}

.ex-foot {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.add-set-btn {
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 4px;
}

.add-set-btn:active {
  color: var(--ink);
}

.rest-label {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 完成本次训练主按钮 */
.finish-btn {
  width: 100%;
  height: 50px;
  margin: 12px 0 6px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: transform 0.12s ease, background 0.15s ease;
}

.finish-btn.ready {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.finish-btn:active {
  transform: scale(0.985);
}

/* 底部悬浮轻量休息条（绝不强行黑屏遮挡动作列表） */
.timer-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: none;
}

.timer-dock.show {
  display: block;
  animation: dockIn 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes dockIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.timer-dock.done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  animation: donePulse 1.4s ease-in-out infinite;
}

@keyframes donePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(45, 212, 158, 0.45), var(--shadow-pop);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(45, 212, 158, 0), var(--shadow-pop);
  }
}

.timer-bar-track {
  height: 3px;
  background: var(--line);
  width: 100%;
}

.timer-dock.done .timer-bar-track {
  background: rgba(0, 0, 0, 0.15);
}

.timer-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 100%;
  transition: width 0.25s linear;
}

.timer-dock.done .timer-bar-fill {
  background: var(--accent-ink);
}

.timer-dock-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.timer-readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
}

.timer-clock {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  flex: none;
}

.timer-info {
  font-size: 12px;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-dock.done .timer-info {
  color: var(--accent-ink);
  font-weight: 600;
}

.timer-ctrls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.t-ctl {
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.t-ctl.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.timer-dock.done .t-ctl {
  background: rgba(0, 0, 0, 0.14);
  border-color: transparent;
  color: var(--accent-ink);
}

.timer-dock.done .t-ctl.primary {
  background: var(--accent-ink);
  color: var(--accent);
}

/* 可选全屏聚焦圆环计时层（仅用户主动点击底部计时条时展开） */
.timer-full {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  touch-action: none;
}

.timer-full.show {
  display: flex;
}

.tf-top {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.tf-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: 28px;
}

.tf-ring {
  width: 236px;
  height: 236px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--accent) 0deg, var(--accent) var(--deg, 360deg), var(--line) var(--deg, 360deg));
}

.tf-inner {
  width: 214px;
  height: 214px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tf-num {
  font-size: 62px;
  font-weight: 300;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.tf-unit {
  margin-top: 8px;
  font-size: 12px;
  color: var(--sub);
}

.tf-btns {
  display: flex;
  gap: 10px;
  margin-top: 34px;
  width: 100%;
  max-width: 320px;
}

.tf-btns button {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.tf-btns button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.tf-min {
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 13px;
  padding: 10px 18px;
}

.tf-hint {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* 底部极简 3 格导航栏 */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-bar);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
}

.tabbar-inner {
  max-width: 620px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.tab-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 0 4px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.tab-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.tab-btn.on {
  color: var(--ink);
}

.tab-btn.on svg {
  color: var(--accent);
}

/* 通用卡片与表单（计划页 & 进度页） */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}

.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-h h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.card-h span {
  font-size: 12px;
  color: var(--sub);
}

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.plan-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.plan-row b {
  font-weight: 600;
}
.plan-row em {
  font-style: normal;
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active {
  background: var(--surface-2);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.danger {
  color: var(--danger);
  border-color: rgba(224, 108, 108, 0.35);
  background: var(--danger-bg);
}

/* 折叠科学指南 */
.fold {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}

.fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 14px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::after {
  content: "展开";
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  flex: none;
}

.fold[open] > summary::after {
  content: "收起";
}

.fold[open] > summary {
  border-bottom: 1px solid var(--line-soft);
}

.fold-body {
  padding: 11px 14px 13px;
  font-size: 13px;
  color: var(--sub);
  line-height: 1.65;
}

/* 进度页：三格统计 + 8周点阵 + 折线图 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 8px;
  text-align: center;
}

.stat-box b {
  display: block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-box span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--sub);
}

.cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--well);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cal-cell.trained {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.cal-cell.today {
  border-color: var(--ink);
}

.cal-cell.future {
  opacity: 0.32;
}

.sel-ctrl {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 10px;
}

.chart-box {
  width: 100%;
  margin: 6px 0 4px;
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.hist-list-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  padding: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}
.hist-list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.hist-l b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.hist-l span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--sub);
}

.hist-r {
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* 通用底抽屉（动作讲解 / 替换 / 结算 / 编辑计划） */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.56);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  touch-action: none;
}

.sheet-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.sheet-box {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  max-height: 86vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(20px);
  transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sheet-mask.show .sheet-box {
  transform: none;
}

.sheet-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-hd h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.sheet-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--sub);
}

.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--sub);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.sec {
  margin-bottom: 14px;
}
.sec:last-child {
  margin-bottom: 0;
}

.sec-t {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 7px;
}

.cue-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--well);
  border-left: 3px solid var(--accent);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
}

.cue-box.warn {
  border-left-color: var(--warn);
}

.step-li {
  display: flex;
  gap: 9px;
  margin-bottom: 7px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
}

.step-li i {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--well);
  border: 1px solid var(--line);
  color: var(--sub);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.avoid-li {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--sub);
}
.avoid-li::before {
  content: "×";
  color: var(--danger);
  font-weight: 700;
  flex: none;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.field-row label {
  font-size: 12px;
  color: var(--sub);
  font-weight: 600;
}

.txt-inp {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--ink);
  font-size: 14px;
  -webkit-appearance: none;
}

.txt-inp::-webkit-outer-spin-button,
.txt-inp::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.txt-inp:focus {
  outline: none;
  border-color: var(--accent);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* 疼痛 0-5 选择行 */
.pain-seg {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-top: 5px;
}

.pain-seg button {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pain-seg button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.pain-seg button.on-warn {
  background: var(--warn);
  border-color: var(--warn);
  color: #111214;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.menu-item {
  width: 100%;
  padding: 12px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.menu-item span {
  font-size: 12px;
  font-weight: 500;
  color: var(--sub);
}

.menu-item:active {
  background: var(--surface-2);
}

/* 编辑计划项 */
.edit-ex-item {
  padding: 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--well);
  margin-bottom: 8px;
}

.edit-ex-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.edit-ex-top b {
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-ops {
  display: flex;
  gap: 4px;
  flex: none;
}

.mini-op {
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--sub);
  font-size: 11.5px;
  font-weight: 600;
}

/* 轻提示 Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  z-index: 120;
  background: var(--ink);
  color: var(--bg);
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 极窄屏适配 (320px 零横向溢出) */
@media (max-width: 355px) {
  .main {
    padding: 10px 10px 14px;
  }
  .ex-card {
    padding: 11px 9px 10px;
  }
  .set-hdr,
  .set-row {
    grid-template-columns: 16px 48px 1fr 0.78fr 34px;
    gap: 4px;
  }
  .set-prev {
    font-size: 10px;
  }
  .step-btn {
    width: 22px;
    font-size: 14px;
  }
  .step-inp {
    font-size: 13px;
  }
  .set-chk {
    width: 34px;
    height: 34px;
  }
  .mode-chip {
    font-size: 11px;
    padding: 0 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
