/* =========================================================
 * style.css — 温暖清新风 · 微信小程序交互原型
 * 暖米白底 + 叶绿主色 + 琥珀点缀
 * ========================================================= */

:root {
  --bg: #f6f1e7;
  --bg-soft: #fbf7ee;
  --card: #ffffff;
  --ink: #2f2b26;
  --ink-2: #8a8273;
  --ink-3: #b8b09f;
  --line: #ece5d8;
  --green: #5f9d6b;
  --green-deep: #3d7a4a;
  --green-soft: #eaf2e6;
  --amber: #e6a23c;
  --amber-soft: #faf0dc;
  --rose: #d97b6a;
  --rose-soft: #fbe9e3;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 18px -6px rgba(120, 105, 80, 0.18);
  --shadow-lift: 0 12px 30px -8px rgba(120, 105, 80, 0.28);

  /* 响应式尺度：随视口缩放 */
  --phone-w: 390px;                      /* 手机壳逻辑宽 */
  --phone-h: 844px;                      /* 手机壳逻辑高 */
  --phone-zoom: 1;                       /* 桌面矮窗口自动缩放 */
  --pad: clamp(12px, 4vw, 16px);         /* 页面内边距 */
  --gap: clamp(12px, 5vw, 24px);         /* 卡片间距 */
  --fs-h2: clamp(20px, 6vw, 24px);       /* 大标题 */
  --fs-num: clamp(24px, 7vw, 34px);      /* 大数字 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", -apple-system, system-ui, sans-serif;
  color: var(--ink);
  background: #efe7d8;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select { font-family: inherit; }

/* ---------- 舞台 & 手机壳 ---------- */
.stage {
  height: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  padding: clamp(12px, 3vw, 32px);
  background:
    radial-gradient(1200px 600px at 70% -10%, #efe3c8 0%, transparent 60%),
    radial-gradient(900px 500px at 10% 110%, #dde8d6 0%, transparent 55%),
    linear-gradient(160deg, #f2eadb, #e8e2d3);
}

.desk-hint {
  display: none;
  max-width: min(300px, 24vw);
  color: #6d6655;
  line-height: 1.7;
  font-size: 14px;
  flex-shrink: 0;
}
.desk-hint b { color: #4d4638; font-size: 18px; }
.desk-hint__logo {
  font-size: 40px;
  line-height: 1;
  display: block;
  margin-bottom: 12px;
}
.desk-hint p { margin-top: 6px; font-size: 13px; }

.phone {
  position: relative;
  width: var(--phone-w);
  height: var(--phone-h);
  background: var(--bg-soft);
  border-radius: calc(var(--phone-w) * 0.118);
  box-shadow: 0 30px 70px -20px rgba(80, 65, 40, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  zoom: var(--phone-zoom);
}

.phone__notch {
  position: absolute;
  top: calc(var(--phone-h) * 0.014);
  left: 50%;
  transform: translateX(-50%);
  width: calc(var(--phone-w) * 0.323);
  height: calc(var(--phone-h) * 0.0355);
  background: #1c1a16;
  border-radius: 20px;
  z-index: 50;
}

/* ---------- 状态栏 ---------- */
.statusbar {
  height: calc(44px + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 28px 6px;
  font-size: 13px;
  font-weight: 600;
  color: #2f2b26;
  background: transparent;
  position: relative;
  z-index: 40;
}
.statusbar__icons { display: flex; gap: 4px; font-size: 11px; letter-spacing: 1px; }

/* ---------- 导航栏 ---------- */
.navbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  padding: 0 16px;
}
.navbar__title { font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }
.navbar__capsule {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
}

/* ---------- 页面 ---------- */
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--pad) calc(20px + var(--safe-bottom));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.screen::-webkit-scrollbar { width: 0; }

/* ---------- 底部 Tab ---------- */
.tabbar {
  height: calc(68px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  padding-bottom: calc(8px + var(--safe-bottom));
}
.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  transition: color 0.25s, transform 0.15s;
}
.tabbar__item:active { transform: scale(0.92); }
.tabbar__item.is-active { color: var(--green-deep); }

.tabbar__label { font-size: 10px; letter-spacing: 0.5px; }

.tabbar__icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  position: relative;
}
/* 首页：小房子 */
.tabbar__icon--home::before {
  content: "";
  position: absolute;
  left: 4px; top: 9px;
  width: 16px; height: 13px;
  border: 2.4px solid currentColor;
  border-top: none;
  border-radius: 2px 2px 4px 4px;
}
.tabbar__icon--home::after {
  content: "";
  position: absolute;
  left: 8px; top: 4px;
  width: 8px; height: 9px;
  border-top: 2.4px solid currentColor;
  border-left: 2.4px solid currentColor;
  transform: rotate(45deg);
  border-radius: 2px;
}
/* 食谱：碗 */
.tabbar__icon--menu::before {
  content: "";
  position: absolute;
  left: 3px; top: 8px;
  width: 18px; height: 9px;
  border: 2.4px solid currentColor;
  border-radius: 0 0 10px 10px;
}
.tabbar__icon--menu::after {
  content: "";
  position: absolute;
  left: 6px; top: 5px;
  width: 12px; height: 2.6px;
  background: currentColor;
  border-radius: 2px;
}
/* 打卡：日历 */
.tabbar__icon--record::before {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  border: 2.4px solid currentColor;
  border-radius: 5px;
}
.tabbar__icon--record::after {
  content: "";
  position: absolute;
  left: 7px; top: 8px;
  width: 3px; height: 3px;
  box-shadow: 0 0 0 2.2px currentColor, 5px 0 0 0 currentColor, 0 5px 0 0 currentColor, 5px 5px 0 0 currentColor;
  border-radius: 50%;
}
/* 我的：人 */
.tabbar__icon--mine::before {
  content: "";
  position: absolute;
  left: 8px; top: 3px;
  width: 8px; height: 8px;
  border: 2.4px solid currentColor;
  border-radius: 50%;
}
.tabbar__icon--mine::after {
  content: "";
  position: absolute;
  left: 4px; top: 13px;
  width: 16px; height: 9px;
  border: 2.4px solid currentColor;
  border-radius: 8px 8px 6px 6px;
}

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card--soft { background: var(--green-soft); box-shadow: none; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-deep) 100%);
  color: #fff;
  box-shadow: 0 8px 18px -6px rgba(93, 155, 107, 0.55);
}
.btn--amber {
  background: linear-gradient(135deg, #f0b45a 0%, var(--amber) 100%);
  color: #fff;
  box-shadow: 0 8px 18px -6px rgba(230, 162, 60, 0.5);
}
.btn--ghost {
  background: var(--green-soft);
  color: var(--green-deep);
}
.btn--line {
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--ink-2);
}
.btn--block { display: flex; }
.btn--lg { padding: 15px; font-size: 16px; border-radius: 16px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 4px 10px;
}
.section-title h3 { font-size: 16px; font-weight: 700; }
.section-title a, .section-title span.more { font-size: 12px; color: var(--ink-3); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}
.tag--green { background: var(--green-soft); color: var(--green-deep); }
.tag--amber { background: var(--amber-soft); color: #b07616; }
.tag--rose { background: var(--rose-soft); color: var(--rose); }

.hr { height: 1px; background: var(--line); margin: 12px 0; }

/* 顶部问候 */
.greet {
  margin: 6px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.greet h2 { font-size: var(--fs-h2); font-weight: 800; letter-spacing: 0.5px; }
.greet .sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.greet .avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a8c99a, #5f9d6b);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  box-shadow: var(--shadow);
}

/* 连续打卡横幅 */
.streak {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(120deg, #5f9d6b, #7ab07f 60%, #8fc08b);
  border-radius: var(--radius);
  padding: 16px;
  color: #fff;
  margin-bottom: 12px;
  box-shadow: 0 10px 24px -8px rgba(93, 155, 107, 0.6);
  position: relative;
  overflow: hidden;
}
.streak::after {
  content: "🔥";
  position: absolute;
  right: -8px;
  bottom: -12px;
  font-size: 64px;
  opacity: 0.18;
  transform: rotate(-12deg);
}
.streak__num { font-size: var(--fs-num); font-weight: 800; line-height: 1; }
.streak__label { font-size: 13px; opacity: 0.95; }
.streak__right { margin-left: auto; text-align: right; font-size: 12px; opacity: 0.9; }

/* 今日进度 */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.progress-cell {
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 4px;
  text-align: center;
}
.progress-cell .ring-num { font-size: 16px; font-weight: 800; color: var(--green-deep); }
.progress-cell .ring-label { font-size: 10px; color: var(--ink-2); margin-top: 3px; }

/* 圆形进度 */
.ring {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 6px;
}
.ring svg { transform: rotate(-90deg); }
.ring .ring__val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--green-deep);
}

/* 今日饮食计划 */
.meal-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: transform 0.15s, opacity 0.2s;
  cursor: pointer;
}
.meal-card:active { transform: scale(0.98); }
.meal-card.is-done { opacity: 0.62; }
.meal-card__icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--green-soft);
  flex-shrink: 0;
}
.meal-card__info { flex: 1; min-width: 0; }
.meal-card__name { font-size: 15px; font-weight: 700; }
.meal-card__desc { font-size: 11px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-card__check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  font-size: 13px;
  font-weight: 800;
  transition: all 0.2s;
}
.meal-card.is-done .meal-card__check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* 快捷操作 */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s;
}
.quick-item:active { transform: scale(0.97); }
.quick-item__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.quick-item__name { font-size: 13px; font-weight: 700; }
.quick-item__desc { font-size: 10px; color: var(--ink-2); margin-top: 2px; }

