:root {
  --ios-blue:#007AFF; --ios-green:#34C759; --ios-orange:#FF9500; --ios-red:#FF3B30; --ios-teal:#5AC8FA;
  --bg0:#000000; --bg1:#0a0a0f; --bg2:#111118; --bg3:#1c1c24; --glass:rgba(255,255,255,0.05);
  --text1:#ffffff; --text2:rgba(255,255,255,0.7); --text3:rgba(255,255,255,0.4);
  --mono:'JetBrains Mono', monospace; --sans:'Outfit', sans-serif;
  --card-bg:rgba(255,255,255,0.05);
  --border-light:rgba(255,255,255,0.1);
  --ring-bg:rgba(255,255,255,0.05);
  --net-bg:rgba(90,200,250,0.1);
}
[data-theme="light"] {
  --bg0:#f5f5f7; --bg1:#e8e8ed; --bg2:#ffffff; --bg3:#f0f0f2; --glass:rgba(0,0,0,0.03);
  --text1:#000000; --text2:rgba(0,0,0,0.7); --text3:rgba(0,0,0,0.4);
  --card-bg:rgba(0,0,0,0.02);
  --border-light:rgba(0,0,0,0.1);
  --ring-bg:rgba(0,0,0,0.05);
  --net-bg:rgba(0,122,255,0.1);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent;}
