/* ===== 倒三角 · 训练日志 ===== */
:root {
  --bg: #0a0c0f;
  --bg-2: #0e1115;
  --surface: #141920;
  --surface-2: #1a212a;
  --surface-3: #212a35;
  --line: #26303b;
  --line-soft: #1d252e;
  --text: #eef2f7;
  --muted: #8b98a8;
  --muted-2: #6b7787;
  --accent: #ff6a1a;
  --accent-2: #ff9142;
  --accent-soft: rgba(255, 106, 26, 0.12);
  --accent-line: rgba(255, 106, 26, 0.42);
  --good: #2fd07a;
  --good-soft: rgba(47, 208, 122, 0.12);
  --warn: #ffb020;
  --bad: #ff5164;
  --teal: #2dd4bf;
  --purple: #a78bfa;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --tabbar-h: 62px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1000px 520px at 50% -180px, rgba(255, 106, 26, 0.16), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(45, 212, 191, 0.05), transparent 55%);
  z-index: 0;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent-2); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  z-index: 100;
  background: var(--bg);
  transition: opacity 0.25s ease;
}
.boot-logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--accent-2), #e2440c);
  box-shadow: 0 12px 32px rgba(255, 106, 26, 0.35);
  animation: pulse 1.4s ease-in-out infinite;
}
.boot-text { color: var(--muted); font-size: 13px; letter-spacing: 0.1em; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1 } 50% { transform: scale(0.9); opacity: 0.7 } }

/* ===== 顶栏 ===== */
#topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(10, 12, 15, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(38, 48, 59, 0.6);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); filter: drop-shadow(0 4px 10px rgba(255, 106, 26, 0.4)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: 0.06em; }
.brand-text span { font-size: 11px; color: var(--muted-2); letter-spacing: 0.08em; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { background: var(--surface-2); color: var(--text); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent-2);
  border: 1px solid var(--accent-line);
  white-space: nowrap;
}
.chip.good { background: var(--good-soft); color: var(--good); border-color: rgba(47, 208, 122, 0.35); }
.chip.muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

/* ===== 主体 ===== */
#view {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}
body.timer-on #view { padding-bottom: calc(var(--tabbar-h) + 130px + env(safe-area-inset-bottom, 0px)); }

/* ===== 底部导航 ===== */
#tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(12, 15, 19, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line-soft);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--accent); }
.tab.active svg { filter: drop-shadow(0 0 10px rgba(255, 106, 26, 0.45)); }