/* ---------- 食谱页 ---------- */
.level-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 4px calc(var(--pad) * -1) 14px;
  padding: 0 var(--pad);
  scrollbar-width: none;
}
.level-tabs::-webkit-scrollbar { display: none; }
.level-tab {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--card);
  border: 1.5px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}
.level-tab.is-active {
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px -4px rgba(93, 155, 107, 0.55);
}

.day-picker {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.day-picker::-webkit-scrollbar { display: none; }
.day-chip {
  flex-shrink: 0;
  width: 44px;
  padding: 8px 0;
  text-align: center;
  border-radius: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  transition: all 0.2s;
}
.day-chip.is-today { border-color: var(--amber); }
.day-chip.is-active {
  background: var(--green-deep);
  border-color: var(--green-deep);
}
.day-chip__week { font-size: 11px; color: var(--ink-2); }
.day-chip.is-active .day-chip__week { color: rgba(255,255,255,0.75); }
.day-chip__date { font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 1px; }
.day-chip.is-active .day-chip__date { color: #fff; }
.day-chip.is-today:not(.is-active) .day-chip__date { color: #b07616; }

.menu-block { margin-bottom: 14px; }
.menu-block__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.menu-block__icon {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  background: var(--amber-soft);
}
.menu-block__head b { font-size: 14px; }
.menu-block__head .kcal { margin-left: auto; font-size: 12px; color: var(--ink-2); }
.dish-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px -4px rgba(120,105,80,0.12);
}
.dish-row__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dish-row__name { font-size: 14px; flex: 1; }
.dish-row__unit { font-size: 11px; color: var(--ink-3); }
.dish-row__cal { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.dish-row__fiber {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 600;
}

.day-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(120deg, #faf0dc, #f6f1e7);
  border: 1.5px solid #f0e3c6;
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 14px;
}
.day-summary__label { font-size: 12px; color: var(--ink-2); }
.day-summary__val { font-size: 16px; font-weight: 800; color: #b07616; }

/* ---------- 打卡页 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 12px 6px;
  text-align: center;
}
.stat-card__num { font-size: 20px; font-weight: 800; color: var(--green-deep); }
.stat-card__label { font-size: 10px; color: var(--ink-2); margin-top: 2px; }

.record-group { margin-bottom: 16px; }
.record-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 4px 8px;
}
.record-group__head b { font-size: 15px; }
.record-group__add {
  font-size: 12px;
  color: var(--green-deep);
  background: var(--green-soft);
  padding: 5px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.record-item {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.record-item__icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.record-item__main { flex: 1; min-width: 0; }
.record-item__title { font-size: 14px; font-weight: 700; }
.record-item__sub { font-size: 11px; color: var(--ink-2); margin-top: 2px; }
.record-item__time { font-size: 11px; color: var(--ink-3); flex-shrink: 0; }

.bristol-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.empty {
  text-align: center;
  padding: 30px 0;
  color: var(--ink-3);
  font-size: 13px;
}
.empty__icon { font-size: 40px; display: block; margin-bottom: 8px; opacity: 0.6; }

/* ---------- 我的页 ---------- */
.profile-card {
  background: linear-gradient(135deg, #5f9d6b, #7ab07f 65%, #8fc08b);
  border-radius: var(--radius);
  padding: 20px 18px;
  color: #fff;
  margin-bottom: 12px;
  box-shadow: 0 12px 28px -10px rgba(93, 155, 107, 0.65);
  position: relative;
  overflow: hidden;
}
.profile-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.profile-card__top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.profile-card__avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fff;
  color: var(--green-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.profile-card__name { font-size: 19px; font-weight: 800; }
.profile-card__id { font-size: 11px; opacity: 0.85; margin-top: 3px; }
.profile-card__stats {
  display: flex;
  gap: 0;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}
.profile-card__stat { flex: 1; text-align: center; }
.profile-card__stat + .profile-card__stat { border-left: 1px solid rgba(255,255,255,0.25); }
.profile-card__stat .num { font-size: 22px; font-weight: 800; }
.profile-card__stat .lab { font-size: 11px; opacity: 0.85; margin-top: 2px; }

.setting-list {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.setting-row:active { background: #faf6ee; }
.setting-row + .setting-row { border-top: 1px solid var(--line); }
.setting-row__icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.setting-row__label { font-size: 14px; flex: 1; }
.setting-row__value { font-size: 12px; color: var(--ink-2); }
.setting-row__arrow { color: var(--ink-3); font-size: 13px; }

.plan-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.plan-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.plan-card__head b { font-size: 15px; }
.plan-card__kcal { font-size: 30px; font-weight: 800; color: var(--green-deep); }
.plan-card__kcal small { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.plan-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.plan-meta__item {
  background: var(--green-soft);
  border-radius: 10px;
  padding: 8px 10px;
}
.plan-meta__label { font-size: 10px; color: var(--ink-2); }
.plan-meta__val { font-size: 13px; font-weight: 700; color: var(--green-deep); margin-top: 2px; }

/* ---------- 入组流程 ---------- */
.onboard {
  padding-top: 8px;
  animation: fadeUp 0.4s ease;
}
.onboard__logo {
  width: 76px; height: 76px;
  margin: 12px auto 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, #6fae7a, #3d7a4a);
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  box-shadow: 0 14px 28px -10px rgba(61,122,74,0.6);
}
.onboard h1 { text-align: center; font-size: 22px; font-weight: 800; }
.onboard .lead { text-align: center; color: var(--ink-2); font-size: 13px; margin: 8px 0 20px; line-height: 1.6; }

.form-card { margin-bottom: 12px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.form-row input, .form-row select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-row input:focus, .form-row select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(95,157,107,0.15);
}
.form-row input::placeholder { color: var(--ink-3); }
.form-row .hint { font-size: 11px; color: var(--ink-3); margin-top: 5px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 13px;
  color: var(--ink-2);
  transition: all 0.2s;
}
.chip.is-active {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-deep);
  font-weight: 600;
}

/* 方案推荐 */
.rec-card {
  background: linear-gradient(135deg, #faf0dc, #fbf7ee);
  border: 1.5px solid #f0e3c6;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  text-align: center;
}
.rec-card__label { font-size: 12px; color: var(--ink-2); }
.rec-card__kcal { font-size: clamp(36px, 11vw, 46px); font-weight: 800; color: #b07616; line-height: 1.2; }
.rec-card__kcal small { font-size: 16px; }
.rec-card__name { font-size: 14px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.rec-card__desc { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
.rec-card__bmi {
  margin-top: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.rec-card__bmi b { color: var(--green-deep); }

.level-pick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.level-pick__item {
  text-align: center;
  padding: 10px 2px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}
.level-pick__item.is-active {
  background: var(--green-deep);
  border-color: var(--green-deep);
}
.level-pick__kcal { font-size: 13px; font-weight: 800; color: var(--ink); }
.level-pick__item.is-active .level-pick__kcal { color: #fff; }
.level-pick__note { font-size: 9px; color: var(--ink-3); margin-top: 2px; }
.level-pick__item.is-active .level-pick__note { color: rgba(255,255,255,0.8); }

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 20, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 90;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 110%);
  width: var(--phone-w);
  max-width: 100vw;
  background: var(--bg-soft);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(24px + var(--safe-bottom));
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0.24, 1);
  z-index: 95;
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(60, 50, 30, 0.25);
  zoom: var(--phone-zoom);
}
.sheet.show { transform: translate(-50%, 0); }
.sheet__bar {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 0 auto 14px;
}
.sheet__title { font-size: 17px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.sheet__sub { font-size: 12px; color: var(--ink-2); text-align: center; margin-bottom: 16px; }

/* 布里斯托选择 */
.bristol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.bristol-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.bristol-item.is-active {
  border-color: var(--green);
  background: var(--green-soft);
}
.bristol-item__dot {
  width: 34px; height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  position: relative;
}
.bristol-item__name { font-size: 13px; font-weight: 600; }
.bristol-item__desc { font-size: 10px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }

/* 步进器 */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.stepper__btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 18px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s;
}
.stepper__btn:active { transform: scale(0.9); }
.stepper__val { font-size: 18px; font-weight: 800; min-width: 60px; text-align: center; }
.stepper__unit { font-size: 11px; color: var(--ink-2); margin-left: 4px; }

.duration-options { display: flex; gap: 8px; flex-wrap: wrap; }
.duration-opt {
  flex: 1;
  min-width: 70px;
  padding: 12px 6px;
  text-align: center;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.duration-opt.is-active { background: var(--green-soft); border-color: var(--green); }
.duration-opt .num { font-size: 18px; font-weight: 800; color: var(--green-deep); }
.duration-opt .unit { font-size: 11px; color: var(--ink-2); }

/* 药物输入 */
.med-row { display: flex; gap: 8px; margin-bottom: 8px; }
.med-row input {
  flex: 1;
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.med-row input:focus { border-color: var(--green); }
.med-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -12px) scale(0.9);
  background: rgba(30, 26, 20, 0.82);
  color: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0.24, 1);
  z-index: 120;
  max-width: 260px;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast .toast__icon { font-size: 30px; display: block; margin-bottom: 6px; }

/* ---------- 动画 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.screen > * { animation: fadeUp 0.32s ease both; }

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}
.pop-in { animation: popIn 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 响应式 ---------- */

/* 真机全屏：宽度 ≤ 480 视为手机直屏 */
@media (max-width: 480px) {
  :root {
    --phone-w: 100vw;
    --phone-h: 100dvh;
    --phone-zoom: 1;
    --pad: 16px;
  }
  .phone {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .phone__notch { display: none; }
  .desk-hint { display: none; }
  .stage { padding: 0; background: var(--bg-soft); }
  .sheet { width: 100vw; max-width: 100vw; }
}

/* 小屏手机 (≤ 360) 紧凑化 */
@media (max-width: 360px) {
  :root { --pad: 12px; --fs-h2: clamp(18px, 6vw, 20px); }
  .statusbar { padding-left: 20px; padding-right: 20px; font-size: 12px; }
  .navbar__capsule { right: 10px; padding: 4px 8px; }
  .progress-grid { gap: 6px; }
  .quick-grid { gap: 6px; }
  .streak { padding: 13px 14px; }
  .streak__right { font-size: 11px; }
  .level-pick { gap: 4px; }
  .level-pick__item { padding: 8px 1px; }
  .bristol-grid { gap: 6px; }
  .card { padding: 14px; }
}

/* 桌面端展示手机壳 + 说明 */
@media (min-width: 481px) {
  /* 高窗口完整展示说明（--phone-zoom 由 JS 按窗口高度计算） */
  .desk-hint { display: block; }
}

/* 桌面矮窗口：隐藏说明，避免挤压手机壳 */
@media (min-width: 481px) and (max-height: 856px) {
  .desk-hint { display: none; }
}

/* 手机横屏全屏（覆盖上方 desk-hint 规则，须置于其后） */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --phone-w: 100vw; --phone-h: 100dvh; --phone-zoom: 1; }
  .phone { width: 100vw; height: 100dvh; border-radius: 0; box-shadow: none; }
  .phone__notch { display: none; }
  .desk-hint { display: none !important; }
  .stage { padding: 0; background: var(--bg-soft); }
  .statusbar { height: 28px; padding-top: 0; }
  .navbar { height: 40px; }
  .tabbar { height: 52px; padding-bottom: 0; }
  .screen { padding-bottom: 8px; }
}