body{ background:var(--bg0); color:var(--text1); font-family:var(--sans); padding-bottom:120px; overflow-x:hidden; transition:background 0.3s, color 0.3s; }
.hidden{ display:none !important; }
.app-container{ max-width:480px; margin:0 auto; padding:20px; }
.header{ display:flex; flex-direction:column; align-items:flex-start; margin-bottom:20px; gap:8px; }
.header h1{ font-weight:200; font-size:24px; letter-spacing:-1px; }
.btn-group{ display:flex; gap:5px; flex-wrap:nowrap; justify-content:flex-start; }
.icon-btn{ background:var(--glass); border:1px solid var(--border-light); padding:6px 8px; border-radius:12px; color:var(--text2); font-size:11px; cursor:pointer; transition:0.2s; flex-shrink:1; white-space:nowrap; }
.timeline{ display:flex; gap:10px; overflow-x:auto; padding-bottom:15px; margin-bottom:10px; scrollbar-width:none; }
.time-btn{ flex:0 0 55px; height:70px; background:var(--glass); border-radius:18px; display:flex; flex-direction:column; align-items:center; justify-content:center; cursor:pointer; border:1px solid transparent; position:relative; }
.time-btn.active{ background:var(--ios-blue); border-color:var(--ios-teal); }
.t-date{ font-family:var(--mono); font-size:18px; }
.t-day{ font-size:10px; opacity:0.6; }
.t-mode{ font-size:8px; margin-top:2px; color:var(--ios-teal); opacity:0.8; }
.dashboard{ background:var(--glass); border-radius:32px; padding:24px; border:1px solid var(--border-light); backdrop-filter:blur(20px); margin:10px 0 20px; position:relative; }
.weight-badge{ position:absolute; top:20px; right:20px; background:rgba(52,199,89,0.1); padding:6px 12px; border-radius:20px; border:1px solid rgba(52,199,89,0.2); font-family:var(--mono); font-size:12px; color:var(--ios-green); cursor:pointer; }
.ring-box{ width:150px; height:150px; margin:0 auto 20px; position:relative; }
.ring-svg{ transform:rotate(-90deg); width:150px; height:150px; }
.ring-bg{ fill:none; stroke:var(--ring-bg); stroke-width:8; }
.ring-fill{ fill:none; stroke:url(#grad); stroke-width:10; stroke-linecap:round; transition:stroke-dashoffset 0.8s ease; }
.ring-info{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.ring-val{ font-family:var(--mono); font-size:32px; font-weight:200; }
.macro-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.macro-chip{ background:var(--card-bg); padding:10px; border-radius:18px; border:1px solid var(--border-light); }
.mc-label{ font-size:9px; color:var(--text3); text-transform:uppercase; margin-bottom:4px; }
.mc-val{ font-family:var(--mono); font-size:14px; }
.mc-bar{ height:3px; background:rgba(255,255,255,0.05); border-radius:2px; margin:6px 0; overflow:hidden; }
.mc-fill{ height:100%; transition:width 0.5s; }
.section-title{ font-size:11px; color:var(--text3); margin:24px 0 12px 4px; letter-spacing:1px; text-transform:uppercase; display:flex; justify-content:space-between; align-items:center; }
.edit-meal-icon { font-size:12px; cursor:pointer; color:var(--ios-teal); padding:4px 8px; border-radius:12px; background:rgba(90,200,250,0.1); }
.card{ background:var(--card-bg); border-radius:22px; padding:16px; margin-bottom:12px; display:flex; flex-direction:column; cursor:pointer; border:1px solid transparent; transition:0.2s; position:relative;}
.card-top{ display:flex; align-items:center; width:100%; }
.card.checked{ background:rgba(52,199,89,0.06); border-color:rgba(52,199,89,0.2); }
.cb-circle{ width:22px; height:22px; border-radius:50%; border:2px solid var(--text3); margin-right:16px; position:relative; flex-shrink:0; cursor:pointer; z-index:10; }
.card.checked .cb-circle{ background:var(--ios-green); border-color:var(--ios-green); }
.card.checked .cb-circle::after{ content:'✓'; color:#fff; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:12px; }
.card-info{ flex:1; }
.card-info h3{ font-size:15px; font-weight:400; margin-bottom:2px; }
.card-info p{ font-size:11px; color:var(--text3); line-height:1.4; }
.ing-tag { display:inline-block; background:rgba(255,255,255,0.05); padding:2px 6px; border-radius:4px; margin-right:4px; margin-top:4px; font-size:10px; color:var(--ios-teal); }
.card-macro { display:flex; gap:8px; margin-top:10px; padding-top:8px; border-top:1px solid var(--border-light); font-family:var(--mono); font-size:10px; }
.macro-tag { padding:2px 8px; border-radius:6px; font-size:10px; }
.macro-tag.carb { background:rgba(0,122,255,0.12); color:var(--ios-blue); }
.macro-tag.prot { background:rgba(52,199,89,0.12); color:var(--ios-green); }
.macro-tag.fat  { background:rgba(255,149,0,0.12);  color:var(--ios-orange); }
.train-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.train-tag { background: rgba(90,200,250,0.2); color: var(--ios-teal); padding: 2px 8px; border-radius: 12px; font-size: 10px; }
.overlay{ position:fixed; inset:0; background:rgba(0,0,0,0.9); backdrop-filter:blur(25px); z-index:2000; display:flex; align-items:center; justify-content:center; padding:20px; }
.panel{ background:var(--bg2); width:100%; max-width:480px; border-radius:32px; padding:28px; border:1px solid var(--border-light); box-shadow:0 20px 40px rgba(0,0,0,0.4); max-height:85vh; overflow-y:auto; }
.ios-input{ width:100%; background:var(--bg3); border:1px solid var(--border-light); padding:16px; border-radius:18px; color:var(--text1); font-size:32px; text-align:center; outline:none; font-family:var(--mono); }
select.ios-input { -webkit-appearance: none; appearance: none; text-align-last: center; }
.primary-btn{ width:100%; background:var(--ios-blue); border:none; padding:18px; border-radius:18px; color:#fff; font-weight:600; font-size:16px; cursor:pointer; }
.secondary-btn{ background:rgba(255,255,255,0.1); border:1px solid var(--border-light); }
.tag-container { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0 25px; }
.tag-chip { background: rgba(255,255,255,0.05); color: var(--text2); padding: 8px 16px; border-radius: 20px; font-size: 13px; border: 1px solid transparent; transition: 0.2s; cursor: pointer; }
.tag-chip.active { background: rgba(0,122,255,0.15); color: var(--ios-blue); border-color: rgba(0,122,255,0.4); font-weight: 500; }
.quick-adj { display: flex; align-items: center; gap: 12px; margin-bottom: 25px; }
.history-scroll { max-height: 400px; overflow-y: auto; margin-top: 10px; }
.history-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--border-light); cursor: pointer; }
.footer-check{ position:fixed; bottom:30px; left:50%; transform:translateX(-50%); width:calc(100% - 40px); max-width:440px; }
.confirm-btn{ width:100%; padding:18px; border-radius:20px; border:none; font-weight:600; font-size:15px; background:var(--glass); color:var(--text3); transition:0.3s; }
.confirm-btn.ready{ background:var(--ios-green); color:#fff; }
.net-cal { text-align: center; margin-top: 12px; font-family: var(--mono); font-size: 13px; background: var(--net-bg); padding: 6px 12px; border-radius: 20px; display: inline-block; width: auto; margin-left: auto; margin-right: auto; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin: 15px 0; font-size: 14px; color: var(--text2); cursor: pointer; }
.tab-bar { display: flex; gap: 8px; border-bottom: 1px solid var(--border-light); margin-bottom: 20px; flex-wrap:wrap; }
.tab-btn { background: none; border: none; padding: 8px 16px; font-size: 14px; color: var(--text3); cursor: pointer; transition: 0.2s; }
.tab-btn.active { color: var(--ios-blue); border-bottom: 2px solid var(--ios-blue); }
.goal-progress { margin: 15px 0; background: var(--card-bg); border-radius: 16px; padding: 12px; }
.progress-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin: 8px 0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--ios-green); width: 0%; transition: width 0.3s; }
.ingredient-item { display: flex; gap: 8px; margin: 8px 0; align-items: center; }
.ingredient-item input { flex: 1; background: var(--bg3); border: 1px solid var(--border-light); padding: 8px; border-radius: 12px; color: var(--text1); }
.ingredient-item button { background: var(--ios-red); border: none; padding: 4px 10px; border-radius: 8px; color: white; cursor: pointer; }
.suggestion-card { background: rgba(52,199,89,0.1); border-left: 3px solid var(--ios-green); padding: 12px; margin: 15px 0; border-radius: 12px; }
.macro-input-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.macro-input-group input { background: var(--bg3); border: 1px solid var(--border-light); padding: 8px; border-radius: 12px; color: var(--text1); text-align: center; }
.jump-date { display: flex; gap: 8px; margin-bottom: 15px; align-items: center; }
.jump-date input { flex: 1; font-size: 14px; padding: 8px; }
.history-edit-btn { background: none; border: none; color: var(--ios-blue); cursor: pointer; font-size: 12px; margin-left: 8px; padding: 4px 6px; border-radius: 12px; background: rgba(0,122,255,0.1); }
.danger-btn { background: var(--ios-red); color: white; border: none; margin-top: 15px; }

/* 全局导航栏（已移到页面外部） */
.tab-nav {
  position: sticky;
  top: 0;
  background: var(--bg0);
  z-index: 200;
  display: flex;
  justify-content: center;
  border-bottom: 2px solid var(--border-light);
  padding: 0 20px;
  max-width: 480px;
  margin: 0 auto;
  box-sizing: border-box;
  width: 100%;
}
.tab-nav-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}
.tab-nav-btn.active {
  color: var(--ios-blue);
  border-bottom-color: var(--ios-blue);
  font-weight: 500;
}

/* 页面视图 */
.page-view { padding-bottom:120px; }
.page-view.hidden { display:none !important; }
#page-main { display:block; }
/* 运动子标签 */
.sport-tabs { display:flex; gap:8px; margin-bottom:20px; }
.sport-tab { flex:1; background:var(--glass); border:1px solid var(--border-light); padding:10px 4px; border-radius:14px; font-size:12px; color:var(--text2); cursor:pointer; transition:0.2s; }
.sport-tab.active { background:rgba(0,122,255,0.12); color:var(--ios-blue); border-color:rgba(0,122,255,0.3); font-weight:500; }
.stab-content { }
/* 训练session */
.exercise-block { background:var(--card-bg); border-radius:18px; padding:14px; margin-bottom:12px; border:1px solid var(--border-light); }
.exercise-block-title { font-size:14px; font-weight:500; margin-bottom:10px; display:flex; justify-content:space-between; align-items:center; }
.set-row { display:grid; grid-template-columns:32px 1fr 1fr 40px; gap:8px; align-items:center; margin-bottom:6px; font-size:12px; }
.set-row input { background:var(--bg3); border:1px solid var(--border-light); padding:6px; border-radius:10px; color:var(--text1); text-align:center; font-size:13px; }
.set-row .set-num { color:var(--text3); text-align:center; font-family:var(--mono); }
.set-done-btn { background:none; border:1px solid var(--border-light); border-radius:8px; padding:4px 8px; cursor:pointer; font-size:13px; color:var(--text3); }
.set-done-btn.done { background:var(--ios-green); border-color:var(--ios-green); color:#fff; }
.pr-badge { font-size:9px; background:rgba(255,149,0,0.15); color:var(--ios-orange); padding:2px 6px; border-radius:8px; margin-left:6px; }
/* 动作库 */
.category-block { background:var(--card-bg); border-radius:18px; margin-bottom:12px; border:1px solid var(--border-light); overflow:hidden; }
.category-header { display:flex; justify-content:space-between; align-items:center; padding:14px 16px; cursor:pointer; }
.category-header span { font-size:14px; font-weight:500; }
.category-exercises { padding:0 16px 14px; }
.exercise-item { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid var(--border-light); font-size:13px; }
.exercise-item:last-child { border-bottom:none; }
/* 模板 */
.template-card { background:var(--card-bg); border-radius:18px; padding:16px; margin-bottom:12px; border:1px solid var(--border-light); cursor:pointer; }
.template-card h3 { font-size:14px; font-weight:500; margin-bottom:6px; }
.template-card p { font-size:11px; color:var(--text3); }
/* 历史记录卡 */
.workout-history-card { background:var(--card-bg); border-radius:18px; padding:14px; margin-bottom:10px; border:1px solid var(--border-light); }