/* ===== 通用组件 ===== */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0) 60%), var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h3 { font-size: 15px; letter-spacing: 0.02em; }
.card-title .sub { font-size: 12px; color: var(--muted-2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn.primary {
  border: none;
  background: linear-gradient(135deg, #ff7f2f, #f0480c);
  color: #fff;
  box-shadow: 0 10px 26px rgba(240, 72, 12, 0.32);
}
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; font-weight: 500; }
.btn.danger { color: var(--bad); border-color: rgba(255, 81, 100, 0.3); background: rgba(255, 81, 100, 0.08); }
.btn.good { background: var(--good-soft); border-color: rgba(47, 208, 122, 0.35); color: var(--good); }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.dim { color: var(--muted-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-variant-numeric: tabular-nums; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.hidden { display: none !important; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > label { font-size: 12px; color: var(--muted); letter-spacing: 0.03em; }
.field .hint { font-size: 11px; color: var(--muted-2); }
.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  background: #0d1116;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(255, 106, 26, 0.1); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input.sm { min-height: 38px; padding: 6px 10px; font-size: 14px; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 9px; font-size: 13px; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }

.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.02em;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}
.tag.g-back { background: rgba(45, 212, 191, 0.12); color: var(--teal); }
.tag.g-rear { background: rgba(167, 139, 250, 0.14); color: var(--purple); }
.tag.g-shoulder { background: rgba(255, 176, 32, 0.14); color: var(--warn); }
.tag.g-chest { background: rgba(255, 106, 26, 0.14); color: var(--accent-2); }
.tag.g-leg { background: rgba(96, 165, 250, 0.14); color: #7cb6ff; }
.tag.g-arm { background: rgba(255, 81, 100, 0.12); color: #ff8a98; }
.tag.g-core { background: rgba(148, 163, 184, 0.14); color: #b6c2d1; }
.tag.ai { background: rgba(45, 212, 191, 0.14); color: var(--teal); }
.tag.tpl { background: var(--surface-3); color: var(--muted); }

.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--muted-2);
  font-size: 13px;
}
.empty strong { display: block; color: var(--muted); font-size: 15px; margin-bottom: 4px; font-weight: 600; }

/* ===== 今日 ===== */
.done-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(47, 208, 122, 0.16), rgba(47, 208, 122, 0.04));
  border: 1px solid rgba(47, 208, 122, 0.35);
  border-radius: 16px;
  color: var(--text);
}
.done-strip:active { transform: scale(0.995); }
.done-check {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--good);
  color: #03160c;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
}
.done-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.done-text b { font-size: 14px; }
.done-text span { font-size: 11px; color: var(--muted); margin-top: 2px; }
.done-more { font-size: 12px; color: var(--good); white-space: nowrap; }

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(400px 200px at 100% -40%, rgba(255, 106, 26, 0.22), transparent 70%),
    linear-gradient(180deg, #191f27, #12171d);
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  padding: 20px;
}
.hero::after {
  content: "";
  position: absolute; right: -30px; bottom: -60px;
  width: 190px; height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(255, 106, 26, 0.18);
}
.hero .eyebrow { font-size: 11px; letter-spacing: 0.16em; color: var(--accent-2); text-transform: uppercase; }
.hero h2 { font-size: 24px; margin-top: 6px; letter-spacing: 0.01em; }
.hero .focus { color: var(--muted); font-size: 13px; margin-top: 6px; }
.hero .meta { display: flex; gap: 14px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.hero .meta b { color: var(--text); font-weight: 600; }
.hero .hero-actions { display: flex; gap: 10px; margin-top: 18px; position: relative; z-index: 1; }

.daychips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 2px; margin: 16px 0 4px; scrollbar-width: none; }
.daychips::-webkit-scrollbar { display: none; }
.daychip {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.daychip b { color: var(--text); font-weight: 600; margin-right: 4px; }
.daychip.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-2); }
.daychip.active b { color: var(--accent-2); }
.daychip .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-left: 6px; vertical-align: middle; }

.progress-wrap { margin: 14px 0 4px; }
.progress-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress-bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ffb020); border-radius: 99px; transition: width 0.3s ease; }

.ex-card { padding: 14px 14px 10px; }
.ex-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ex-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ex-target { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ex-note { font-size: 12px; color: var(--muted-2); margin-top: 8px; line-height: 1.5; padding: 8px 10px; background: rgba(255, 255, 255, 0.025); border-radius: 10px; border: 1px dashed var(--line-soft); }
.ex-note::before { content: "💡 "; }

.sets { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.set-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 6px 6px 6px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.set-row .idx { font-size: 12px; color: var(--muted-2); text-align: center; font-variant-numeric: tabular-nums; }
.set-input {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px 6px 10px;
  background: #0d1116;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.set-input:focus { border-color: var(--accent-line); }
.set-input::-webkit-outer-spin-button, .set-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-check {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: transparent;
  display: grid; place-items: center;
  color: transparent;
  transition: all 0.15s;
}
.set-check svg { width: 18px; height: 18px; }
.set-check.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(255, 106, 26, 0.3); }
.set-row.done { background: rgba(255, 106, 26, 0.055); border-color: rgba(255, 106, 26, 0.18); }
.set-row.done .set-input { color: var(--muted); }
.set-unit { font-size: 10px; color: var(--muted-2); text-align: center; margin-top: -2px; }

.session-actions { display: flex; gap: 10px; margin-top: 16px; }
.session-actions .btn { flex: 1; }

.finish-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 4px; }
.finish-summary div { background: var(--surface-2); border-radius: 12px; padding: 12px 10px; text-align: center; border: 1px solid var(--line-soft); }
.finish-summary b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.finish-summary span { font-size: 11px; color: var(--muted-2); }

/* ===== 计划 ===== */
.prog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.prog-head h2 { font-size: 19px; }
.prog-meta { font-size: 12px; color: var(--muted-2); margin-top: 4px; }
.day-block { border: 1px solid var(--line-soft); border-radius: 16px; background: var(--surface); margin-top: 10px; overflow: hidden; }
.day-block summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.day-block summary::-webkit-details-marker { display: none; }
.day-block summary .dtitle { display: flex; align-items: center; gap: 10px; }
.day-block summary .dkey { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--accent-2); }
.day-block summary .dname { font-weight: 600; font-size: 14px; }
.day-block summary .dsub { font-size: 11px; color: var(--muted-2); }
.day-block .dbody { padding: 0 16px 14px; }
.ex-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.ex-line .nm { font-size: 14px; }
.ex-line .sp { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-line .note { grid-column: 1 / -1; font-size: 11px; color: var(--muted-2); }
.ex-edit-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; align-items: center; }
.ex-edit-grid .set-input { min-height: 34px; font-size: 13px; }

