/* 李乐源健身 · 深色主题 · 移动端优先 */
:root {
  --bg: #0b0d10;
  --bg-soft: #121519;
  --card: #171b21;
  --card-2: #1e242c;
  --line: #262d36;
  --text: #f2f4f6;
  --text-2: #9aa3ad;
  --text-3: #5f6873;
  --accent: #ff8a2b;
  --accent-soft: rgba(255, 138, 43, 0.14);
  --green: #2fd07a;
  --green-soft: rgba(47, 208, 122, 0.14);
  --blue: #38bdf8;
  --blue-soft: rgba(56, 189, 248, 0.15);
  --red: #f0564a;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
button { font-family: inherit; border: none; cursor: pointer; color: inherit; background: none; }
input, select { font-family: inherit; }
svg { display: block; }

#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(84px + var(--safe-b)); }

/* ---------- 顶部 ---------- */
.topbar { padding: 22px 2px 4px; display: flex; align-items: flex-end; justify-content: space-between; }
.topbar h1 { font-size: 26px; font-weight: 700; letter-spacing: 0.5px; }
.topbar .date { color: var(--text-2); font-size: 13px; padding-bottom: 4px; }
.page-title { font-size: 24px; font-weight: 700; padding: 22px 2px 12px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
}
.card h3 { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card h3 .ic { width: 17px; height: 17px; color: var(--accent); flex: none; }

/* ---------- 首页 ---------- */
.cycle-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600; padding: 6px 13px; border-radius: 999px; margin-top: 12px;
  white-space: nowrap;
}
.cycle-badge .ic { width: 15px; height: 15px; flex: none; }
.cycle-badge.rest { background: var(--green-soft); color: var(--green); }
.today-plan .ex-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.today-plan .ex-row:last-child { border-bottom: none; }
.today-plan .ex-name { font-size: 15px; }
.today-plan .ex-spec { color: var(--text-2); font-size: 13px; white-space: nowrap; margin-left: 12px; }
.flow-line { color: var(--text-2); font-size: 13px; margin-top: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow-line .sep { color: var(--text-3); }

.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-top: 16px; padding: 17px;
  background: linear-gradient(135deg, #ff8a2b, #ff6d1f);
  color: #17110b; font-size: 18px; font-weight: 700; border-radius: 18px;
  box-shadow: 0 6px 24px rgba(255, 138, 43, 0.25);
}
.big-btn:active { transform: scale(0.98); }
.big-btn.done { background: var(--card-2); color: var(--green); box-shadow: none; border: 1px solid var(--line); }
.big-btn .ic { width: 22px; height: 22px; }

.done-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 15px 16px;
  background: var(--green-soft); border: 1px solid rgba(47, 208, 122, 0.3);
  border-radius: var(--radius); color: var(--green); font-weight: 600;
}
.done-banner .ic { width: 20px; height: 20px; flex: none; }

/* 喝水 */
.water-cups { display: flex; gap: 8px; margin-top: 6px; }
.water-cup {
  flex: 1; aspect-ratio: 3/4; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.water-cup .ic { width: 55%; height: 55%; color: var(--text-3); }
.water-cup.on { background: var(--blue-soft); border-color: rgba(56, 189, 248, 0.5); }
.water-cup.on .ic { color: var(--blue); }
.water-note { color: var(--text-2); font-size: 12.5px; margin-top: 10px; }

/* 提醒卡 */
.hint-card { border-left: 3px solid var(--accent); }
.hint-card p { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }
.hint-card .actions { display: flex; gap: 10px; margin-top: 12px; }
.chip-btn {
  padding: 9px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--card-2); border: 1px solid var(--line);
}
.chip-btn.primary { background: var(--accent); color: #17110b; border-color: transparent; }

/* 休息日 */
.rest-list li { list-style: none; display: flex; gap: 10px; padding: 7px 0; color: var(--text-2); font-size: 14.5px; align-items: flex-start; }
.rest-list .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--green); margin-top: 9px; flex: none; }

