/* =========================================================
   练吃记 · 训记清爽白底风 × iPhone 17 Pro 昼光液态玻璃 (Daylight Liquid Glass)
   纯白高透卡片 · 3D 动作解剖舞台 · 一级/二级/三级清爽层级
   ========================================================= */
:root {
  --bg: #F4F6FA;
  --bg-grad: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 55%, #EEF2F6 100%);
  /* 昼光白底液态玻璃材质 */
  --glass: rgba(255, 255, 255, 0.88);
  --glass-hi: rgba(255, 255, 255, 0.96);
  --glass-sheet: rgba(255, 255, 255, 0.97);
  --card-2: #F1F5F9;
  --line: rgba(15, 23, 42, 0.08);
  --line-hi: rgba(15, 23, 42, 0.13);
  --liquid-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.95),
    0 6px 20px -6px rgba(15, 23, 42, 0.06),
    0 1px 3px 0 rgba(15, 23, 42, 0.04);
  --liquid-shadow-sm:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.9),
    0 2px 8px -2px rgba(15, 23, 42, 0.06);
  --blur: blur(24px) saturate(180%);
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  /* 训记清爽活力绿与色彩系统 */
  --accent: #10B981;
  --accent-bright: #059669;
  --accent-2: #0284C7;
  --accent-dim: rgba(16, 185, 129, 0.12);
  --protein: #0284C7;
  --carbs: #D97706;
  --fat: #E11D48;
  --danger: #E11D48;
  /* 训记部位色标 */
  --c-chest: #EF4444;
  --c-back: #2563EB;
  --c-shoulder: #9333EA;
  --c-arm: #059669;
  --c-core: #D97706;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --statusbar-clearance: 0px;
  --tabbar-h: 56px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* 彻底适配 iOS 主屏幕全屏白底，消除任何黑边 */
html {
  width: 100%;
  height: 100%;
  min-height: calc(100% + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* iOS 主屏幕 App 的系统状态栏模糊会超出 safe-area，首行另留净空。 */
@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) and (orientation: portrait) {
    :root { --statusbar-clearance: 32px; }
  }
}

/* 昼光纯净白底背景（无模糊光斑干扰文字） */
.liquid-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg-grad);
}
.orb { display: none; }

#app {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: 440px;
  margin: 0 auto;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select {
  font: inherit; color: var(--text);
  background: #F8FAFC;
  border: 1px solid var(--line-hi);
  border-radius: 12px; padding: 11px 13px;
  width: 100%; outline: none; font-size: 16px;
  -webkit-user-select: text; user-select: text;
  transition: border-color .2s, background .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: none; min-height: 82px; line-height: 1.5; }
select option { background: #FFFFFF; color: var(--text); }

/* ---------- 主滚动视图 ---------- */
.view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: calc(max(var(--safe-top), 14px) + 8px + var(--statusbar-clearance)) 15px calc(var(--tabbar-h) + var(--safe-bottom) + 32px);
}
.view::-webkit-scrollbar { display: none; }
.view.fade-in { animation: viewIn .22s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* 顶栏（日期与标题高对比度清晰显示，绝不模糊） */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 2px 14px; gap: 10px;
  position: relative; z-index: 1; isolation: isolate;
}
.page-sub { color: #334155; font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; color: #0F172A; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14.5px; font-weight: 800; color: var(--text-2);
  margin: 16px 2px 8px; letter-spacing: -0.2px;
}
.section-title small { font-size: 13px; color: var(--accent-bright); font-weight: 700; cursor: pointer; }