/* ===== 统计 ===== */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; padding: 14px; }
.stat b { display: block; font-size: 24px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.stat span { font-size: 12px; color: var(--muted-2); }
.chart-box { position: relative; height: 210px; margin-top: 6px; }
.chart-box.tall { height: 250px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted-2); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

.calendar { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.cal-cell { width: 15px; height: 15px; border-radius: 4px; background: #171d24; }
.cal-cell.l1 { background: rgba(255, 106, 26, 0.22); }
.cal-cell.l2 { background: rgba(255, 106, 26, 0.45); }
.cal-cell.l3 { background: rgba(255, 106, 26, 0.72); }
.cal-cell.l4 { background: var(--accent); }
.cal-cell.rest { background: #141a21; }

/* ===== 档案 ===== */
.measure-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.measure-table th { text-align: left; color: var(--muted-2); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line-soft); }
.measure-table td { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.measure-table tr:last-child td { border-bottom: none; }
.measure-table .del { color: var(--muted-2); background: none; border: 0; padding: 4px 6px; }
.measure-table .del:hover { color: var(--bad); }

.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }

/* ===== AI ===== */
.chat-wrap { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.msg { max-width: 88%; padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line-soft); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, #ff7f2f, #ef4a0e); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 8px 20px rgba(240, 72, 12, 0.22); }
.msg .time { display: block; font-size: 10px; opacity: 0.5; margin-top: 5px; }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.25 } 50% { opacity: 1 } }
.quick-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.quick-chips::-webkit-scrollbar { display: none; }
.quick-chips button { flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; }
.chat-input-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(728px, calc(100% - 32px));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  background: linear-gradient(180deg, rgba(10, 12, 15, 0), rgba(10, 12, 15, 0.94) 30%);
  backdrop-filter: blur(12px);
  padding: 18px 0 10px;
  display: flex;
  gap: 8px;
}
.chat-input-bar .input { min-height: 44px; border-radius: 14px; }
.chat-send { width: 46px; height: 46px; border-radius: 14px; border: 0; background: linear-gradient(135deg, #ff7f2f, #ef4a0e); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.chat-send svg { width: 20px; height: 20px; }

/* ===== 休息计时 ===== */
#timerbar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(24, 31, 40, 0.96);
  border: 1px solid var(--accent-line);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.timer-info { display: flex; align-items: baseline; gap: 8px; }
.timer-label { font-size: 11px; color: var(--accent-2); letter-spacing: 0.1em; }
#timerLeft { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.timer-actions { display: flex; gap: 6px; }
.ghost-btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 10px; padding: 7px 10px; font-size: 12px; }
#timerFill { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--accent), #ffb020); transform-origin: left; }
#timerbar.done { border-color: var(--good); }
#timerbar.done #timerLeft { color: var(--good); }

/* ===== 弹层 ===== */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); animation: fade 0.2s ease; }
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  background: #10151b;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  animation: slideup 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
}
.sheet-grab { width: 40px; height: 4px; border-radius: 99px; background: var(--line); margin: 4px auto 14px; }
@keyframes slideup { from { transform: translateY(40px); opacity: 0.6 } to { transform: translateY(0); opacity: 1 } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.toast {
  position: fixed;
  left: 50%;
  top: calc(66px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  z-index: 55;
  max-width: 86vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(30, 38, 48, 0.97);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: fade 0.18s ease;
}
.toast.bad { border-color: rgba(255, 81, 100, 0.5); color: #ffb4bd; }
.toast.good { border-color: rgba(47, 208, 122, 0.45); color: #a9f0c9; }

/* ===== 登录 ===== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px 24px;
  background:
    radial-gradient(600px 360px at 50% -100px, rgba(255, 106, 26, 0.2), transparent 65%),
    var(--bg);
  overflow-y: auto;
}
.auth-logo { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px; background: linear-gradient(140deg, #ff8b3d, #e5400a); display: grid; place-items: center; box-shadow: 0 18px 46px rgba(240, 72, 12, 0.4); }
.auth-logo svg { width: 34px; height: 34px; color: #fff; }
.auth-title { text-align: center; font-size: 26px; letter-spacing: 0.06em; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; line-height: 1.6; }
.auth-card { width: 100%; max-width: 380px; margin: 28px auto 0; }
.auth-foot { text-align: center; color: var(--muted-2); font-size: 11px; margin-top: 22px; letter-spacing: 0.04em; }

/* ===== 杂项 ===== */
.divider { height: 1px; background: var(--line-soft); margin: 14px 0; }
.loading { display: flex; justify-content: center; padding: 40px 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.skeleton { color: var(--muted-2); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 10px; }
.section-title h3 { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0.06em; }

/* ===== 饮食 ===== */
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 16px; }
.date-nav .cur { min-width: 108px; text-align: center; font-size: 13px; }
.nutri-total { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.nutri-total b { font-size: 32px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.nutri-total .unit { color: var(--muted); font-size: 12px; }
.nutri-total .goal { margin-left: auto; font-size: 11px; color: var(--muted-2); }
.nutri-bars { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.nutri-bar-row .lab { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.progress-bar.sm { height: 5px; }
.progress-bar.teal > i { background: linear-gradient(90deg, #2dd4bf, #60e6d3); }
.progress-bar.violet > i { background: linear-gradient(90deg, #a78bfa, #c4b5fd); }
.progress-bar.amber > i { background: linear-gradient(90deg, #ffb020, #ffd36b); }
.meal-block { padding: 9px 0; border-top: 1px solid var(--line-soft); }
.meal-block:first-of-type { border-top: 0; padding-top: 0; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.meal-head b { font-size: 14px; }
.meal-head span { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.intake-row { display: grid; grid-template-columns: 1fr auto 24px; gap: 8px; align-items: center; padding: 6px 0; }
.intake-row .nm { font-size: 13px; }
.intake-row .por { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.intake-row .kc { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.intake-row .del { color: var(--muted-2); background: none; border: 0; font-size: 16px; line-height: 1; padding: 2px; }
.supp-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.supp-chip { border: 1px dashed var(--line); background: transparent; border-radius: 999px; padding: 6px 11px; font-size: 12px; color: var(--muted); }
.supp-chip:active { border-color: var(--accent-line); color: var(--accent-2); }
.photo-input { display: none; }
.food-item-card .set-input { font-size: 13px; padding: 4px; }
.food-item-card .grid4 { gap: 6px; }

/* ===== 推迟 ===== */
.skip-strip { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; margin-bottom: 12px; border-radius: 16px; background: rgba(255, 176, 32, 0.09); border: 1px solid rgba(255, 176, 32, 0.32); color: var(--text); }
.skip-strip .ico { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 176, 32, 0.16); color: var(--warn); display: grid; place-items: center; font-size: 14px; flex: 0 0 auto; }
.skip-strip .txt { flex: 1; font-size: 12px; color: var(--muted); }
.skip-strip .txt b { display: block; color: var(--text); font-size: 13px; }
.skip-strip .undo { font-size: 12px; color: var(--warn); }

@media (min-width: 720px) {
  #view { padding-left: 24px; padding-right: 24px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .hero h2 { font-size: 27px; }
}