/* ---------- 饮食页 ---------- */
.diet-summary { display: flex; gap: 12px; }
.diet-summary .stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; margin-top: 14px; }
.diet-summary .label { color: var(--text-2); font-size: 12.5px; }
.diet-summary .val { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.diet-summary .sub { color: var(--text-3); font-size: 12px; margin-top: 1px; }
.meal-card .meal-head { display: flex; justify-content: space-between; align-items: center; }
.meal-card .meal-title { font-size: 16px; font-weight: 700; }
.meal-card .meal-time { color: var(--text-3); font-size: 12.5px; margin-left: 8px; font-weight: 400; }
.swap-btn {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent); font-size: 13.5px; font-weight: 600;
  padding: 6px 10px; border-radius: 10px; background: var(--accent-soft);
}
.swap-btn .ic { width: 14px; height: 14px; }
.meal-card .opt-name { font-size: 15px; font-weight: 600; margin-top: 10px; }
.meal-card .opt-items { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.meal-card .opt-method { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.meal-card .opt-macro { display: flex; gap: 14px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.meal-card .opt-macro b { color: var(--text); font-variant-numeric: tabular-nums; }
.meal-card .meal-note { margin-top: 10px; padding: 8px 11px; background: var(--bg-soft); border-radius: 10px; color: var(--text-2); font-size: 12.5px; }
.redline-card { border-left: 3px solid var(--red); }
.redline-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.redline-tags span {
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  background: rgba(240, 86, 74, 0.12); color: #f28b82;
}

/* ---------- 进度页 ---------- */
.chart-wrap { margin-top: 8px; }
.chart-wrap svg { width: 100%; height: auto; }
.chart-empty { color: var(--text-3); font-size: 13.5px; padding: 22px 0; text-align: center; }
.record-row { display: flex; gap: 10px; margin-top: 12px; }
.record-row input {
  flex: 1; min-width: 0; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; color: var(--text); font-size: 16px;
}
.record-row input:focus { outline: none; border-color: var(--accent); }
.record-row .chip-btn.primary { flex: none; }
.stat-inline { display: flex; gap: 16px; margin-top: 4px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.stat-inline b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }

/* 打卡日历 */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-head .cal-nav { display: flex; gap: 6px; }
.cal-head button { padding: 5px 10px; border-radius: 8px; background: var(--card-2); color: var(--text-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .wd { text-align: center; color: var(--text-3); font-size: 11.5px; padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1; border-radius: 9px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 12.5px; color: var(--text-2);
  background: var(--bg-soft); position: relative;
}
.cal-cell.blank { background: transparent; }
.cal-cell.done { background: var(--green-soft); color: var(--green); font-weight: 600; }
.cal-cell.skip { background: rgba(240, 86, 74, 0.09); color: #b3766f; }
.cal-cell.today { outline: 1.5px solid var(--accent); }
.cal-cell .ck { width: 11px; height: 11px; margin-top: 1px; }
.streak-line { margin-top: 12px; color: var(--text-2); font-size: 13.5px; }
.streak-line b { color: var(--accent); font-size: 17px; }

/* ---------- 设置页 ---------- */
.set-group { padding: 4px 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); gap: 14px; }
.set-row:last-child { border-bottom: none; }
.set-row .lbl { font-size: 15px; }
.set-row .lbl small { display: block; color: var(--text-3); font-size: 12px; margin-top: 1px; }
.set-row input[type='number'], .set-row input[type='date'], .set-row select {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 8px 10px; font-size: 15px; width: 120px; text-align: right;
}
.set-row input:focus, .set-row select:focus { outline: none; border-color: var(--accent); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; z-index: 2; margin: 0; }
.switch .knob {
  position: absolute; inset: 0; border-radius: 999px; background: var(--card-2);
  border: 1px solid var(--line); transition: background 0.2s;
}
.switch .knob::after {
  content: ''; position: absolute; top: 2.5px; left: 3px; width: 23px; height: 23px;
  border-radius: 999px; background: #fff; transition: transform 0.2s;
}
.switch input:checked + .knob { background: var(--green); border-color: transparent; }
.switch input:checked + .knob::after { transform: translateX(19px); }
.save-btn { margin-top: 16px; }
.ghost-btn {
  width: 100%; margin-top: 12px; padding: 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2); font-size: 15px;
}
.ghost-btn.danger { color: var(--red); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(13, 15, 18, 0.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-b));
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3); font-size: 11px; padding: 4px 14px; border-radius: 12px; min-width: 62px;
}
.tabbar button.on { color: var(--accent); }
.tabbar .ic { width: 23px; height: 23px; }

/* ---------- 训练模式（全屏） ---------- */
#trainer {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column;
  padding: 14px 20px calc(20px + var(--safe-b));
  overflow: hidden;
}
.tr-top { display: flex; align-items: center; justify-content: space-between; }
.tr-exit { color: var(--text-3); font-size: 14px; padding: 8px; }
.tr-sections { display: flex; gap: 6px; }
.tr-sections span {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: var(--card); color: var(--text-3); border: 1px solid var(--line);
}
.tr-sections span.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.tr-sections span.past { color: var(--green); }
.tr-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 0; }
.tr-kicker { color: var(--text-2); font-size: 15px; letter-spacing: 1px; }
.tr-name { font-size: 30px; font-weight: 800; margin-top: 10px; line-height: 1.3; padding: 0 6px; }
.tr-sub { color: var(--text-2); font-size: 16px; margin-top: 10px; }
.tr-sub b { color: var(--accent); }
.tr-tips {
  margin-top: 18px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; color: var(--text-2); font-size: 14px; text-align: left; max-width: 420px;
}
.tr-clock { font-size: 88px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 2px; line-height: 1.1; margin-top: 6px; }
.tr-clock.small { font-size: 64px; }
.tr-clock.warn { color: var(--accent); }
.tr-ring { position: relative; width: min(64vw, 260px); margin-top: 14px; }
.tr-ring svg { width: 100%; height: auto; }
.tr-ring .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.tr-ring .num small { font-size: 13px; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.tr-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.tr-main-btn {
  padding: 18px; border-radius: 18px; font-size: 19px; font-weight: 700;
  background: linear-gradient(135deg, #ff8a2b, #ff6d1f); color: #17110b;
}
.tr-main-btn:active { transform: scale(0.98); }
.tr-main-btn.green { background: linear-gradient(135deg, #2fd07a, #1fae62); color: #06170d; }
.tr-sec-row { display: flex; gap: 10px; }
.tr-sec-btn {
  flex: 1; padding: 13px; border-radius: 14px; font-size: 15px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2);
}
.cardio-opts { display: flex; gap: 10px; margin-top: 20px; }
.cardio-opts button {
  padding: 14px 22px; border-radius: 14px; font-size: 17px; font-weight: 700;
  background: var(--card); border: 1.5px solid var(--line);
}
.cardio-opts button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tr-done-icon { width: 84px; height: 84px; color: var(--green); }
.tr-summary { color: var(--text-2); font-size: 15px; margin-top: 14px; line-height: 1.9; }
.tr-summary b { color: var(--text); }

/* ---------- 登录 ---------- */
#lock {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lock-box { width: 100%; max-width: 340px; text-align: center; }
.lock-logo { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 20px; }
.lock-box h2 { font-size: 22px; font-weight: 700; }
.lock-box p { color: var(--text-2); font-size: 14px; margin-top: 6px; }
.lock-box input {
  width: 100%; margin-top: 22px; padding: 15px 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  font-size: 17px; text-align: center; letter-spacing: 2px;
}
.lock-box input:focus { outline: none; border-color: var(--accent); }
.lock-box .big-btn { margin-top: 14px; }
.lock-err { color: var(--red); font-size: 13.5px; margin-top: 12px; min-height: 18px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal {
  width: 100%; max-width: 560px; background: var(--bg-soft);
  border-radius: 22px 22px 0 0; padding: 24px 20px calc(26px + var(--safe-b));
  border-top: 1px solid var(--line);
  animation: slide-up 0.22s ease;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 18px; font-weight: 700; }
.modal p { color: var(--text-2); font-size: 14.5px; margin-top: 8px; }
.modal .m-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.modal .m-btn { padding: 15px; border-radius: 14px; font-size: 16px; font-weight: 600; background: var(--card-2); border: 1px solid var(--line); }
.modal .m-btn.primary { background: var(--accent); color: #17110b; border-color: transparent; font-weight: 700; }
.modal input {
  width: 100%; margin-top: 12px; padding: 13px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: 16px;
}
.modal input:focus { outline: none; border-color: var(--accent); }

/* ---------- 其他 ---------- */
.disclaimer { color: var(--text-3); font-size: 11.5px; line-height: 1.7; padding: 26px 4px 10px; text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%);
  background: #262d36; color: var(--text); padding: 11px 20px; border-radius: 999px;
  font-size: 14px; z-index: 300; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  white-space: nowrap; opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.hidden { display: none !important; }

@media (min-width: 700px) {
  body { font-size: 16.5px; }
  #app { max-width: 620px; }
  .tr-name { font-size: 36px; }
  .tr-clock { font-size: 110px; }
}