/* ---------- 纯白昼光液态玻璃卡片 ---------- */
.card {
  background: #FFFFFF;
  border-radius: var(--radius);
  padding: 15px;
  border: 1px solid var(--line);
  box-shadow: var(--liquid-shadow);
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.card.tap { transition: transform .16s var(--ease); cursor: pointer; }
.card.tap:active { transform: scale(0.985); }
.card-title { font-size: 13px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.card-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.big-num { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; color: var(--text); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.gap8 { gap: 8px; }
.green { color: var(--accent-bright); } .red { color: var(--danger); } .blue { color: var(--protein); } .amber { color: var(--carbs); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 44px; padding: 0 14px; border-radius: 13px; font-weight: 700; font-size: 14px;
  background: #FFFFFF;
  color: var(--text);
  border: 1px solid var(--line-hi);
  box-shadow: var(--liquid-shadow-sm);
  transition: transform .15s var(--ease), opacity .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.btn:active { transform: scale(.96); opacity: .9; }
.btn.primary {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border-color: rgba(5, 150, 105, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 16px -4px rgba(16, 185, 129, 0.38);
}
.btn.danger {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.25); color: #E11D48;
}
.btn.ghost {
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.28); color: var(--accent-bright);
}
.btn.block { width: 100%; display: flex; }
.btn.sm { height: 34px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: #F1F5F9; border: 1px solid var(--line);
  color: var(--accent-bright); font-size: 17px; font-weight: 700; flex-shrink: 0;
}
.icon-btn:active { transform: scale(.88); }
.link { color: var(--accent-bright); font-weight: 700; font-size: 14px; }

/* ---------- 训记风部位色标胶囊（白底高对比度） ---------- */
.part-tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 800;
}
.part-胸 { background: rgba(239, 68, 68, 0.12); color: #DC2626; border: 1px solid rgba(239, 68, 68, 0.25); }
.part-背 { background: rgba(37, 99, 235, 0.12); color: #2563EB; border: 1px solid rgba(37, 99, 235, 0.25); }
.part-肩 { background: rgba(147, 51, 234, 0.12); color: #7E22CE; border: 1px solid rgba(147, 51, 234, 0.25); }
.part-手臂 { background: rgba(16, 185, 129, 0.14); color: #059669; border: 1px solid rgba(16, 185, 129, 0.28); }
.part-核心 { background: rgba(217, 119, 6, 0.13); color: #B45309; border: 1px solid rgba(217, 119, 6, 0.26); }
.part-腿 { background: rgba(219, 39, 119, 0.12); color: #BE185D; border: 1px solid rgba(219, 39, 119, 0.25); }
.part-臀 { background: rgba(225, 29, 72, 0.12); color: #BE123C; border: 1px solid rgba(225, 29, 72, 0.25); }
.part-有氧 { background: rgba(2, 132, 199, 0.12); color: #0369A1; border: 1px solid rgba(2, 132, 199, 0.25); }
.part-休 { background: #F1F5F9; color: #64748B; border: 1px solid #CBD5E1; }

/* ---------- 训记同款「周视图 / 月视图」打卡日历（纯白清爽版） ---------- */
.xj-cal-card {
  background: #FFFFFF;
  border: 1px solid var(--line); box-shadow: var(--liquid-shadow);
  border-radius: var(--radius); padding: 12px 11px; margin-bottom: 10px;
}
.xj-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding: 0 2px;
}
.xj-week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
}
.xj-day {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px;
  padding: 6px 2px; border-radius: 11px; position: relative; cursor: pointer;
  min-height: 54px; border: 1px solid transparent;
  background: #F8FAFC;
  transition: all .15s var(--ease);
}
.xj-day.today { background: #ECFDF5; border-color: rgba(16, 185, 129, 0.35); }
.xj-day.sel { background: rgba(16, 185, 129, 0.15); border-color: var(--accent); box-shadow: 0 2px 8px rgba(16, 185, 129, 0.16); }
.xj-day.other-m { opacity: 0.35; background: transparent; }
.xj-day .w { font-size: 10.5px; color: var(--text-3); font-weight: 700; }
.xj-day .d { font-size: 13.5px; font-weight: 800; color: var(--text-2); line-height: 1.1; }
.xj-day.today .d, .xj-day.sel .d { color: var(--text); }
.xj-day .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; margin-top: 2px; }
.xj-day.done .dot { background: var(--accent); box-shadow: 0 0 4px rgba(16, 185, 129, 0.5); }
.xj-mini-tag {
  font-size: 9.5px; font-weight: 800; padding: 1px 4px; border-radius: 4px; line-height: 1.2;
  white-space: nowrap;
}
.xj-cal-foot {
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* ---------- 环形 / 营养素进度条 ---------- */
.ring-wrap { position: relative; flex-shrink: 0; }
.ring-wrap svg { transform: rotate(-90deg); display: block; }
.ring-wrap circle { transition: stroke-dashoffset .7s var(--ease); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

.macro { margin-bottom: 9px; }
.macro:last-child { margin-bottom: 0; }
.macro-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.macro-head b { font-weight: 700; }
.bar { height: 6px; border-radius: 99px; background: #E2E8F0; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; transition: width .6s var(--ease); }

/* ---------- 数据指标网格 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: 13px; padding: 10px;
}
.stat .v { font-size: 18px; font-weight: 800; letter-spacing: -0.4px; color: var(--text); }
.stat .l { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* ---------- 列表 ---------- */
.list {
  background: #FFFFFF;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--liquid-shadow);
  overflow: hidden; margin-bottom: 10px;
}
.li { display: flex; align-items: center; gap: 11px; padding: 12px 14px; position: relative; cursor: pointer; }
.li + .li::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: 1px; background: var(--line); }
.li:active { background: #F1F5F9; }
.li .chev { color: var(--text-3); font-size: 17px; }
.li-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; background: #F8FAFC; border: 1px solid var(--line); flex-shrink: 0; overflow: hidden;
}

.empty { text-align: center; padding: 24px 16px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.empty .e-icon { font-size: 32px; margin-bottom: 6px; }

/* ---------- 训记风动作组数记录表格 ---------- */
.wk-timer {
  font-size: 13.5px; font-weight: 800; color: var(--accent-bright);
  background: var(--accent-dim); border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 5px 11px; border-radius: 99px;
}
.ex-card { padding: 13px 12px 10px; }
.ex-name { font-size: 16px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 6px; }
.ex-meta { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.set-grid {
  display: grid; grid-template-columns: 28px 1fr 1fr 1fr 40px; gap: 6px; align-items: center;
  padding: 4px 2px; border-radius: 10px; margin-top: 2px;
}
.set-grid.head { font-size: 11px; color: var(--text-3); font-weight: 700; text-align: center; padding-top: 8px; }
.set-grid.done { background: rgba(16, 185, 129, 0.10); }
.set-idx {
  width: 24px; height: 24px; border-radius: 6px; background: #F1F5F9;
  margin: 0 auto; font-weight: 800; color: var(--text-2); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.set-grid.done .set-idx { background: var(--accent); color: #FFFFFF; }
.set-prev { text-align: center; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-grid input { height: 34px; padding: 0 4px; text-align: center; font-weight: 800; font-size: 15px; border-radius: 8px; background: #F8FAFC; }
.set-grid.done input { background: transparent; color: var(--accent-bright); border-color: transparent; }
.set-grid.time { grid-template-columns: 28px 1fr 2fr 40px; }
.check {
  width: 34px; height: 34px; border-radius: 9px;
  background: #F1F5F9; border: 1px solid var(--line-hi);
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
}
.check svg { width: 18px; height: 18px; stroke: var(--text-3); stroke-width: 3; fill: none; }
.check.on { background: var(--accent); border-color: var(--accent-bright); }
.check.on svg { stroke: #FFFFFF; }
.add-set {
  width: 100%; margin-top: 8px; height: 34px; border-radius: 9px;
  background: #F8FAFC; border: 1px dashed #CBD5E1;
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
}

.pop { animation: pop .3s var(--ease); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.16); } 100% { transform: scale(1); } }

/* ---------- 组间休息悬浮条 ---------- */
.rest-bar {
  position: fixed; left: 12px; right: 12px; z-index: 45;
  max-width: 416px; margin: 0 auto;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(30px) saturate(200%); -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  border-radius: 18px; padding: 11px 14px; overflow: hidden;
  transition: transform .35s var(--ease), opacity .25s;
}
.rest-bar.hidden { transform: translateY(150%); opacity: 0; pointer-events: none; }
.rest-bar .rest-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .25s linear; }
.rest-time { font-size: 24px; font-weight: 800; color: var(--text); }

/* ---------- 饮食与营养 ---------- */
.date-switch {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--glass-hi); border: 1px solid var(--line);
  box-shadow: var(--liquid-shadow-sm);
  border-radius: 14px; padding: 4px; margin-bottom: 10px;
}
.date-switch button { width: 36px; height: 32px; border-radius: 9px; font-size: 19px; color: var(--accent-bright); }
.date-switch .d { font-weight: 700; font-size: 14px; color: var(--text); }
.meal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 5px; }
.meal-head .t { font-weight: 800; font-size: 14.5px; }
.food-macros { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; margin-top: 3px; color: var(--text-2); }
.food-macros span::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 3px; vertical-align: 1px; }
.food-macros .p::before { background: var(--protein); }
.food-macros .c::before { background: var(--carbs); }
.food-macros .f::before { background: var(--fat); }
.food-macros .na::before { background: #7C3AED; }

/* ---------- 分段控件 / 芯片 ---------- */
.seg {
  display: flex; background: #E2E8F0;
  border: 1px solid var(--line); border-radius: 11px; padding: 2px; gap: 2px;
}
.seg button { flex: 1; height: 30px; border-radius: 9px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.seg button.on { background: #FFFFFF; color: var(--text); box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08); }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 31px; padding: 0 12px; border-radius: 99px;
  background: #FFFFFF; border: 1px solid var(--line-hi);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.chip.on { background: var(--accent); border-color: var(--accent-bright); color: #FFFFFF; font-weight: 800; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25); }

/* ---------- 图表 ---------- */
.chart { width: 100%; display: block; }
.chart text { fill: var(--text-2); font-size: 10px; font-family: inherit; }

/* ---------- 底部弹层 ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  z-index: 100; opacity: 0; transition: opacity .3s var(--ease);
}
.sheet-backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
  max-width: 440px; margin: 0 auto; max-height: 90dvh;
  background: var(--glass-sheet);
  backdrop-filter: blur(36px) saturate(200%); -webkit-backdrop-filter: blur(36px) saturate(200%);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--line-hi);
  box-shadow: 0 -10px 35px rgba(15, 23, 42, 0.12);
  transform: translateY(100%); transition: transform .36s var(--ease);
  display: flex; flex-direction: column; padding-bottom: var(--safe-bottom);
}
.sheet.show { transform: translateY(0); }
.sheet.full { height: 90dvh; }
.sheet-grab { padding: 8px 16px 4px; flex-shrink: 0; touch-action: none; }
.sheet-grab::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 99px; background: #CBD5E1; margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 30px; }
.sheet-head h3 { font-size: 17px; font-weight: 800; color: var(--text); }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 20px; flex: 1; }
.sheet-foot { padding: 10px 16px 12px; flex-shrink: 0; border-top: 1px solid var(--line); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; margin: 0 2px 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hint { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-top: 4px; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; background: #F1F5F9; border: 1px solid var(--line-hi); padding: 10px; border-radius: 12px; white-space: pre-wrap; word-break: break-all; color: #0F172A; -webkit-user-select: text; user-select: text; }

.photo-preview { width: 100%; max-height: 200px; object-fit: cover; border-radius: 14px; margin-bottom: 10px; display: block; }
.ai-item { background: #F8FAFC; border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.ai-item input { padding: 5px 6px; height: 34px; background: #FFFFFF; text-align: center; font-size: 14px; }
.ai-item .nm { text-align: left; font-weight: 700; }

.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(15,23,42,.15); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 纯白毛玻璃贴底导航栏 ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 440px; margin: 0 auto;
  z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 5px 10px var(--safe-bottom);
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.05);
}
.tab {
  flex: 1; height: 46px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-3); font-size: 10px; font-weight: 700;
  transition: all .2s var(--ease);
}
.tab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.tab.on {
  color: var(--accent-bright);
  background: rgba(16, 185, 129, 0.12);
}
.tab:active { transform: scale(.92); }

/* ---------- 提示与弹框（提示显示在底部，避开日期栏和休息倒计时） ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px); z-index: 300;
  transform: translate(-50%, 10px);
  opacity: 0;
  visibility: hidden;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: #0F172A;
  color: #FFFFFF;
  padding: 10px 16px; border-radius: 99px; font-size: 13px; font-weight: 600; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  transition: transform .32s var(--ease), opacity .22s, visibility .22s; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.rest-bar:not(.hidden) ~ .toast { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 110px); }

.alert-wrap { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.35); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); opacity: 0; transition: opacity .2s; }
.alert-wrap.show { opacity: 1; }
.alert { width: 276px; background: #FFFFFF; border: 1px solid var(--line-hi); border-radius: 20px; overflow: hidden; box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18); }
.alert-msg { padding: 18px 16px 14px; text-align: center; font-size: 14px; line-height: 1.5; color: var(--text); }
.alert-msg b { display: block; font-size: 16px; margin-bottom: 4px; }
.alert-btns { display: flex; border-top: 1px solid var(--line); }
.alert-btns button { flex: 1; height: 44px; font-size: 15px; color: var(--protein); }
.alert-btns button + button { border-left: 1px solid var(--line); font-weight: 700; }
.alert-btns button.destructive { color: var(--danger); }

/* ---------- 专用小组件 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  border-radius: 6px; font-size: 11px; font-weight: 700;
  background: var(--accent-dim); color: var(--accent-bright);
}
.pill.warn { background: rgba(217, 119, 6, 0.12); color: var(--carbs); }
.pill.danger { background: rgba(225, 29, 72, 0.10); color: var(--danger); }
.pill.blue { background: rgba(2, 132, 199, 0.12); color: var(--protein); }
.pill.green { background: rgba(16, 185, 129, 0.14); color: var(--accent-bright); }

.split-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.split-scroll::-webkit-scrollbar { display: none; }
.split-day {
  flex: 0 0 108px;
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; cursor: pointer;
}
.split-day.active {
  background: #ECFDF5;
  border-color: var(--accent);
}
.split-day .d-code { font-size: 11px; font-weight: 800; color: var(--text-3); display: flex; justify-content: space-between; }
.split-day.active .d-code { color: var(--accent-bright); }
.split-day .d-focus { font-size: 14.5px; font-weight: 800; margin-top: 4px; color: var(--text); }
.split-day .d-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.patch-box {
  background: linear-gradient(145deg, #F0F9FF, #E0F2FE);
  border: 1px solid rgba(2, 132, 199, 0.25);
  box-shadow: var(--liquid-shadow-sm);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.warn-box {
  background: #FFF1F2;
  border: 1px solid rgba(225, 29, 72, 0.25);
  border-radius: 15px; padding: 12px 14px; margin-bottom: 10px;
}
.milestone { position: relative; padding-left: 18px; margin-bottom: 14px; }
.milestone::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: -14px; width: 2px; background: var(--line-hi); }
.milestone:last-child::before { display: none; }
.milestone .m-dot { position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.milestone.on .m-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25); }

/* ---------- 一级 / 二级 / 三级 层级导航系统 ---------- */
.subnav {
  display: flex; align-items: center; justify-content: space-between;
  background: #FFFFFF;
  border: 1px solid var(--line-hi);
  box-shadow: var(--liquid-shadow-sm);
  border-radius: 16px;
  padding: 9px 12px;
  margin-bottom: 14px;
  gap: 8px;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent-bright); font-weight: 800; font-size: 14px;
  padding: 4px 9px 4px 5px; border-radius: 9px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  white-space: nowrap;
}
.back-btn:active { transform: scale(0.95); }
.subnav-title {
  font-size: 15.5px; font-weight: 800; color: var(--text);
  text-align: center; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lvl-tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.2px;
  white-space: nowrap;
}
.lvl-1 { background: rgba(16, 185, 129, 0.14); color: #059669; border: 1px solid rgba(16, 185, 129, 0.28); }
.lvl-2 { background: rgba(2, 132, 199, 0.13); color: #0284C7; border: 1px solid rgba(2, 132, 199, 0.28); }
.lvl-3 { background: rgba(147, 51, 234, 0.13); color: #7E22CE; border: 1px solid rgba(147, 51, 234, 0.28); }

.view.push-in { animation: pushIn .22s var(--ease); }
@keyframes pushIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* 一级页面大入口行 */
.entry-li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px; position: relative; cursor: pointer;
}
.entry-li + .entry-li::before {
  content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--line);
}
.entry-li:active { background: #F1F5F9; }
.entry-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; background: #F8FAFC;
  border: 1px solid var(--line-hi); flex-shrink: 0; overflow: hidden;
}
.entry-val {
  font-size: 13px; font-weight: 700; color: var(--accent-bright);
  white-space: nowrap;
}

/* ---------- 3D 动作解剖动画引擎样式 ---------- */
.ex3d-stage {
  position: relative;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #FFFFFF 0%, #F1F5F9 72%, #E2E8F0 100%);
  border: 1px solid var(--line-hi);
  box-shadow: inset 0 1px 0 #FFFFFF, 0 4px 14px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  touch-action: none;
}
.ex3d-canvas {
  width: 100%;
  height: 250px;
  display: block;
  cursor: grab;
}
.ex3d-canvas:active { cursor: grabbing; }
.ex3d-credit { margin: 0 4px 10px; font-size: 10px; color: #899198; }
.ex3d-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ex3d-hud-top {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: none;
}
.ex3d-badge {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-hi);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11px; font-weight: 800; color: var(--text);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.ex3d-hud-bot {
  position: absolute; bottom: 8px; left: 10px; right: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.ex3d-cam-bar {
  display: flex; gap: 4px; background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 3px; border-radius: 10px; border: 1px solid var(--line-hi);
}
.ex3d-cam-btn {
  padding: 3px 8px; border-radius: 7px; font-size: 11px; font-weight: 700; color: var(--text-2);
}
.ex3d-cam-btn.on {
  background: var(--accent); color: #FFFFFF;
}
.ex3d-mini {
  width: 44px; height: 44px; border-radius: 11px;
  background: radial-gradient(circle at 50% 35%, #FFFFFF 0%, #EFF6FF 100%);
  border: 1px solid var(--line-hi);
  flex-shrink: 0; display: block;
}
.ex3d-btn-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 8px;
  background: rgba(2, 132, 199, 0.10);
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: #0284C7; font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
