/* 练记 · 暗色移动端主题 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
:root {
  --bg: #0e1116;
  --surface: #161a21;
  --surface2: #1c2129;
  --surface3: #242a35;
  --line: #262c37;
  --line2: #333a47;
  --text: #e9ecf1;
  --muted: #8b93a3;
  --dim: #5f6775;
  --accent: #ff7a45;
  --accent2: #ffa06b;
  --accent-ink: #1c0e06;
  --accent-dim: #2e1d15;
  --green: #38d39f;
  --blue: #5aa9ff;
  --red: #ff5f72;
  --amber: #ffc53d;
  --purple: #b388ff;
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  padding-bottom: 0;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---------- 布局 ---------- */
.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
  min-height: 100vh;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 0 16px;
}
.page-title { font-size: 26px; font-weight: 720; letter-spacing: -.02em; line-height: 1.15; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  display: grid; place-items: center; font-size: 18px; padding: 0;
}
.icon-btn:active { background: var(--surface2); }
.back {
  width: 44px; height: 44px; flex: none; border-radius: 13px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; text-decoration: none; font-size: 20px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card.tight { padding: 12px; }
.card.flat { background: transparent; border-style: dashed; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-title { font-size: 16px; font-weight: 650; }
.card-sub { color: var(--muted); font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.nowrap { white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 13px; border: 1px solid transparent;
  background: var(--surface2); color: var(--text); font-weight: 600; font-size: 15px;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line2); color: var(--text); }
.btn-soft { background: var(--surface3); color: var(--text); }
.btn-danger { background: transparent; border-color: #5a2731; color: var(--red); }
.btn-block { width: 100%; height: 54px; font-size: 16px; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .45; }

/* ---------- 标签 / 分段 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px; border-radius: 999px;
  background: var(--surface2); color: var(--muted); font-size: 12px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap;
}
.chip.on { background: var(--accent-dim); color: var(--accent2); border-color: #5a3527; }
.seg { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .chip { height: 34px; padding: 0 13px; font-size: 13px; flex: none; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--muted); padding: 34px 18px; font-size: 14px; }
.empty .big { font-size: 30px; margin-bottom: 10px; }

/* ---------- 进度条 ---------- */
.bar { height: 6px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* ---------- 循环指示 ---------- */
.cycle { display: flex; gap: 5px; margin-top: 12px; }
.cycle span {
  flex: 1; height: 6px; border-radius: 99px; background: var(--surface3);
}
.cycle span.done { background: var(--accent); }
.cycle span.cur { background: var(--accent2); box-shadow: 0 0 0 3px rgba(255,122,69,.18); }
.cycle span.rest { background: repeating-linear-gradient(90deg, var(--surface3), var(--surface3) 4px, transparent 4px, transparent 8px); }

/* ---------- 训练页：动作卡 ---------- */
.slot { padding: 14px 0; border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.slot-name { font-size: 16px; font-weight: 650; }
.slot-name .swapped { color: var(--amber); font-size: 11px; font-weight: 600; margin-left: 6px; }
.slot-meta { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.last-line { color: var(--dim); font-size: 12.5px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.sets { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }

.setrow {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 46px;
  gap: 7px; align-items: center;
}
.setnum {
  font-size: 12px; color: var(--dim); text-align: center; font-variant-numeric: tabular-nums;
  border: 0; background: none; padding: 0; height: 44px;
}
.setnum.warm { color: var(--amber); }
.stepper {
  display: flex; align-items: center; background: var(--surface2);
  border: 1px solid var(--line); border-radius: 11px; overflow: hidden; height: 46px;
}
.stepper button {
  width: 34px; height: 100%; background: none; border: 0; color: var(--dim);
  font-size: 18px; padding: 0; flex: none; line-height: 1;
}
.stepper button:active { background: var(--surface3); color: var(--text); }
.stepper input {
  flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; background: none;
  text-align: center; font-size: 19px; font-weight: 650; padding: 0;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .unit { font-size: 11px; color: var(--dim); padding-right: 6px; }
.setrow.done .stepper { border-color: #235a49; background: #12241f; }
.setrow.done .stepper input { color: var(--green); }
.setrow.warmup .stepper { border-style: dashed; background: transparent; }
.tick {
  width: 46px; height: 46px; border-radius: 11px; border: 1px solid var(--line2);
  background: var(--surface2); color: var(--muted); font-size: 16px; padding: 0;
}
.tick.on { background: var(--green); border-color: var(--green); color: #05261b; font-weight: 700; }
.tick:active { transform: scale(.96); }

.slot-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.slot-actions .btn { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }

/* ---------- 判定 ---------- */
.verdict {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 99px; font-size: 12.5px; font-weight: 650;
}
.v-up { background: #12241f; color: var(--green); }
.v-small { background: #14212f; color: var(--blue); }
.v-flat { background: var(--surface2); color: var(--muted); }
.v-down { background: #2a1519; color: var(--red); }
.v-new { background: #241f2f; color: var(--purple); }
.v-skip { background: var(--surface2); color: var(--dim); }
.cmp-row { padding: 13px 0; border-bottom: 1px solid var(--line); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmp-sets { margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cmp-sets b { color: var(--text); font-weight: 600; }
.flag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #33270f; color: var(--amber); font-weight: 600; }

/* ---------- 统计块 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface2); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat .k { font-size: 11px; color: var(--dim); }
.stat .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.input, select.input {
  width: 100%; height: 48px; background: var(--surface2); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 13px; color: var(--text); font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.input:focus { outline: none; border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ---------- 底部导航 ---------- */
.nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(14, 17, 22, .94);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line); z-index: 40;
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--dim); text-decoration: none; font-size: 11px; font-weight: 500;
  padding-top: 6px;
}
.nav a svg { width: 22px; height: 22px; }
.nav a.active { color: var(--accent); }

/* ---------- 底部弹层 ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#sheet-root.is-open { pointer-events: auto; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(5, 7, 10, .66);
  opacity: 0; transition: opacity .22s ease;
}
#sheet-root.is-open .sheet-backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  background: var(--surface); border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line2);
  transform: translateY(102%); transition: transform .28s cubic-bezier(.2, .85, .25, 1);
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom, 0px));
}
#sheet-root.is-open .sheet { transform: translateY(0); }
.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: var(--line2); margin: 6px auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.sheet .sheet-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 15px 2px; color: var(--text); font-size: 15px;
}
.list-item:last-child { border-bottom: 0; }
.list-item .sub { color: var(--dim); font-size: 12px; }
.list-item .chev { color: var(--dim); font-size: 18px; }

/* ---------- 计时器 ---------- */
.timer {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 10, 14, .95);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 30px;
}
.timer-label { color: var(--muted); font-size: 14px; letter-spacing: .08em; }
.timer-big {
  font-size: 84px; font-weight: 800; line-height: 1; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}
.timer-big.done { color: var(--green); }
.timer-sub { color: var(--muted); font-size: 14px; min-height: 20px; text-align: center; }
.timer-actions { display: flex; gap: 10px; margin-top: 8px; }
.timer-actions .btn { height: 50px; min-width: 92px; }
.timer-hint { color: var(--dim); font-size: 12px; margin-top: 10px; }
.timer-pill {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 75; display: flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  padding: 11px 16px; border-radius: 99px; font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4); border: 0;
}
@keyframes flash { 0%, 100% { opacity: 0; } 40% { opacity: .55; } }
.flash {
  position: fixed; inset: 0; background: var(--green); z-index: 90;
  pointer-events: none; opacity: 0; animation: flash 1.2s ease 2;
}

/* ---------- 日历 ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { color: var(--dim); font-size: 11px; text-align: center; padding: 4px 0 6px; }
.cal-day {
  aspect-ratio: 1 / 1.2; border-radius: 11px; background: var(--surface);
  border: 1px solid transparent; padding: 5px 3px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums;
}
.cal-day.other { opacity: .3; }
.cal-day.today { border-color: var(--accent); }
.cal-day.has { background: var(--surface2); color: var(--text); }
.cal-day .lbl { font-size: 9px; line-height: 1.15; font-weight: 600; text-align: center; }
.cal-day .num { font-weight: 600; }

/* ---------- 图表 ---------- */
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { display: block; width: 100%; height: auto; }

/* ---------- 提示 / 横幅 ---------- */
.banner {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #241a12, #1b1f27);
  border: 1px solid #3a2a1c; border-radius: var(--radius);
  padding: 13px 15px; margin-bottom: 12px; font-size: 13.5px;
}
.banner .grow { color: var(--text); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 20px);
  transform: translate(-50%, 12px); z-index: 100;
  background: var(--surface3); color: var(--text); border: 1px solid var(--line2);
  padding: 11px 18px; border-radius: 99px; font-size: 13.5px;
  opacity: 0; transition: all .22s ease; pointer-events: none; max-width: 86vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.err {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  background: #511420; color: #ffd7dc; padding: 10px 46px 10px 14px; font-size: 12px;
  border-bottom: 1px solid #7a2233; white-space: pre-wrap; max-height: 40vh; overflow: auto;
}
.err-close {
  position: absolute; top: 6px; right: 8px; width: 32px; height: 32px;
  border: 0; border-radius: 8px; background: rgba(255, 255, 255, .14);
  color: #ffd7dc; font-size: 18px; line-height: 1; padding: 0;
}
.boot {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.boot-logo { font-size: 34px; font-weight: 800; letter-spacing: .04em; color: var(--accent); }
.boot-tip { color: var(--dim); font-size: 13px; }

/* ---------- 杂项 ---------- */
.hr { height: 1px; background: var(--line); margin: 12px 0; border: 0; }
details.help summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.help[open] summary { color: var(--text); margin-bottom: 8px; }
details.help p { color: var(--muted); font-size: 13px; margin: 6px 0; }
.kbd {
  display: inline-block; padding: 0 6px; border-radius: 6px;
  background: var(--surface3); color: var(--text); font-size: 12px;
}
