/* 代谢教练 H5 · 极简骨架样式（沿用 supplement-plan 视觉语言） */

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f7f8fa; color: #1f2329; -webkit-font-smoothing: antialiased;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: #fff; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: #fff; padding: 14px 20px; border-bottom: 1px solid #eaecf0;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .brand { font-size: 17px; font-weight: 600; color: #ff6b35; }
.topbar .nick { font-size: 13px; color: #6b7280; }

/* ============ 视图 ============ */
.view { display: none; padding: 20px; }
.view.active { display: block; }

h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
h3 { font-size: 15px; font-weight: 600; margin: 14px 0 8px; color: #374151; }
.lead { font-size: 14px; color: #4b5563; line-height: 1.6; margin-bottom: 20px; }
.hint { font-size: 12px; color: #9ca3af; margin-top: 6px; line-height: 1.5; }

/* ============ 卡片 ============ */
.card {
  background: #fff; border: 1px solid #eaecf0; border-radius: 12px;
  padding: 16px; margin-bottom: 14px;
}
.card.featured {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
}

/* ============ 主分卡片 ============ */
.score-hero {
  text-align: center; padding: 28px 16px;
  background: linear-gradient(135deg, #ff9500, #ff6b35);
  color: #fff; border-radius: 16px; margin-bottom: 16px;
}
.score-hero .score-num {
  font-size: 56px; font-weight: 700; line-height: 1;
}
.score-hero .score-label { font-size: 13px; margin-top: 6px; opacity: 0.9; }

.score-sub {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px;
}
.score-sub .item {
  background: #f9fafb; border-radius: 10px; padding: 12px; text-align: center;
}
.score-sub .item .v { font-size: 22px; font-weight: 600; color: #ff6b35; }
.score-sub .item .l { font-size: 12px; color: #6b7280; margin-top: 2px; }

/* ============ 三餐 Tab ============ */
.meal-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px;
}
.meal-tab {
  background: #f3f4f6; border-radius: 10px; padding: 14px 8px;
  text-align: center; cursor: pointer; transition: all 0.15s;
  border: 2px solid transparent;
}
.meal-tab .name { font-size: 14px; font-weight: 500; }
.meal-tab .count { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.meal-tab.active { background: #fff; border-color: #ff9500; color: #ff6b35; }
.meal-tab.done { background: #fff; border-color: #10b981; }
.meal-tab.done .count { color: #10b981; }

/* ============ 食物选择 ============ */
.search-box {
  width: 100%; padding: 12px 16px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 15px; margin-bottom: 12px;
}
.search-box:focus { outline: 2px solid #ff9500; border-color: transparent; }

.food-category { margin-bottom: 12px; border: 1px solid #e5e7eb; border-radius: 8px; }
.food-category summary {
  padding: 12px 16px; font-weight: 500; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px;
}
.food-category summary::-webkit-details-marker { display: none; }
.food-category summary::before {
  content: "▸"; margin-right: 8px; transition: transform 0.2s; color: #9ca3af;
}
.food-category[open] summary::before { transform: rotate(90deg); }
.food-list { padding: 0 16px 12px; }
.food-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 0;
  border-top: 1px solid #f3f4f6; cursor: pointer;
}
.food-item .name { flex: 1; font-size: 14px; }
.food-item .lamp {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.lamp.green { background: #10b981; }
.lamp.yellow { background: #f59e0b; }
.lamp.red { background: #ef4444; }
.food-item .portion-hint { font-size: 12px; color: #9ca3af; }
.food-item .add-btn {
  background: #ff9500; color: #fff; border: 0; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}

/* ============ 餐盘 ============ */
.tray {
  background: #fff7ed; border-radius: 10px; padding: 12px; margin-bottom: 14px;
}
.tray-empty {
  color: #9ca3af; text-align: center; padding: 18px; font-size: 13px;
}
.tray-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #ffedd5;
}
.tray-item:last-child { border-bottom: 0; }
.tray-item .name { flex: 1; font-size: 14px; }
.tray-item .grams {
  width: 70px; padding: 4px 8px; border: 1px solid #fdba74; border-radius: 6px;
  font-size: 13px; text-align: center;
}
.tray-item .remove {
  background: #fef2f2; color: #ef4444; border: 0; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}

/* ============ 替换建议 ============ */
.replacement {
  background: #f9fafb; border-left: 3px solid #ff9500;
  padding: 12px; margin-bottom: 10px; border-radius: 6px;
}
.replacement .title { font-size: 13px; color: #ff6b35; font-weight: 500; margin-bottom: 4px; }
.replacement .arrow { font-size: 14px; line-height: 1.6; }
.replacement .reason { font-size: 12px; color: #6b7280; margin-top: 6px; }

/* ============ 按钮 ============ */
.btn-primary, .btn-secondary {
  width: 100%; padding: 14px; border: 0; border-radius: 10px;
  font-size: 16px; font-weight: 500; cursor: pointer; margin-top: 12px;
}
.btn-primary {
  background: linear-gradient(135deg, #ff9500, #ff6b35);
  color: #fff;
}
.btn-secondary {
  background: #f3f4f6; color: #4b5563;
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============ 表单 ============ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.form-input {
  width: 100%; padding: 12px 16px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 16px; background: #fff;
}
.form-input:focus { outline: 2px solid #ff9500; border-color: transparent; }

.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-row label {
  flex: 1; min-width: 100px; display: flex; align-items: center; justify-content: center;
  padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 8px; cursor: pointer;
  font-size: 14px; user-select: none;
}
.radio-row input { display: none; }
.radio-row input:checked + span,
.radio-row label.checked { background: #fff7ed; border-color: #ff9500; color: #ff6b35; }

/* ============ 未开通页 ============ */
.locked-view {
  text-align: center; padding: 60px 24px;
}
.locked-icon { font-size: 64px; margin-bottom: 20px; }
.locked-title { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
.locked-body {
  background: #fff7ed; border-radius: 12px; padding: 20px;
  color: #6b7280; font-size: 14px; line-height: 1.7;
  margin: 20px 0;
}
.locked-body strong { color: #ff6b35; }

/* ============ 趋势图 ============ */
.trends {
  background: #f9fafb; border-radius: 10px; padding: 16px; margin-top: 14px;
}
.trends .trend-empty {
  text-align: center; color: #9ca3af; font-size: 13px; padding: 24px;
}
.trends-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-top: 1px solid #f3f4f6; font-size: 13px;
}
.trends-row:first-child { border-top: 0; }
.trends-row .date { width: 80px; color: #6b7280; }
.trends-row .score-bar {
  flex: 1; background: #e5e7eb; border-radius: 6px; height: 8px; overflow: hidden;
}
.trends-row .score-bar-fill {
  height: 100%; background: linear-gradient(90deg, #ff9500, #ff6b35);
}
.trends-row .score-num { width: 36px; text-align: right; font-weight: 500; }

/* ============ Toast ============ */
.toast {
  position: fixed; top: 30%; left: 50%; transform: translateX(-50%);
  background: rgba(31, 35, 41, 0.92); color: #fff;
  padding: 12px 20px; border-radius: 10px; font-size: 14px;
  z-index: 1000; max-width: 80%; text-align: center;
  opacity: 0; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

/* ============ 顶部状态条（API 失败兜底） ============ */
.banner-warn {
  background: #fffbeb; border-bottom: 1px solid #fcd34d;
  color: #92400e; padding: 8px 16px; font-size: 12px; text-align: center;
}
