:root {
  --cream: #FAF6F0;
  --cream-deep: #F4ECE0;
  --cream-darker: #EBE0CC;
  --pink-soft: #F5D9D2;
  --pink-rose: #E8B4A6;
  --pink-deep: #C9846F;
  --sage: #B5C4A8;
  --sage-deep: #7A9270;
  --mustard: #D4A574;
  --brown-warm: #8B6F47;
  --brown-deep: #5C4530;
  --text-primary: #3D2E1F;
  --text-soft: #6B5742;
  --text-muted: #B5A88E;
  --shadow: 0 2px 12px rgba(140, 100, 70, 0.08);
  --shadow-hover: 0 4px 20px rgba(140, 100, 70, 0.15);
  --shadow-lift: 0 8px 24px rgba(140, 100, 70, 0.18);

  /* v7.1.7：字体栈
     使用方式：
       var(--font-handwritten)  → 标题、装饰便签、食材/菜品名（手账感，brush 风）
       var(--font-base)         → 正文、按钮、输入框、小标签（清晰 + 圆润）
       var(--font-script)       → 大字 kcal / Suki's Kitchen（装饰手写体）
     中文统一走 LXGW WenKai TC（霞鹜文楷），英文走 Nunito；系统字体兜底确保字体加载失败也不破。 */
  --font-handwritten: 'ZCOOL KuaiLe', 'LXGW WenKai TC', 'LXGW WenKai', 'Noto Serif SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', serif;
  --font-base: 'Nunito', 'LXGW WenKai TC', 'Quicksand', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --font-script: 'Caveat', cursive;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-base);
  background: var(--cream);
  color: var(--text-primary);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(245, 217, 210, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(181, 196, 168, 0.2) 0%, transparent 50%);
  /* v8.0-α post 修：iPhone home bar 避让 —— body 内容到 nav 顶部的距离要加上 safe-area-inset-bottom
   * 否则 nav 因为 safe area inset 整体变高（见 .bottom-nav 的 padding-bottom），内容会被 nav 盖一截 */
  padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  -webkit-user-select: none;
  user-select: none;
  /* 注意：不要给 body 的 padding-bottom 加 transition！
   * iOS Safari 滚动时 URL bar 折叠会动 env(safe-area-inset-bottom)，
   * 加了 transition 会把这种本该瞬间的变化动画化，
   * 引起 bottom-nav 在滚动中明显"飘上去"的视觉 bug（v8.1 Step 7 hotfix） */
}
/* v8.1 Step 7：floating glass card 打开时给 body 加 padding-bottom 防最后排 sticker 被遮
 * 计算：card bottom 偏移 72+14=86，card max-height 150，breathing 14 = 250
 * （即便卡片只占中间一段宽度，居中位置仍可能盖到 sticker grid 中部）*/
body.preview-sheet-open {
  padding-bottom: calc(250px + env(safe-area-inset-bottom, 0px));
}

/* v7.3 Phase A.7：mobile 隐藏页面 scrollbar
 * iOS Safari 滚动时 scrollbar 会出现在 viewport 右侧，恰好贴在 fridge 右边
 * 视觉上像 "shell 多了一条右边"。Mobile 用手指滚动不依赖 scrollbar 视觉，
 * 隐藏后冰箱周围干净。Desktop ≥ 769px 保留默认 scrollbar（fridge 居中远离 viewport 边）*/
@media (max-width: 768px) {
  html, body {
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* 旧 Edge / IE */
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;                  /* Safari / Chrome / iOS */
  }
}
/* v7.1.5：header 改 flex 左右布局，左侧 logo+标题，右侧通知铃 */
.header {
  padding: 16px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.header-home {
  color: var(--brown-deep);
  flex-shrink: 0;
}
.header-title-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.title-zh {
  font-family: var(--font-handwritten);
  font-size: 22px;
  font-weight: 600;
  color: var(--brown-deep);
  letter-spacing: 2px;
  line-height: 1.15;
}
.title-en {
  font-family: 'Caveat', cursive;
  font-size: 14px;
  color: var(--pink-deep);
  margin-top: 1px;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* 右侧通知铃（占位，点击 toast 提示） */
.header-bell {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--brown-deep);
  transition: all 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.header-bell:hover { background: var(--cream-deep); }
.header-bell:active { transform: scale(0.92); }
.header-bell:focus-visible {
  outline: 2px solid var(--pink-rose);
  outline-offset: 2px;
}
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 34px;
  padding: 4px 7px;
  border: 1.5px solid var(--cream-darker);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-soft);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 18px rgba(120, 92, 64, 0.08);
}
.lang-toggle:active { transform: scale(0.96); }
.lang-toggle:focus-visible {
  outline: 2px solid var(--pink-rose);
  outline-offset: 2px;
}
.lang-pill {
  min-width: 26px;
  padding: 4px 6px;
  border-radius: 999px;
  text-align: center;
  line-height: 1;
}
.lang-toggle:not(.is-en) .lang-zh,
.lang-toggle.is-en .lang-en {
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.lang-divider {
  color: var(--text-muted);
  font-weight: 500;
}

/* —— 通用 SVG icon 规则 —— */
/* 给 .nav-icon / .header-icon 兜底 stroke/fill，
   即使以后换成 <img> 也只是这套 class 不再激活，不会破坏布局。 */
.nav-icon,
.header-icon {
  stroke: currentColor;
  fill: none;
  display: block;
}
.header-icon { width: 26px; height: 26px; }
.header-home { width: 28px; height: 28px; }
/* v7：底部导航（手机优先，桌面端居中限宽） */
/* v8.0-α post: nav 周围 dead zone shield + 背景模糊
 *   严格收到 nav 占用顶部（nav 高度 ~52px + bottom 间距 4+env = 56+env）
 *   不超过 nav 物理范围，FAB (bottom 80+env) 完全在 shield 之上不被遮
 *   背景半透明 + backdrop-filter blur 让 shield 范围内的 body 内容糊化（透出但模糊）
 *   z-index 99 < nav 100：nav 按钮自己正常响应 */
.nav-touch-shield {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(68px + env(safe-area-inset-bottom, 0px));  /* 跟 nav 占用顶齐平：nav-box(~68) + safe area */
  z-index: 99;
  background: rgba(250, 244, 234, 0.30);  /* 极淡奶白底色，强制 backdrop-filter 生效 */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

.bottom-nav {
  position: fixed;
  /* 固定锚在 viewport 底部：不要把 env(safe-area-inset-bottom) 放进 bottom，
   * iOS Safari 滚动/地址栏收起时会重算 env，导致整个 nav 上下漂。 */
  bottom: 0;
  left: 16px;
  right: 16px;
  display: flex;
  background: rgba(250, 244, 234, 0.92);  /* 偏 cream 暖奶白 */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: none;
  border-radius: 24px;  /* 四角统一圆 */
  box-shadow: 0 4px 24px rgba(140, 100, 70, 0.14);  /* 阴影向下 + 向四周扩散，强化"浮起来"感 */
  z-index: 100;
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));  /* safe-area 只增加内部留白，不改变 fixed 锚点 */
}
.bottom-nav .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  border-radius: 14px;
  font-family: 'Quicksand', 'Noto Serif SC', sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
  min-width: 0;
}
/* v7.1.5：从 emoji (font-size) 改为 SVG (width/height)，保留 transform 过渡 */
.bottom-nav .tab .nav-icon { width: 24px; height: 24px; line-height: 1; transition: transform 0.25s; }
.bottom-nav .tab .nav-label { letter-spacing: 0.5px; }
.bottom-nav .tab:active .nav-icon { transform: scale(0.92); }
.bottom-nav .tab.active {
  color: var(--pink-deep);
  background: linear-gradient(180deg, transparent 30%, var(--pink-soft) 100%);
  font-weight: 600;
}
.bottom-nav .tab.active .nav-icon { transform: scale(1.08); }
.content { padding: 12px 16px; }
.section-title {
  font-family: var(--font-handwritten);
  font-size: 16px; font-weight: 500;
  color: var(--brown-deep);
  margin: 16px 4px 10px;
  display: flex; align-items: center; gap: 8px;
}
/* v8.0-α post: cat 分类标签 —— 手账风贴纸（参考 Suki 提供的设计图）
 *   外形：圆角胶囊 + dashed 虚线边 + 顶部图钉小圆 + 浅奶白底
 *   内容：watercolor PNG 代表图 + 中文 cat 名（不用 emoji）
 *   先只蛋白用这套样式，其他 cat 视觉效果验证后再扩展 */
.section-title.cat-tag {
  /* v8.0-α post 美化 v5：长方形竖标签（高 > 宽，参考图视觉比例）
   *   宽度收窄到 32-36px，padding 上下加大让高度撑到 ~48px
   *   最终比例 ~0.7 明显竖向长方形 */
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 9px 4px 6px;
  background: #FAF6EE;
  border: 1.2px dashed #C9B89A;
  border-radius: 10px;
  margin: 14px 4px 8px;
  position: relative;
  min-width: 32px;
  gap: 3px;
}
.cat-tag .cat-tag-pin {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(140, 100, 70, 0.20);
}
/* v8.0-α post 美化 v3：cat icon 纯 CSS 线条画（整体缩 ~35%）
 *   .cat-icon-shape 通用容器，具体形状由 .cat-icon-protein 等 */
.cat-tag .cat-icon-shape {
  display: inline-block;
  width: 18px;          /* v4: 28 → 18 */
  height: 20px;         /* v4: 32 → 20 */
  position: relative;
}

/* 蛋白：鸡蛋切面 —— 白椭圆 + 居中蛋黄 + 高光（v4 缩小） */
.cat-icon-protein {
  border: 1.2px solid #8a6f55;
  border-radius: 50% / 60% 60% 40% 40%;
  background: #FFFDF5;
}
.cat-icon-protein::before {
  content: '';
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 9px;           /* v4: 14 → 9 */
  height: 9px;
  border-radius: 50%;
  background: #F5C56B;
  box-shadow: 0 0.5px 1px rgba(140, 100, 70, 0.10);
}
.cat-icon-protein::after {
  content: '';
  position: absolute;
  top: calc(52% - 2.5px);
  left: calc(50% - 1.5px);
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

/* 蔬菜：双叶 V 字排列 */
.cat-icon-veggie::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 9px;
  height: 13px;
  border: 1.2px solid #8a6f55;
  border-radius: 0 100% 0 100%;
  background: rgba(143, 175, 120, 0.45);
  transform: rotate(-22deg);
}
.cat-icon-veggie::after {
  content: '';
  position: absolute;
  right: 0;
  top: 4px;
  width: 9px;
  height: 13px;
  border: 1.2px solid #8a6f55;
  border-radius: 100% 0 100% 0;
  background: rgba(143, 175, 120, 0.45);
  transform: rotate(22deg);
}

/* 主食：米饭碗（上半圆山形米饭 + 下半圆碗） */
.cat-icon-grain::before {
  content: '';
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 8px;
  border: 1.2px solid #8a6f55;
  border-bottom: 0;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: #FFF8E8;
}
.cat-icon-grain::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 7px;
  border: 1.2px solid #8a6f55;
  border-top: 0;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  background: #FAF6EE;
}

/* 水果：苹果带叶 */
.cat-icon-fruit::before {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 13px;
  border: 1.2px solid #8a6f55;
  border-radius: 50% / 45% 45% 55% 55%;
  background: #F5BFB5;
}
.cat-icon-fruit::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 3px;
  width: 6px;
  height: 5px;
  border: 1px solid #8a6f55;
  border-radius: 0 100% 0 100%;
  background: rgba(143, 175, 120, 0.45);
  transform: rotate(-28deg);
}

/* 零食：饼干带咬痕（主圆 + 巧克力豆 radial-gradient + 右上角同色弧"咬掉"） */
.cat-icon-snack {
  border: 1.2px solid #8a6f55;
  border-radius: 50%;
  background-color: #E8C988;
  background-image:
    radial-gradient(circle at 5px 6px, #6B4D2E 1px, transparent 1.4px),
    radial-gradient(circle at 12px 9px, #6B4D2E 1px, transparent 1.4px),
    radial-gradient(circle at 7px 14px, #6B4D2E 1px, transparent 1.4px);
}
.cat-icon-snack::before {
  /* 咬痕：跟标签底色同色的小圆遮在右上角 + 留弧形描边 */
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FAF6EE;
  border-bottom: 1.2px solid #8a6f55;
  border-left: 1.2px solid #8a6f55;
}

/* 调料：调味瓶（瓶身 + 瓶盖），v8.1 Step 9 */
.cat-icon-seasoning::before {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 11px;
  height: 13px;
  border: 1.2px solid #8a6f55;
  border-radius: 3px 3px 4px 4px;
  background: #FBEAD0;
}
.cat-icon-seasoning::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 4px;
  border: 1.2px solid #8a6f55;
  border-radius: 2px 2px 0 0;
  background: #E8C988;
}

/* cat 中文名 —— 手写体 + 字间距收紧，配合整体缩小 */
.cat-tag .cat-tag-name {
  font-size: 9.5px;
  color: var(--brown-deep);
  letter-spacing: 1px;
  font-family: var(--font-handwritten);
  font-weight: 500;
  line-height: 1;
}
/* 每个 cat 图钉颜色 */
.cat-protein .cat-tag-pin { background: #D89A85; }  /* 暖红 */
.cat-veggie  .cat-tag-pin { background: #A5B98E; }  /* 草绿 */
.cat-grain   .cat-tag-pin { background: #E9C46A; }  /* 暖黄 */
.cat-fruit   .cat-tag-pin { background: #E07A7A; }  /* 粉红 */
.cat-snack   .cat-tag-pin { background: #8B6B47; }  /* 暖棕 */
.cat-seasoning .cat-tag-pin { background: #A78A6B; }  /* 暖褐（调料）*/

/* v8.0-α post: 管理页"✅ 我有的"顶部 section —— 跟普通 cat 标题视觉区分 */
.section-title.have-section-title {
  background: linear-gradient(135deg, var(--pink-soft), #FAEEE2);
  border-radius: 14px;
  padding: 8px 14px;
  margin: 4px 4px 12px;
  color: var(--pink-deep);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(201, 132, 111, 0.12);
}
.section-title .cat-count {
  margin-left: auto;
  background: var(--pink-deep);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 100px;
  font-family: var(--font-base);
  letter-spacing: 0.3px;
}
.help-tip {
  background: linear-gradient(135deg, #FAF0EC, #F5E8D9);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 0 4px 14px;
  font-size: 11.5px;
  color: var(--brown-deep);
  display: flex; align-items: center; gap: 8px;
  line-height: 1.5;
}
.nutrition-card {
  background: white;
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.nutrition-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.nutrition-title {
  font-family: var(--font-handwritten);
  font-size: 15px; font-weight: 500;
  color: var(--brown-deep);
}
.settings-btn {
  background: var(--cream-deep);
  border: none; width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer; font-size: 14px;
}
.progress-row { margin-bottom: 12px; }
.progress-label {
  display: flex; justify-content: space-between;
  margin-bottom: 5px;
  font-size: 12.5px; font-weight: 500;
}
.progress-name { color: var(--text-primary); }
.progress-value { color: var(--text-soft); }
.progress-value.warn { color: var(--pink-deep); font-weight: 600; }
.progress-bar-bg {
  height: 7px;
  background: var(--cream-deep);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.fill-cal { background: linear-gradient(90deg, #F5D9D2, #E8B4A6); }
.fill-protein { background: linear-gradient(90deg, #B5C4A8, #7A9270); }
.fill-carb { background: linear-gradient(90deg, #F0D9A8, #D4A574); }
.fill-fat { background: linear-gradient(90deg, #E8C4B8, #C9846F); }
.fill-satfat { background: linear-gradient(90deg, #E8A0A0, #C66060); }
.fill-fiber { background: linear-gradient(90deg, #C8D4B8, #8FA070); }
.dish-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.dish-card {
  background: white;
  border-radius: 18px;
  /* v8.0-α post: padding-bottom 28px 给 absolute 底部一行（cal + reason 同行）
   * top padding 12px 给 badge 让位；emoji+name 用 .dish-center wrapper 绝对居中卡几何中心 */
  padding: 12px 10px 28px;
  min-height: 130px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
/* v8.0-α post: emoji + 菜名作为整体绝对垂直居中卡片几何中心
 *   不被 padding-top 12px / padding-bottom 44px 不对称带偏
 *   absolute 也不挤压底部 reason / cal / portion 的 absolute 位置 */
.dish-center {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
}
.dish-card:active { transform: scale(0.97); }
.dish-card.added {
  /* v8.0-α post: 删 border —— Suki 反馈 pink border 像红色框，跟"已吃"语义太强烈
   * 整卡 pink 渐变背景已足够表达"今日已吃"，不需要再加边框 */
  background: linear-gradient(135deg, #FAF0EC, #F5D9D2);
}
/* v8.0-α post: added 删左下 ✓ 角标，整卡 pink 渐变本身就是"嵌入背景的标签"
 * 下方 ::after 旧规则保留但 content 设空，避免影响 dish-card 自己未来加 ::after */
.dish-card.added::after {
  content: none;
  position: absolute;
  /* 旧位置参考保留：bottom: 6px; left: 6px; */
  width: 20px; height: 20px;
  background: var(--pink-deep);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: bold;
}
.dish-card.custom {
  background: linear-gradient(135deg, #F4ECE0, #EBE0CC);
}
.dish-card.custom .dish-cal::before { content: '✏️ '; font-size: 9px; }
.dish-card.snack-card {
  background: linear-gradient(135deg, #FDF6EC, #FAF0D9);
}
/* v8.0-α post: margin-bottom -6px 让菜名贴到 emoji 底部，小幅重叠（参考首页冰箱食材 sticker） */
.dish-emoji { font-size: 32px; text-align: center; margin-bottom: -6px; display: block; }
.dish-name {
  font-family: var(--font-handwritten);
  font-size: 13px; font-weight: 500;
  color: var(--brown-deep);
  text-align: center; margin-bottom: 6px;
  min-height: 32px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1.3;
  /* v8.0-α post: 配合 .dish-emoji margin-bottom -6px，name 加 z-index 显示在 emoji 之上不被阴影模糊 */
  position: relative;
  z-index: 1;
}
/* v8.0-α post: 删 .dish-meta wrapper —— 不再需要单独一行容器，
 * cal 标签直接 absolute 浮在卡片左下角（见 .dish-cal 改造） */
.dish-cal {
  /* v8.1: cal 标签移到卡片顶部居中 —— 原左下角会跟 badge chip 重叠 */
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  /* v8.0-α post 再修：整体字号 + 标签缩小，更不抢视觉 */
  font-size: 9.5px;
  z-index: 2;
  /* 默认中性色（兜底，正常走下面的 cal-green/yellow/red/snack 变体）*/
  background: var(--cream-deep);
  padding: 1px 6px;
  border-radius: 100px;
  font-weight: 600;
  color: var(--brown-warm);
}
.dish-tag { font-size: 9.5px; padding: 2px 6px; border-radius: 100px; }
.tag-green { background: rgba(181, 196, 168, 0.4); color: var(--sage-deep); }
.tag-yellow { background: rgba(212, 165, 116, 0.3); color: var(--mustard); }
.tag-red { background: rgba(201, 132, 111, 0.3); color: var(--pink-deep); }
.tag-snack { background: rgba(212, 165, 116, 0.2); color: var(--mustard); }
/* v8.0-α post: kcal 标签按健康度上色（合并右下"常吃/适量/偶尔"标签到 kcal 上）
 * 一个标签同时表达：份量信息 + 健康度信号（颜色） */
.dish-cal.cal-green  { background: rgba(181, 196, 168, 0.4); color: var(--sage-deep); }
.dish-cal.cal-yellow { background: rgba(212, 165, 116, 0.3); color: var(--mustard); }
.dish-cal.cal-red    { background: rgba(201, 132, 111, 0.3); color: var(--pink-deep); }
.dish-cal.cal-snack  { background: rgba(212, 165, 116, 0.2); color: var(--mustard); }

/* v8.1 Phase 4F：菜谱卡 badge chip（正向 sage 绿 / 提醒奶黄，不用红色警告）*/
.dish-badges {
  display: flex; flex-wrap: wrap; gap: 3px;
  justify-content: center;
  padding: 0 4px;
  margin-top: 1px;
}
.dish-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 100px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.dish-badge.positive {
  background: rgba(181, 196, 168, 0.45);
  color: var(--sage-deep);
}
.dish-badge.reminder {
  background: rgba(212, 165, 116, 0.28);
  color: var(--mustard);
}
.match-badge {
  /* v8.1: 沉到左下角 —— kcal 移走后顶部只留 kcal，能做/差N 标签下沉配平 */
  position: absolute; bottom: 6px; left: 6px;
  background: var(--sage-deep);
  color: white; font-size: 10px;
  padding: 2px 7px; border-radius: 100px;
  font-weight: 600;
  z-index: 2;
}
.match-badge.partial { background: var(--mustard); }
.match-badge.inspire { background: var(--text-muted); }
.dish-card .portion-mark {
  position: absolute; bottom: 8px; right: 8px;
  background: var(--pink-rose);
  color: white; font-size: 9.5px;
  padding: 1px 6px; border-radius: 100px;
  font-weight: 600;
}
.ing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ing-card {
  background: white;
  border-radius: 16px;
  padding: 12px 6px 10px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
  -webkit-touch-callout: none;
}
.ing-card:active { transform: scale(0.95); }
.ing-card.have {
  background: linear-gradient(135deg, #FAF6F0, #F5E8D9);
  box-shadow: 0 2px 12px rgba(212, 165, 116, 0.25);
}
.ing-card:not(.have) .ing-emoji,
.ing-card:not(.have) .ing-icon-list { filter: grayscale(0.85) opacity(0.5); }
.ing-card:not(.have) .ing-name { color: var(--text-muted); }
.ing-emoji { font-size: 30px; display: block; margin-bottom: 2px; transition: filter 0.25s; }
.ing-name {
  font-family: var(--font-handwritten);
  font-size: 11.5px;
  color: var(--text-primary);
  transition: color 0.25s;
  /* v8.0-α post: icon 放大后用 -6px margin 压上来，name 加 z-index 确保在 icon 之上不被 shadow 模糊 */
  position: relative;
  z-index: 1;
}
.ing-card.in-basket { border: 2px solid var(--pink-rose); }
.ing-basket-check {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--pink-deep);
  align-items: center; justify-content: center;
  font-size: 12px; color: white;
  display: none;
}
.ing-card.in-basket .ing-basket-check { display: flex; }
.add-ing-card {
  background: transparent;
  border: 2px dashed var(--cream-darker);
  border-radius: 16px;
  padding: 12px 6px 10px;
  text-align: center;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 78px;
  transition: all 0.25s;
}
.add-ing-card:active { background: var(--cream-deep); }
.add-ing-card .plus { font-size: 24px; color: var(--text-muted); }
.add-ing-card .add-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.basket-fab {
  position: fixed;
  /* v8.0-α post 修：safe-area-inset-bottom 让 FAB 跟着 nav 一起上抬，避 iPhone home bar */
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 56px; height: 56px;
  /* v8.0-α: 换成水彩 PNG 后，pink-deep 圆底跟藤编碗颜色撞色，改成奶油底 + 浅粉描边，让 PNG 浮上去 */
  background: white;
  border: 2px solid var(--pink-soft);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(201, 132, 111, 0.35);
  z-index: 90;
  transition: all 0.3s ease;
  padding: 0;
}
.basket-fab:active { transform: scale(0.92); }
.basket-fab .count {
  position: absolute; top: -4px; right: -4px;
  background: var(--sage-deep);
  color: white; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px;
  border-radius: 100px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}
.basket-fab.empty .count { display: none; }
/* v8.0-α: 菜篮子 PNG icon —— 替换原 🧺 emoji */
.basket-fab-icon {
  width: 46px;
  height: 46px;
  object-fit: contain;
  pointer-events: none;  /* 点击穿透到 button，不挡 onclick */
  display: block;
}
.basket-inline-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 4px;
  /* 跟 19px font-size 的手写体标题对齐，略大一点视觉更平衡 */
}
/* v6.2：双按钮组（菜谱 + 即食/外卖）竖向排列在菜篮子按钮上方 */
.add-dish-group {
  position: fixed;
  /* v8.0-α post 修：iPhone home bar 避让 + 位置上靠近 basket-fab（不再悬空隔 74px） */
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 90;
}
.add-dish-group.show { display: flex; }
.add-btn {
  /* v8.0-α post 美化：缩小 + 阴影柔化，不再"很大很丑挡视野" */
  height: 34px;
  padding: 0 12px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(139, 111, 71, 0.18);
  transition: all 0.25s;
  font-family: 'Quicksand', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  letter-spacing: 0.3px;
}
.add-btn.primary {
  background: var(--brown-warm);
  color: white;
}
.add-btn.secondary {
  background: var(--mustard);
  color: var(--brown-deep);
}
.add-btn:active { transform: scale(0.95); }
.add-ing-fab {
  position: fixed;
  /* v8.0-α post 修：iPhone home bar 避让 */
  bottom: calc(210px + env(safe-area-inset-bottom, 0px));
  right: 20px;  /* v7：在 basket-fab 之上 */
  width: 56px; height: 56px;
  background: var(--sage-deep);
  border-radius: 50%;
  align-items: center; justify-content: center;
  font-size: 24px; color: white;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(122, 146, 112, 0.4);
  z-index: 90;
  border: none;
  display: none;
  transition: all 0.3s ease;
}
.add-ing-fab.show { display: flex; }
.add-ing-fab:active { transform: scale(0.92); }
/* v8.0-α post: .today-bar / .today-info / .today-label / .today-cal / .clear-btn
   已删除。v6 时代的"今日热量浮动栏"在 v8 信息架构后被搭配 tab 的营养试算表
   完全替代（占屏 + 数字永远 0 + 清空按钮静默失败）。 */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(60, 46, 31, 0.5);
  display: none;
  align-items: flex-end; justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--cream);
  width: 100%; max-width: 500px;
  border-top-left-radius: 28px; border-top-right-radius: 28px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--cream-deep);
  border-radius: 100px;
  margin: 12px auto 8px;
  flex-shrink: 0;
}
.modal-scroll {
  flex: 1; overflow-y: auto;
  padding: 8px 20px 12px;
  /* v8.0-α: iOS Safari momentum scroll，否则 modal 内容滚不到顶 / 底 */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;  /* 滑到边界不传给父 body */
}
.modal-scroll::-webkit-scrollbar { width: 0; }
/* v8.0-α: modal 打开时锁 body 滚动，让用户在 modal 区域 swipe 滚 modal 内容而非穿透到背景页 */
body.modal-open {
  overflow: hidden;
  /* 不用 position: fixed —— 会让 scroll 位置丢失。仅 overflow: hidden 在主流 iOS / Chrome 已足够 */
}
.modal-bottom-fixed {
  flex-shrink: 0;
  padding: 12px 20px 18px;
  background: var(--cream);
  border-top: 1px solid var(--cream-deep);
  position: relative;
}
.modal-bottom-fixed::before {
  content: '';
  position: absolute;
  top: -16px; left: 0; right: 0;
  height: 16px;
  background: linear-gradient(to top, var(--cream), transparent);
  pointer-events: none;
}
.modal-emoji { font-size: 52px; text-align: center; display: block; margin-bottom: 6px; }
.modal-title {
  font-family: var(--font-handwritten);
  font-size: 19px; font-weight: 600;
  color: var(--brown-deep);
  text-align: center;
}
.modal-tag-row {
  text-align: center;
  margin: 4px 0 14px;
  color: var(--text-soft);
  font-size: 12px;
}
.modal-section {
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.modal-section-title {
  font-size: 11px; color: var(--text-soft);
  letter-spacing: 1px; margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
}
.modal-info {
  font-size: 13.5px; color: var(--text-primary);
  line-height: 1.6;
}
.nutrition-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nutri-box {
  background: var(--cream-deep);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}
.nutri-box .label { font-size: 10px; color: var(--text-soft); letter-spacing: 1px; }
.nutri-box .value {
  font-family: 'Caveat', cursive;
  font-size: 20px; color: var(--brown-deep);
  font-weight: 700;
}
.portion-selector {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 4px;
}
.portion-btn {
  padding: 10px 0;
  background: var(--cream-deep);
  border: 2px solid transparent;
  border-radius: 12px;
  font-family: 'Quicksand', sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s;
}
.portion-btn.active {
  background: var(--pink-soft);
  color: var(--pink-deep);
  border-color: var(--pink-rose);
}
.portion-btn:active { transform: scale(0.95); }
.action-btn {
  width: 100%;
  background: var(--brown-warm);
  color: var(--cream);
  border: none;
  padding: 13px;
  border-radius: 14px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600; font-size: 14.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:active { transform: scale(0.98); }
.action-btn.remove { background: var(--pink-deep); }
.action-btn.secondary {
  background: var(--cream-deep);
  color: var(--text-soft);
  margin-top: 8px;
}
.action-btn.danger {
  background: white;
  color: var(--pink-deep);
  border: 1.5px solid var(--pink-rose);
  margin-top: 8px;
}
.action-btn.plan-btn {
  background: var(--sage-deep);
  margin-top: 8px;
}
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--cream-deep);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 13.5px; color: var(--text-primary); }
.setting-input {
  width: 80px;
  padding: 8px 12px;
  border: 1.5px solid var(--cream-deep);
  border-radius: 12px;
  background: white;
  font-family: 'Quicksand', sans-serif;
  font-size: 13.5px;
  text-align: right;
  color: var(--brown-deep);
  font-weight: 600;
}
.setting-input:focus { outline: none; border-color: var(--pink-rose); }

/* v8.1 Phase 2：设置 modal 身体数据表单 */
.profile-chip-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 2px;
}
.profile-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1.5px solid var(--cream-deep);
  border-radius: 100px;
  background: white;
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
}
.profile-chip.selected {
  background: var(--pink-soft);
  border-color: var(--pink-rose);
  color: var(--pink-deep);
}
.profile-chip:active { transform: scale(0.96); }
.chip-hint {
  font-size: 11px;
  color: var(--text-muted);
  min-height: 14px;
  margin: 2px 2px 4px;
}
.profile-num-row {
  display: flex; gap: 8px;
  margin: 4px 0 2px;
}
.profile-num {
  flex: 1;
  display: flex; flex-direction: column;
}
.profile-num input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--cream-deep);
  border-radius: 12px;
  background: white;
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  text-align: center;
  color: var(--brown-deep);
  font-weight: 600;
}
.profile-num input:focus { outline: none; border-color: var(--pink-rose); }
.profile-calc-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}
.action-btn.disabled,
.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* v8.1：设置 tab「每日营养目标」只读态 + 两个入口按钮 */
.setting-input[readonly] {
  border-color: transparent;
  background: transparent;
  cursor: default;
}
.goal-action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.goal-action-row .action-btn {
  flex: 1;
  margin: 0;
}
/* 「小美帮算」弹窗里的建议目标预览值 */
.calc-preview-val {
  font-family: 'Quicksand', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brown-deep);
}
.add-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--cream-deep);
  border-radius: 12px;
  background: white;
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  color: var(--brown-deep);
  margin-bottom: 10px;
}
.add-form input:focus { outline: none; border-color: var(--pink-rose); }
.emoji-pick-row {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  margin-bottom: 12px;
  max-height: 180px;
  overflow-y: auto;
}
.emoji-pick {
  background: var(--cream-deep);
  border-radius: 10px;
  padding: 8px 0;
  font-size: 22px;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
}
.emoji-pick.selected {
  background: var(--pink-soft);
  border-color: var(--pink-rose);
}
.cat-pick-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.cat-pick {
  padding: 8px 14px;
  background: var(--cream-deep);
  border-radius: 100px;
  font-size: 12px; color: var(--text-soft);
  cursor: pointer;
  border: 2px solid transparent;
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
}
.cat-pick.selected {
  background: var(--pink-soft);
  color: var(--pink-deep);
  border-color: var(--pink-rose);
}
/* v5：自定义菜的食材勾选 */
.ing-pick-wrap {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--cream);
  border-radius: 12px;
}
.ing-pick-wrap::-webkit-scrollbar { width: 4px; }
.ing-pick-wrap::-webkit-scrollbar-thumb { background: var(--cream-darker); border-radius: 2px; }
.ing-pick-cat-title {
  font-size: 10.5px; color: var(--text-soft);
  letter-spacing: 1px; font-weight: 600;
  text-transform: uppercase;
  padding: 8px 4px 4px;
}
.ing-pick-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 2px 2px;
}
.ing-pick {
  background: white;
  border: 1.5px solid transparent;
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--text-soft);
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  font-family: 'Quicksand', 'Noto Serif SC', sans-serif;
  transition: all 0.18s;
}
.ing-pick:active { transform: scale(0.95); }
.ing-pick.selected {
  background: var(--pink-soft);
  color: var(--pink-deep);
  border-color: var(--pink-rose);
  font-weight: 600;
}
.ing-pick-summary {
  font-size: 11px; color: var(--text-muted);
  padding: 2px 4px 6px;
}
.ing-pick-summary b { color: var(--pink-deep); font-weight: 700; }
/* v6：勾选食材后展开的用量列表（可选填，不填也能保存） */
.ing-amount-list {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 10px;
  padding: 4px 0;
}
.ing-amount-row {
  display: flex; align-items: center; gap: 8px;
  background: white;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12.5px;
}
.ing-amount-row .ing-label {
  flex: 1;
  color: var(--brown-deep);
  display: flex; align-items: center; gap: 4px;
  min-width: 0;
}
.ing-amount-row .amount-input {
  width: 64px;
  padding: 6px 8px;
  border: 1.5px solid var(--cream-deep);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px;
  text-align: right;
  color: var(--brown-deep);
  font-weight: 600;
}
.ing-amount-row .amount-input:focus { outline: none; border-color: var(--pink-rose); background: white; }
.ing-amount-row .amount-input.has-data { border-color: rgba(181,196,168,0.5); }
.ing-amount-row .unit { font-size: 11px; color: var(--text-muted); }
.ing-amount-row .row-x {
  background: var(--cream-deep);
  color: var(--text-muted);
  border: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.ing-amount-row .no-data-mark {
  font-size: 9.5px; color: var(--text-muted);
  background: var(--cream-deep);
  padding: 1px 6px; border-radius: 100px;
}
.estimate-action {
  display: flex; gap: 8px; margin: 6px 0 4px;
}
.estimate-btn {
  flex: 1;
  padding: 10px 0;
  background: linear-gradient(135deg, #F5E8D9, #F0D9A8);
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 12.5px; color: var(--brown-deep);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.estimate-btn:active { transform: scale(0.98); }
.estimate-btn:disabled {
  background: var(--cream-deep); color: var(--text-muted);
  cursor: not-allowed;
}
.estimate-result {
  background: rgba(181,196,168,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 6px 0 10px;
  font-size: 11.5px;
  color: var(--sage-deep);
  display: none;
  line-height: 1.55;
}
.estimate-result.show { display: block; }
.estimate-result b { color: var(--brown-deep); font-weight: 700; }
.estimate-result .miss-note { color: var(--mustard); margin-top: 4px; font-size: 10.5px; display: block; }
/* v6：详情页结构化用料显示 */
.recipe-ing-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.recipe-ing-chip {
  background: var(--cream-deep);
  border-radius: 100px;
  padding: 4px 11px;
  font-size: 12px;
  color: var(--brown-deep);
}
.recipe-ing-chip b { color: var(--pink-deep); font-weight: 700; }
.recipe-ing-chip.no-data { opacity: 0.65; }
/* v6 阶段 2：快捷标签（多选 chip） */
.tag-pick-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.tag-pick {
  padding: 8px 14px;
  background: var(--cream-deep);
  border-radius: 100px;
  font-size: 12px; color: var(--text-soft);
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: 'Quicksand', 'Noto Serif SC', sans-serif;
  font-weight: 500;
  display: flex; align-items: center; gap: 4px;
  transition: all 0.18s;
}
.tag-pick:active { transform: scale(0.95); }
.tag-pick.selected {
  background: var(--pink-soft);
  color: var(--pink-deep);
  border-color: var(--pink-rose);
  font-weight: 600;
}
/* v6 阶段 2：快捷 cal 按钮视觉降级（变小、低对比） */
.cal-suggest-hint {
  font-size: 10.5px; color: var(--text-muted);
  margin: -4px 4px 6px;
  line-height: 1.5;
}
.cal-suggest-secondary {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.cal-suggest-secondary .cal-suggest-btn {
  flex: 0 0 auto;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--cream-darker);
  border-radius: 100px;
  font-size: 10.5px; color: var(--text-muted);
  font-weight: 500;
}
.cal-suggest-secondary .cal-suggest-btn:active {
  background: var(--cream-deep);
  color: var(--text-soft);
}
/* v6 阶段 2：冰箱页"管理食材"按钮 */
.fridge-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 8px;
}
.fridge-title {
  font-family: var(--font-handwritten);
  font-size: 14px; font-weight: 500;
  color: var(--brown-deep);
}
.manage-toggle-btn {
  background: white;
  border: 1.5px solid var(--cream-darker);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 11.5px; color: var(--text-soft);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  box-shadow: var(--shadow);
}
.manage-toggle-btn:active { transform: scale(0.96); }
.manage-toggle-btn.active {
  background: var(--brown-warm);
  color: var(--cream);
  border-color: var(--brown-warm);
}

/* v7.3 A.27：管理页头部按钮区 + 清空冰箱按钮 */
.fridge-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.clear-fridge-btn {
  background: transparent;
  border: 1.5px solid var(--cream-darker);
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--text-soft);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.clear-fridge-btn:hover {
  background: var(--cream-deep);
  color: var(--brown-warm);
}
.clear-fridge-btn:active {
  transform: scale(0.96);
  background: var(--cream-darker);
}
/* 管理模式下的食材卡片视觉变化 */
.ing-card.manage {
  background: linear-gradient(135deg, #FAF6F0, #F5E8D9);
  border: 1.5px dashed var(--brown-warm);
}
.ing-card.manage .ing-emoji,
.ing-card.manage .ing-icon-list,
.ing-card.manage .ing-name { filter: none !important; opacity: 1 !important; color: var(--brown-deep) !important; }
.ing-card.manage::after {
  content: '✏️';
  position: absolute; top: 4px; right: 4px;
  font-size: 13px;
}
.ing-card.archived {
  opacity: 0.55;
  background: var(--cream-deep);
  border: 1.5px dashed var(--text-muted);
}
.ing-card.archived::after { content: '🚫'; }
/* v8.1 Step 6：管理模式卡片下方"1 条 ≈ 400g ≈ 243 kcal"一行（仅 manage 模式 + 有 unit 时渲染）*/
.ing-card .ing-unit-line {
  font-family: 'Quicksand', sans-serif;
  font-size: 9.5px;
  color: var(--text-soft);
  margin-top: 2px;
  line-height: 1.3;
  /* 卡片窄 → 超出省略，避免长 label 撑歪布局 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  position: relative;
  z-index: 1;
}
/* v8.1 Step 6：编辑食材 modal 里的"份量"只读 section */
.ing-unit-display {
  background: var(--cream);
  border: 1.5px solid var(--cream-deep);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.ing-unit-display .ing-unit-main {
  font-family: 'Quicksand', sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--brown-deep);
}
.ing-unit-display .ing-unit-note {
  font-family: var(--font-handwritten);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}
.ing-unit-display .ing-unit-empty {
  font-family: var(--font-handwritten);
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}

/* v8.1 Step 7：食材底部 floating glass mini card
 *   不是 full-width bottom sheet —— 是一张居中浮动的半透明玻璃小卡
 *   宽度 clamp(280, 76vw, 360)，居中（left:50% + translateX(-50%)）
 *   slide-up 入场：translate Y 同时保持 X 居中
 *   背景：奶油-白渐变 + 强 backdrop-filter blur + saturate
 *   顶部 ::before 做 glossy highlight 增加玻璃感 */
.ing-preview-sheet {
  position: fixed;
  bottom: calc(var(--bottom-nav-height, 72px) + env(safe-area-inset-bottom, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(120%);   /* 关：在下方+不可见 */
  width: clamp(210px, 46vw, 250px);
  max-width: 46vw;
  min-height: 92px;
  height: auto;
  /* v8.1: 纵向重排后高度跟随内容自适应，不再设上限（避免内容被截） */
  /* v8.1: 浅鹅黄玻璃 —— 跟奶油色 app 背景 / 食材贴纸区分开 */
  background: linear-gradient(135deg, rgba(255, 249, 214, 0.92), rgba(252, 241, 192, 0.85));
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border: 1px solid rgba(255, 252, 226, 0.85);
  border-radius: 22px;
  box-shadow:
    0 12px 32px rgba(120, 86, 60, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  padding: 10px 14px 11px;
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.2, 0.85, 0.3, 1), opacity 0.22s ease-out;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Glossy 顶部高光（玻璃质感） */
.ing-preview-sheet::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent);
  border-radius: 22px 22px 0 0;
  pointer-events: none;
}
.ing-preview-sheet.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
/* 右上 × 关闭按钮 */
.ing-preview-sheet .preview-close {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
  padding: 0;
  z-index: 2;       /* 高于 ::before glossy */
}
.ing-preview-sheet .preview-close:hover,
.ing-preview-sheet .preview-close:active {
  background: rgba(180, 150, 120, 0.18);
  color: var(--brown-deep);
}
/* v8.1 纵向重排 + 放大填充：icon + name + 详情药丸 一行，字图放大 */
.ing-preview-sheet .preview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 22px;     /* 留位置给 × */
  position: relative;       /* 高于 ::before glossy */
  z-index: 1;
}
.ing-preview-sheet .preview-icon-col {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ing-preview-sheet .preview-icon-col img,
.ing-preview-sheet .preview-icon-col .sticker-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.ing-preview-sheet .preview-icon-col .sticker-emoji,
.ing-preview-sheet .preview-emoji {
  font-size: 44px;
  line-height: 1;
}
.ing-preview-sheet .preview-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-handwritten);
  font-size: 16px;
  font-weight: 700;
  color: var(--brown-deep);
  line-height: 1.25;
}
/* cat 行：分类标签 + 详情药丸 同行 */
.ing-preview-sheet .preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.ing-preview-sheet .preview-cat {
  font-family: var(--font-handwritten);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
/* 详情药丸：纯文字"详情"，紧贴 cat 右侧 */
.ing-preview-sheet .preview-detail-pill {
  flex-shrink: 0;
  height: 24px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1.2px solid var(--cream-darker);
  background: rgba(255, 255, 255, 0.7);
  font-family: 'Quicksand', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brown-warm);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
}
.ing-preview-sheet .preview-detail-pill:active {
  transform: scale(0.95);
}
.ing-preview-sheet .preview-unit-line {
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--brown-warm);
  margin-top: 5px;
  line-height: 1.4;
}
.ing-preview-sheet .preview-unit-note {
  font-family: var(--font-handwritten);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 3px;
}
/* 已隐藏分组标题 */
.archived-section-title {
  font-family: var(--font-handwritten);
  font-size: 13.5px; font-weight: 500;
  color: var(--text-muted);
  margin: 18px 4px 8px;
  display: flex; align-items: center; gap: 6px;
}
.archived-section-title .count {
  background: var(--cream-deep);
  border-radius: 100px; padding: 2px 8px;
  font-size: 11px;
  font-family: 'Quicksand', sans-serif; font-weight: 600;
}
/* v6 阶段 2：食材编辑模态——营养字段网格 */
.nutri-edit-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-bottom: 8px;
}
.nutri-edit-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0;
}
.nutri-edit-row label {
  flex: 1;
  font-size: 12px; color: var(--text-soft);
}
.nutri-edit-row input {
  width: 64px;
  padding: 6px 8px;
  border: 1.5px solid var(--cream-deep);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px;
  text-align: right;
  color: var(--brown-deep);
  font-weight: 600;
}
.nutri-edit-row input:focus { outline: none; border-color: var(--pink-rose); background: white; }
.nutri-edit-row .unit {
  font-size: 10.5px; color: var(--text-muted);
  width: 28px;
}
.nutri-null-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  font-size: 12px; color: var(--text-soft);
}
.nutri-null-toggle input[type=checkbox] { width: 16px; height: 16px; }

/* v8.1: 内置食材只读模式 —— 字段灰化 + 阻止交互，软删除按钮仍可点 */
.ing-readonly .emoji-pick-row,
.ing-readonly .cat-pick-row,
.ing-readonly .nutri-null-toggle {
  pointer-events: none;
  opacity: 0.55;
}
.ing-readonly input[readonly] {
  background: var(--cream-light, #FAF3E7);
  color: var(--text-soft);
  cursor: default;
}
.ing-readonly input[readonly]:focus {
  border-color: var(--cream-deep);
  background: var(--cream-light, #FAF3E7);
}

.dedup-hint {
  background: linear-gradient(135deg, #FAF0EC, #F5E8D9);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--brown-deep);
  line-height: 1.5;
}
.dedup-hint b { color: var(--pink-deep); font-weight: 700; }
.dedup-hint .dedup-actions {
  display: flex; gap: 8px; margin-top: 8px;
}
.dedup-hint button {
  flex: 1;
  padding: 8px 0;
  border-radius: 10px;
  border: none;
  font-size: 11.5px;
  font-family: 'Quicksand', sans-serif; font-weight: 600;
  cursor: pointer;
}
.dedup-hint .use-existing { background: var(--brown-warm); color: var(--cream); }
.dedup-hint .force-create { background: white; color: var(--text-soft); border: 1px solid var(--cream-darker); }
.field-label {
  font-size: 11px; color: var(--text-soft);
  margin: 8px 0 6px;
  letter-spacing: 1px;
  font-weight: 600;
  text-transform: uppercase;
}
/* v6 阶段 2 移除：.dish-type-grid / .dish-type-card / .cal-suggest（被快捷标签和降级 cal 按钮替代） */
.cal-suggest-btn {
  padding: 8px 0;
  background: var(--cream-deep);
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: 11.5px; color: var(--text-soft);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
}
.cal-suggest-btn:active {
  background: var(--pink-soft);
  color: var(--pink-deep);
}
/* v6.2：即食/外卖类型选择卡片 */
.quick-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 8px 0 12px;
}
.quick-type-card {
  border: 2px solid var(--cream-darker);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.25s;
  background: white;
  text-align: center;
}
.quick-type-card:active {
  transform: scale(0.98);
}
.quick-type-card.selected {
  border-color: var(--pink-deep);
  background: var(--pink-soft);
}
.quick-type-emoji {
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
}
.quick-type-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.quick-type-desc {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.3;
}
/* v6.2：营养预览 */
.nutrition-preview {
  background: var(--cream-deep);
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0;
}
.nutrition-preview .preview-label {
  font-size: 10.5px;
  color: var(--text-soft);
  margin-bottom: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.nutrition-preview .preview-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.nutrition-preview .preview-item {
  text-align: center;
  font-size: 11px;
}
.nutrition-preview .preview-item .label {
  color: var(--text-muted);
  font-size: 10px;
  display: block;
  margin-bottom: 2px;
}
.nutrition-preview .preview-item .value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
}
.basket-content { padding: 8px 0; }
.basket-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-soft);
}
.basket-empty .emoji { font-size: 48px; display: block; margin-bottom: 8px; }
.basket-empty p {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: var(--brown-warm);
}
.basket-items {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}
.basket-item {
  background: white;
  padding: 8px 14px;
  border-radius: 100px;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.basket-item .remove-x {
  background: var(--pink-soft);
  color: var(--pink-deep);
  border: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
}
.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-soft);
}
.empty-state .emoji { font-size: 44px; display: block; margin-bottom: 8px; }
.empty-state p {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: var(--brown-warm);
}
.toast {
  position: fixed;
  top: 20px; left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--brown-deep);
  color: var(--cream);
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 13px;
  z-index: 300;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.mode-toggle {
  background: white;
  border-radius: 14px;
  padding: 4px;
  display: flex;
  margin: 0 4px 12px;
  box-shadow: var(--shadow);
}
.mode-btn {
  flex: 1;
  padding: 10px 8px;
  background: none; border: none;
  border-radius: 10px;
  font-family: 'Quicksand', sans-serif;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
}
.mode-btn.active {
  background: var(--pink-soft);
  color: var(--pink-deep);
  font-weight: 600;
}
.suggest-buy {
  background: linear-gradient(135deg, #F5E8D9, #F0D9A8);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--brown-deep);
}
.suggest-buy strong { color: var(--mustard); font-weight: 700; }
/* 计划预览区域 */
.plan-summary {
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.plan-title {
  font-size: 11px; color: var(--text-soft);
  letter-spacing: 1px; margin-bottom: 8px;
  font-weight: 600; text-transform: uppercase;
}
.plan-nutrition-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.plan-nutri-pill {
  background: var(--cream-deep);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--brown-warm);
  font-weight: 600;
}
.plan-nutri-pill.warn {
  background: rgba(201,132,111,0.2);
  color: var(--pink-deep);
}
.plan-dishes-list {
  margin-bottom: 10px;
}
.plan-dish-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--cream-deep);
  font-size: 12.5px;
}
.plan-dish-row:last-child { border-bottom: none; }
.plan-dish-name { display: flex; align-items: center; gap: 6px; color: var(--brown-deep); }
.plan-dish-cal { color: var(--text-muted); font-size: 11px; }
.plan-remove-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 16px;
  cursor: pointer; padding: 0 4px; line-height: 1;
}

/* v8.1: 菜篮子 modal 购物清单 */
.shopping-list { display: flex; flex-direction: column; gap: 6px; }
.shopping-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--cream-light, #FAF3E7);
  border-radius: 12px;
  font-size: 13px;
  color: var(--brown-deep);
}
.shopping-ing { display: flex; align-items: center; gap: 6px; }
.shopping-count {
  font-size: 11px;
  color: var(--text-soft);
  background: white;
  border-radius: 100px;
  padding: 2px 9px;
}
.shopping-empty {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-soft);
  padding: 14px 4px 4px;
}
/* 备份/恢复 */
.backup-section {
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.backup-row {
  display: flex; gap: 8px; margin-top: 8px;
}
.backup-btn {
  flex: 1;
  padding: 10px 0;
  background: var(--cream-deep);
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 12px; color: var(--text-soft);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.backup-btn:active { background: var(--pink-soft); color: var(--pink-deep); }

/* ========== v6.3：历史记录、日历、趋势图 ========== */
/* 日历卡片 */
.calendar-card {
  background: white;
  border-radius: 24px;
  padding: 18px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.calendar-month-title {
  font-family: var(--font-handwritten);
  font-size: 16px;
  font-weight: 600;
  color: var(--brown-deep);
}
.calendar-nav-btn {
  background: var(--cream-deep);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-soft);
  transition: all 0.2s;
}
.calendar-nav-btn:active {
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-weekday {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0;
  font-weight: 600;
}
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 13px;
  color: var(--text-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.calendar-day.empty {
  color: var(--text-muted);
  opacity: 0.3;
  cursor: default;
}
.calendar-day.today {
  background: var(--pink-soft);
  color: var(--pink-deep);
  font-weight: 700;
}
.calendar-day.has-record::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sage-deep);
}
.calendar-day.today.has-record::after {
  background: var(--pink-deep);
}
.calendar-day.selected {
  background: var(--brown-warm);
  color: white;
  font-weight: 700;
}
.calendar-day:not(.empty):not(.selected):active {
  transform: scale(0.95);
  background: var(--cream-deep);
}

/* 当日详情卡片 */
.day-detail-card {
  background: white;
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.day-detail-date {
  font-family: var(--font-handwritten);
  font-size: 15px;
  font-weight: 600;
  color: var(--brown-deep);
}
.day-detail-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-soft);
}
.day-detail-empty .emoji {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}
.day-nutrition-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.day-nutri-box {
  background: var(--cream-deep);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.day-nutri-box .label {
  font-size: 10px;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.day-nutri-box .value {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  font-weight: 700;
  color: var(--brown-deep);
}
.day-dishes-list {
  border-top: 1px solid var(--cream-deep);
  padding-top: 12px;
}
.day-dish-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.day-dish-item .emoji {
  font-size: 18px;
}
.day-dish-item .name {
  flex: 1;
  color: var(--text-primary);
}
.day-dish-item .portion {
  font-size: 11px;
  color: var(--text-muted);
}
/* v8.0-α bug2: 详情卡每道菜后面的 × 删除按钮 */
.day-dish-item .day-dish-remove {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--cream-deep);
  color: var(--text-soft);
  font-size: 14px; line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}
.day-dish-item .day-dish-remove:active {
  background: var(--pink-rose);
  color: white;
  transform: scale(0.9);
}

/* 趋势选择器 */
.trend-selector {
  background: white;
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.trend-metric-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.trend-metric-chip {
  padding: 6px 14px;
  background: var(--cream-deep);
  border: 1.5px solid transparent;
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  transition: all 0.2s;
}
.trend-metric-chip.active {
  background: var(--pink-soft);
  color: var(--pink-deep);
  border-color: var(--pink-rose);
  font-weight: 600;
}
.trend-metric-chip:active {
  transform: scale(0.95);
}
.trend-days-toggle {
  display: flex;
  gap: 8px;
}
.trend-days-btn {
  flex: 1;
  padding: 8px 0;
  background: var(--cream-deep);
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  transition: all 0.2s;
}
.trend-days-btn.active {
  background: var(--sage);
  color: white;
  border-color: var(--sage-deep);
  font-weight: 600;
}
.trend-days-btn:active {
  transform: scale(0.98);
}

/* 趋势图卡片 */
.trend-chart-card {
  background: white;
  border-radius: 24px;
  padding: 18px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.trend-chart-title {
  font-family: var(--font-handwritten);
  font-size: 14px;
  font-weight: 600;
  color: var(--brown-deep);
  margin-bottom: 12px;
  text-align: center;
}
.trend-bars {
  display: flex;
  /* v7.4.3: 改 stretch —— 让 .trend-bar-col 撑满 180px，下面的 height:% 链才有参考 */
  align-items: stretch;
  justify-content: space-around;
  height: 180px;
  padding: 10px 0;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--cream-deep);
  position: relative;
}
.trend-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* v7.4.3: 列内子元素推到底部，bar 从底向上长 */
  justify-content: flex-end;
  gap: 4px;
  /* v7.4.3: 显式 height:100% —— 部分 mobile 浏览器对 align-items:stretch 不一致，加一道保险 */
  height: 100%;
  min-width: 0;
}
.trend-bar-wrapper {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex: 1;
  min-height: 0;
  /* v7.4.3: 关键 —— 显式 100%，让子 .trend-bar 的 height:% 有明确参考，否则手机端柱子渲染成 0 高 */
  height: 100%;
}
.trend-bar {
  width: 80%;
  max-width: 32px;
  background: linear-gradient(to top, var(--sage), var(--sage-deep));
  border-radius: 6px 6px 0 0;
  transition: all 0.4s ease;
  position: relative;
}
.trend-bar.empty {
  background: var(--cream-deep);
  opacity: 0.4;
}
.trend-bar.warn {
  background: linear-gradient(to top, var(--pink-rose), var(--pink-deep));
}
.trend-bar-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  /* v7.4.1: 30 天模式有的 label 是 &nbsp;，min-height 保证整行高度等高，柱体顶部对齐 */
  min-height: 12px;
  line-height: 12px;
  white-space: nowrap;
}
/* v7.4.1: 今日柱 + 今日 label 视觉强调（趋势图最右一根） */
.trend-bar-label.is-today {
  color: var(--pink-deep);
  font-weight: 700;
}
.trend-bar.is-today {
  box-shadow: 0 0 0 2px rgba(201, 132, 111, 0.35);
}
.trend-goal-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--mustard);
  opacity: 0.6;
}
.trend-goal-label {
  position: absolute;
  right: 8px;
  font-size: 9px;
  color: var(--mustard);
  background: white;
  padding: 0 4px;
}

/* 营养提醒卡片 */
.insight-card {
  background: linear-gradient(135deg, #FAF0EC, #F5E8D9);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
}
.insight-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--brown-deep);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.insight-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.insight-item {
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.5;
}
.insight-item .icon {
  display: inline-block;
  margin-right: 4px;
}
.insight-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-soft);
  font-size: 12px;
}

/* v6.4："回到今天"按钮 */
.back-to-today-btn {
  background: var(--pink-soft);
  border: 1.5px solid var(--pink-rose);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--pink-deep);
  cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.back-to-today-btn:active {
  transform: scale(0.95);
}

/* ============================================================ */
/* v7：冰箱门 Dashboard（首页）                                  */
/* ============================================================ */

/* 顶部标题区 */
.fridge-dash-header {
  padding: 28px 8px 16px;
  text-align: center;
}
.fridge-dash-title {
  font-family: var(--font-handwritten);
  font-size: 26px;
  font-weight: 600;
  color: var(--brown-deep);
  letter-spacing: 3px;
  margin-bottom: 4px;
}
.fridge-dash-subtitle {
  font-family: 'Caveat', cursive;
  font-size: 17px;
  color: var(--pink-deep);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.fridge-dash-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* Dashboard 卡片（推荐 / 今日小记） */
.dash-card {
  background: white;
  border-radius: 20px;
  padding: 16px 14px;
  margin: 0 4px 14px;
  box-shadow: var(--shadow);
}
.dash-card-title {
  font-family: var(--font-handwritten);
  font-size: 14px;
  font-weight: 600;
  color: var(--brown-deep);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.dash-card-clickable { cursor: pointer; transition: all 0.2s; }
.dash-card-clickable:active { transform: scale(0.99); background: var(--cream); }
.dash-card-empty {
  text-align: center;
  padding: 12px 8px;
  color: var(--text-muted);
  font-family: 'Caveat', cursive;
  font-size: 17px;
}

/* 推荐菜小行 */
.dash-rec-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--cream-deep);
  cursor: pointer;
  transition: background 0.2s;
}
.dash-rec-row:last-child { border-bottom: none; }
.dash-rec-row:active { background: var(--cream); }
.dash-rec-emoji { font-size: 26px; line-height: 1; }
.dash-rec-name {
  flex: 1;
  font-family: var(--font-handwritten);
  font-size: 13.5px;
  color: var(--brown-deep);
}
.dash-rec-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-rec-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 600;
}
.dash-rec-tag.green { background: rgba(181, 196, 168, 0.4); color: var(--sage-deep); }
.dash-rec-tag.yellow { background: rgba(212, 165, 116, 0.3); color: var(--mustard); }
.dash-rec-cal {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}

/* "返回我的冰箱"按钮 */
.back-to-dash-btn {
  background: none;
  border: none;
  color: var(--brown-warm);
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.back-to-dash-btn:active { color: var(--pink-deep); }

/* ============================================================ */
/* v7 step 2：可替换图标系统                                     */
/* ============================================================ */
/* 统一 wrapper：getIngredientIcon() 输出的结构都是                */
/*   .ing-icon.ing-icon-<variant>                                 */
/*     ├── img.ing-icon-img    （ICON_MAP 有登记时）              */
/*     └── span.ing-icon-emoji-fallback                           */
/* img 加载失败时 onerror 把自己 display:none，露出 emoji span     */
/* ============================================================ */

.ing-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.ing-icon-img {
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.ing-icon-emoji-fallback {
  line-height: 1;
  display: inline-block;
}

/* —— variant: sticker（冰箱门 Dashboard 上的贴纸）—— */
.ing-icon-sticker {
  display: block;
  margin-bottom: 4px;
}
.ing-icon-sticker .ing-icon-img {
  width: 40px;
  height: 40px;
}
.ing-icon-sticker .ing-icon-emoji-fallback {
  font-size: 34px;
}

/* —— variant: list（管理冰箱完整列表）—— */
.ing-icon-list {
  display: block;
  /* v8.0-α post: 贴图变大跟字名小重叠 —— 旧 margin-bottom: 2px 让 icon 字间留白
   * 改成 -6px 让 icon 底部压住 ing-name 顶部一点点，视觉更紧凑、贴图占比更高 */
  margin-bottom: -6px;
  transition: filter 0.25s;        /* 配合 .ing-card:not(.have) 的灰度切换 */
}
.ing-icon-list .ing-icon-img {
  /* v8.0-α post: 贴图变大 32→52（+62%），让食材占卡片比从 ~40% 到 ~65% */
  width: 52px;
  height: 52px;
}
/* v8.0-α post 修：长按食材 PNG 会触发 iOS 长按图片预览（"贴图浮起来"的感觉）
 * 因为 -webkit-touch-callout: none 在 .ing-card 上不继承到子 img
 * 给 img 自己禁三件事：callout 菜单 / drag 拖拽 / pointer-events
 * 关键是 pointer-events: none 让事件穿透到 .ing-card 处理，浏览器以为没按图片
 * 影响范围：所有食材 PNG（管理页 ing-card + 首页冰箱 sticker）统一禁 */
.ing-icon-img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.ing-icon-list .ing-icon-emoji-fallback {
  /* 同步 emoji fallback 30→46，跟 PNG 视觉等大 */
  font-size: 46px;
}

/* —— variant: default（其它任何地方默认）—— */
.ing-icon-default .ing-icon-img {
  width: 28px;
  height: 28px;
}
.ing-icon-default .ing-icon-emoji-fallback {
  font-size: 24px;
}

/* ============================================================ */
/* v7.1：冰箱 board —— 背景层 + 食材层完全独立                    */
/* ============================================================ */

/* 冰箱机身 —— 背景层容器（米白渐变 + 内阴影 + 圆角 + 留 handle 位） */
.fridge-board {
  position: relative;
  /* v7.3 Phase A.5：消除"第二层壳" —— 删 gradient + box-shadow，纯 cream
   * v7.3 Phase A.8：彻底消除"白色框"
   *   根因：body 用 var(--cream) + 粉/绿 radial gradient 渐晕；
   *         .fridge-board 用纯 var(--cream)（没有 gradient）
   *         → 颜色相近但 body 周围有色变，board 显得"更白" → 像一张 cream 卡片
   *         → PNG 水彩 fade 边缘外侧露出这张卡片，看起来像"shell 外面还有一层白框"
   *   修复：background → transparent，让 body 的渐变透过 board 显示。
   *         PNG 中心透明区现在透出的是 body bg（带渐变），跟周围连成一片，
   *         视觉上"shell 外面 = body"，"shell 里面 = body"，无任何卡片感。
   * Tradeoff：PNG 加载失败时 board 变成"完全透明矩形" + 内容浮在 body 上，
   *           无 fridge 形状。但 Vercel 静态资产稳定，可接受。
   * 历史: Phase A.4 已删 border / 两条 inset shadow；A.5 已删 gradient / box-shadow。
   */
  background: transparent;
  border-radius: 28px;
  /* v7.3 A.14：padding 30/30 对称（消除偏右）
   * v7.3 A.16：缩到 22/22 给 sticker 更多空间放大
   *   handle 右沿 x=26，content 起点 x=22 → 视觉上有 4px 重叠区
   *   但 handle 是 12px 窄 pill，icon 是水彩 sticker（边缘大量透明像素），
   *   实际看上去几乎不冲突。如果你看着别扭再回 26/26 或 28/28。 */
  padding: 22px 22px 26px 22px;

  /* v7.2 Phase A.2：fridge 是固定物理对象 ——
   * 宽 = 屏幕宽度的 94%（上限 560 居中）
   * 高 = 100dvh 扣 header/nav/safe margin（不扣冰箱下的营养卡，
   *      允许整页 scroll 后看到营养卡）
   * clamp(560, 100dvh-170, 780): 保证小屏不缩到看不清，大屏不无限放大
   * box-sizing: border-box 让 padding 不超出 height
   * display: flex column 让 top/bottom zone 按比例分配 fridge 内部空间
   */
  box-sizing: border-box;
  width: min(94vw, 560px);
  margin: 4px auto 18px;
  height: clamp(560px, calc(100vh - 170px), 780px);   /* 老浏览器兜底 */
  height: clamp(560px, calc(100dvh - 170px), 780px);  /* 现代浏览器优先 */
  display: flex;
  flex-direction: column;
  z-index: 0;                  /* 建立 stacking context，让内部 overlay/内容 z-index 生效 */
}

/* ============================================================ */
/* v7.3 Phase A.3：fridge shell overlay（水彩外壳覆盖层）         */
/* ------------------------------------------------------------ */
/*  - 位于 fridge-board 背景 gradient 之上（z=1）                */
/*  - 所有交互/内容元素之下（z=2）                                */
/*  - pointer-events: none → 点击穿透 overlay 到 sticker/按钮    */
/*  - PNG 中心透明，让 sticker / 推荐 / 装饰透出来               */
/*  - 资产缺失（404）→ 浏览器不渲染 bg-image → CSS gradient 兜底 */
/* ============================================================ */
.fridge-shell-overlay {
  position: absolute;
  /* v7.3 Phase A.6：让 PNG shell 成为冰箱"最外层"
   *   inset: 0 → -8px：overlay 向 4 边各外溢 8px
   *   原因：PNG 水彩 outline 边缘天然有 fade，painted 部分缩在 PNG 中心一些；
   *         不外溢 → 视觉 outline 内嵌在 board 边里 → 看起来像 board 包着 overlay
   *         外溢 8px → painted outline 边缘落到 board 边界之外，覆盖了那一圈 cream
   *   pointer-events: none 仍然在 → 不挡点击；
   *   absolute 仍然在 → 不影响 layout；
   *   border-radius 28 → 32：overlay 比 board 大 16px，圆角等比略大保持视觉一致。
   */
  inset: -8px;
  z-index: 1;
  pointer-events: none;
  border-radius: 32px;
  background-image: url('../assets/fridge/shell/fridge-shell-overlay.png');
  background-size: 100% 100%;                /* 非等比拉伸填满（水彩可吸收 ±18% 拉伸）*/
  background-repeat: no-repeat;
  background-position: center;
}

/* 让所有交互/内容元素浮在 overlay 之上（z=2 vs overlay z=1）
 * 使用 :not(.fridge-shell-overlay) 让未来新增任何 fridge-board 子元素自动获 z=2 */
.fridge-board > *:not(.fridge-shell-overlay) {
  z-index: 2;
}

/* 把手 —— 左侧竖向 pill
 * v7.1.4：从纯装饰升级为"管理冰箱"入口按钮（element 从 <div> 改 <button>）
 * v7.3 Phase A.5：调成"真冰箱门把手"形态（初版）
 * v7.3 Phase A.6：把手贯穿门面（top: 28%, height: 40%）—— 太长了像第二条 shell 边
 * v7.3 Phase A.7：缩短 + 上移到 top-zone 居中靠左
 *   - top: 28% → 18%
 *   - height: 40% → 22%（spans fridge 18%-40%）
 *   - 把手中点落在 fridge 29% ≈ top-zone (0%-60%) 的垂直中部
 *   - 长度: 560 fridge → ~123px / 700 → ~154px / 780 → ~172px
 *   - 视觉上 handle 完全在 top-zone 内，不再跨过 divider
 *   - 宽度 12px / 圆角 6px / left 14px 不变
 */
.fridge-handle {
  position: absolute;
  left: 14px;
  /* v8.0-α post: 把手下移到 top-zone 下半部分 —— 真实双开门冰箱"上半门"的把手
   * 严格不超过 divider（60%），把手底部停在 58%，留 2% 缓冲
   * 旧 top: 18%; height: 22% 占 18%-40%，::after 扩大点击区到 14%-44%
   *   → 跟 sticker 第 1+2 行核心区抢点击，按把手时常按到食材
   * 新 top: 40%; height: 18% 占 40%-58%，落在 sticker 第 3 行上半 +
   *   top-zone 下边缘区
   *   → 跟 sticker 冲突区从 ~30% 降到 ~10%（且都在第 3 行边缘） */
  top: 40%;
  height: 18%;
  width: 12px;
  background: linear-gradient(180deg,
    rgba(140, 100, 70, 0.22) 0%,
    rgba(140, 100, 70, 0.32) 100%);
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 3px rgba(140, 100, 70, 0.16);
  /* button reset */
  border: none;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  /* 交互 */
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
/* 看不见的 tap 扩展区 —— 视觉 12px，点击范围 ~40px 宽 + 上下各延 12px，手机也好按 */
.fridge-handle::after {
  content: '';
  position: absolute;
  inset: -12px -14px;
}
/* 悬停：颜色加深 + 轻微加宽（暗示"可按"） */
.fridge-handle:hover {
  background: linear-gradient(180deg,
    rgba(140, 100, 70, 0.32) 0%,
    rgba(140, 100, 70, 0.48) 100%);
  width: 14px;
}
/* 按下：缩 + 颜色再加深（"按进去"的反馈） */
.fridge-handle:active {
  transform: scale(0.92);
  background: linear-gradient(180deg,
    rgba(140, 100, 70, 0.40) 0%,
    rgba(140, 100, 70, 0.55) 100%);
}
/* 键盘聚焦：粉色 outline，跟 App 整体色调一致 */
.fridge-handle:focus-visible {
  outline: 2px solid var(--pink-rose);
  outline-offset: 3px;
}

/* —— 装饰便签：通用基础 —— */
/* 全部 pointer-events: none，不抢食材层的点击 */
.fridge-deco-note {
  position: relative;
  background: #FDF6D3;          /* 淡黄便签 */
  border: 1px solid rgba(212, 165, 116, 0.20);
  border-radius: 4px;
  padding: 12px 16px 10px;
  box-shadow: 0 2px 6px rgba(140, 100, 70, 0.10);
  font-family: var(--font-handwritten);
  color: var(--brown-deep);
  text-align: center;
  pointer-events: none;
}

/* 主标题便签（在流中，居上） */
.fridge-deco-note.primary {
  max-width: 200px;
  margin: 0 auto 16px;
  transform: rotate(-1.5deg);
}
.fridge-deco-note.primary::before {
  /* 顶部小磁吸圆点 */
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brown-warm);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.fridge-deco-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
}
.fridge-deco-title .heart {
  color: var(--pink-deep);
  font-size: 15px;
  margin-left: 2px;
}
.fridge-deco-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.5px;
}

/* 侧边小便签（淡粉，绝对定位，胶带感） */
.fridge-deco-note.side {
  position: absolute;
  top: 22px;
  right: 14px;
  background: #FAEEE2;
  font-family: 'Caveat', cursive;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 0.5px;
  color: var(--brown-warm);
  padding: 8px 12px 6px;
  max-width: 84px;
  transform: rotate(3deg);
}
.fridge-deco-note.side::before {
  /* 顶部小胶带 */
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 8px;
  background: rgba(255, 243, 200, 0.7);
  border-radius: 1px;
}

/* —— 上下隔间分隔线（纯视觉，pointer-events: none） —— */
.fridge-divider {
  height: 4px;
  margin: 18px -10px 14px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(140, 100, 70, 0.14) 8%,
    rgba(140, 100, 70, 0.20) 50%,
    rgba(140, 100, 70, 0.14) 92%,
    transparent 100%);
  border-radius: 2px;
  position: relative;
  pointer-events: none;
}
.fridge-divider::after {
  /* 中间小凹槽，暗示"两个隔间" */
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  width: 44px;
  height: 5px;
  background: rgba(140, 100, 70, 0.10);
  border-radius: 0 0 8px 8px;
}

/* ============================================================ */
/* v7.2 Phase A：冰箱内部上下分区（mobile-first）                 */
/* ------------------------------------------------------------ */
/* TOP ZONE = stickers ("冰箱里有什么")                          */
/* BOTTOM ZONE = recommendations ("今天可以做什么")              */
/* 旧 .fridge-bottom-air（装饰空容器）由 .fridge-bottom-zone 取代 */
/* ============================================================ */

/* 上隔间 —— 容纳 stickers 或 empty state
 * v7.2 Phase A.2：fridge shell 决定高度，top-zone 按比例分配
 *   - fridge-board 是固定物理对象（高度 = clamp(560, dvh-170, 780)）
 *   - top-zone flex: 6 → 拿 fridge 内部 60% 高度
 *   - min-height: 0 让 flex 子项能正常收缩（默认 auto 会卡住）
 *   - overflow-y: auto：sticker 多到溢出 60% 配额时，zone 内部可滚
 *     （不撑高 fridge shell——这是"fridge 不被内容撑开"的关键）
 *
 * 旧 Phase A.1 的 min-height 480/350 已删除：那个值会撑开 fridge shell，
 * 跟 v7.2 Phase A.2 的"fridge 是物理对象、由屏幕决定高度"思路冲突。
 *
 * sticker 排布（几行几个、间距、散乱贴纸感）是下一步视觉细调，本阶段不动。
 */
.fridge-top-zone {
  position: relative;
  flex: 6 1 0;                  /* fridge 内 60% 高度（与 bottom-zone 4:6 分配） */
  min-height: 0;                /* 允许 flex 收缩 */
  display: flex;
  flex-direction: column;
  /* v7.3 Phase A.4：真冰箱不滚动 ——
   * 首页只显示 6 个代表性 sticker（JS cap），永远 2 行装得下；
   * 防御性 overflow: hidden 保险（极端缩放下也不会溢出冰箱）；
   * 完整食材管理走 handle → manage 页面，不是冰箱内部 scroll。*/
  overflow: hidden;
}

/* 空状态：填满整个 top zone 并柔和居中（占用同等空间，不让容器塌陷）*/
.fridge-top-zone > .ingredient-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 18px 16px 24px;      /* 空冰箱提示上提，避开左侧把手引导便签 */
  margin: 0;                    /* 让点击区域贴满整个 top zone */
  border-radius: 12px;
}

/* 下隔间 —— 推荐"灵感"区域，背景透明继承 fridge-board 的奶油渐变
 * v7.2 Phase A.2：
 *   - flex: 4 → fridge 内 40% 高度（与 top-zone 6:4 分配）
 *   - min-height: 0 + flex column 让标题 / 推荐 / footer 自然垂直堆叠
 *   - 故意 *不* 设 overflow-y auto：bottom-zone 内部不滚动，保 3 道菜稳定显示
 *   - 空间不够时通过压缩 row padding/font 解决（见下面 row 样式）
 *   - 真极小屏放不下再降级 2 道（JS 改，本阶段不做）
 */
.fridge-bottom-zone {
  position: relative;
  /* v8.0-α: 左右 padding 2px → 14px，整体内容（标题 / 推荐行 / 查看全部）往内收，不再溢出 fridge PNG 边界 */
  padding: 4px 14px 8px;
  flex: 4 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* v7.3 Phase A.9：推荐块垂直居中在 bottom-zone 内部
   * 因为 row 缩到 2 行后整块高度变小，居中比顶部对齐看上去更稳 */
  justify-content: center;
}

/* 下隔间标题行 —— 标题 + ↻换一换 同行 */
.fridge-section-header {
  /* v8.1 P6D：三段栅格 —— 左 toggle / 中标题（真居中）/ 右换一组 */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 4px 4px 10px;
}
.fridge-section-title {
  font-family: var(--font-handwritten);
  font-size: 13.5px;          /* v7.3 A.12: 14.5 → 13.5 整体缩小一号 */
  font-weight: 600;
  color: var(--pink-deep);    /* v8.1 P6D：brown-deep → pink-deep */
  letter-spacing: 0.5px;
  text-align: center;
}

/* v8.1 P6D：推荐区 🧊/🧺 模式 toggle */
.rec-mode-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-self: start;
}
.rec-mode-shuffle {
  justify-self: end;
}
.rec-mode-icon {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.38;              /* 未选 = 暗 */
  transition: opacity 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.rec-mode-icon.active {
  opacity: 1;
  background: var(--pink-soft);
  transform: scale(1.05);
}
.rec-mode-icon:active {
  transform: scale(0.9);
}
.ui-icon-emoji {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}
.ui-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

/* 下隔间推荐行
 * v7.3 A.11：严格固定单行结构 —— 不流式排版
 *
 * 视觉目标：「冰箱上的快速菜谱提示」，不是「健康分析卡」
 * row layout:
 *   [emoji 24px] [LEFT 弹性 ........] [RIGHT 固定]
 *                ┗ name + chips      ┗ 能做 + kcal
 *
 * 强约束：
 *   - row height: 44px 固定，不被内容撑高
 *   - row overflow: hidden，chips 超过宽度自动裁切
 *   - left: flex: 1 grow + shrink + min-width: 0（允许内容收缩）
 *   - right: flex: 0 0 auto（永远不缩，始终贴右）
 *   - name: nowrap + ellipsis（超长截断）
 *   - chips: nowrap + overflow hidden（多了切掉，不换行）
 *   - 不显示 reason、不显示任何 explanation text
 */
.fridge-bottom-zone .dash-rec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 44px;                              /* 固定行高 */
  /* v8.0-α: 外层 bottom-zone 已给 14px 左右 padding，行内只留 2px 微调 */
  padding: 0 2px 0 4px;
  border-bottom: 1px solid rgba(140, 100, 70, 0.10);
  overflow: hidden;
  cursor: pointer;
}
.fridge-bottom-zone .dash-rec-row:last-child {
  border-bottom: none;
}
.fridge-bottom-zone .dash-rec-row:active {
  background: rgba(255, 255, 255, 0.35);
}
.fridge-bottom-zone .dash-rec-emoji {
  font-size: 24px;
  line-height: 1;
  flex: 0 0 auto;
}

/* LEFT 组：name + chips —— 弹性收缩，超出 hidden */
.fridge-bottom-zone .dash-rec-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;                              /* 允许收缩 */
  overflow: hidden;
}
.fridge-bottom-zone .dash-rec-name {
  font-size: 12.5px;                         /* v7.3 A.12: 13.5 → 12.5 */
  font-weight: 600;
  color: var(--brown-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;                            /* 内容宽，可缩到 ellipsis */
  min-width: 0;
}
.fridge-bottom-zone .dash-rec-chips {
  display: flex;
  gap: 3px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;                          /* chips 多了直接切，不换行 */
}
.fridge-bottom-zone .dash-rec-ing-tag {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 1px rgba(140, 100, 70, 0.04);
  font-size: 9px;                            /* v7.3 A.12: 10 → 9 */
  padding: 1px 6px;                          /* 配合字号微缩，padding 7 → 6 */
  white-space: nowrap;
  flex: 0 0 auto;                            /* 单个 chip 不缩，要么完整显示要么被切 */
}

/* v7.3 A.12：bottom-zone 内 typography 整体缩小一号
 * 让推荐区更轻、更紧凑，不抢冰箱主体视觉。仅 font-size，不改 layout。 */
.fridge-bottom-zone .dash-rec-tag {
  font-size: 9px;                            /* 全局 .dash-rec-tag 是 10，scoped 缩到 9 */
}
.fridge-bottom-zone .dash-rec-cal {
  font-size: 9.5px;                          /* 全局 .dash-rec-cal 是 10.5，缩到 9.5 */
}
.fridge-bottom-zone .dash-shuffle-btn {
  font-size: 10px;                           /* 全局 11 → 10 */
}
.fridge-bottom-zone .dash-view-all {
  font-size: 13px;                           /* 全局 14 (Caveat) → 13 */
}

/* RIGHT 组：能做 + kcal —— 永远不缩，固定贴右 */
.fridge-bottom-zone .dash-rec-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;                            /* 关键：永不缩，永远贴右 */
}

/* section header / footer 紧凑 */
.fridge-bottom-zone .fridge-section-header {
  margin: 2px 4px 6px;
}
.fridge-bottom-zone .dash-card-foot {
  margin-top: 4px;
  padding-top: 2px;
}

/* 冰箱外 —— 营养小目标卡 */
.below-fridge {
  padding: 0 4px;
  margin-top: 4px;
}
.below-fridge .dash-card {
  margin-bottom: 14px;
}

/* ============================================================ */
/* 食材层 —— 动态 grid，独立于背景层                              */
/* 不绝对定位 / 不写死坐标 / 未来 drag / sort / filter 都靠这层    */
/* 实际生效的样式定义在更下面的 v7.1.1 节                          */
/* (.fridge-sticker-zone / .fridge-sticker / .sticker-label)      */
/* ============================================================ */

/* "← 还有 N 样 · 点把手查看" 跳转 manage
 * v7.3 Phase A.4：左对齐贴近 handle，让用户视觉上把"还有更多"和"把手"关联起来 */
.fridge-more-link {
  text-align: left;
  font-family: 'Caveat', cursive;
  font-size: 13px;
  color: var(--pink-deep);
  margin: auto 4px 2px 0;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.2s;
  align-self: flex-start;
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
}
.fridge-more-link:hover { background: rgba(245, 217, 210, 0.30); }
.fridge-more-link:active { background: rgba(245, 217, 210, 0.45); }

/* 空状态 —— 整块可点击跳 manage */
.ingredient-empty {
  text-align: center;
  padding: 40px 16px 28px;
  cursor: pointer;
  border-radius: 16px;
  transition: background 0.2s;
  margin: 0 4px;
  -webkit-tap-highlight-color: transparent;
}
.ingredient-empty:hover { background: rgba(245, 217, 210, 0.18); }
.ingredient-empty:active { background: rgba(245, 217, 210, 0.30); }
.ingredient-empty .empty-emoji {
  font-size: 44px;
  display: block;
  margin-bottom: 10px;
}
.ingredient-empty p {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  color: var(--brown-warm);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.ingredient-empty .empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Caveat', cursive;
  letter-spacing: 0.5px;
}

/* ============================================================ */
/* v7.1.1：冰箱贴风格 —— 去掉白色卡片，max-width，加 basket 状态  */
/* ============================================================ */

/* Dashboard 整体限宽 —— mobile-first，桌面端就是"放大的手机视图"居中
   v7.2 Phase A：从 760 降到 560，去掉 1024px 双列分支
   设计意图：冰箱永远是主视觉，桌面不做复杂横向布局 */
#fridge-dashboard {
  max-width: 560px;
  margin: 0 auto;
}

/* 食材层容器 —— 独立于 .fridge-board 背景层
 * v7.3 A.13：layout-driven 重构 ——
 *   - 列数由 JS 加的 .sz-* class 控制（不再受屏幕断点影响）
 *   - sticker 数量决定 layout 和 icon 大小
 *   - spacing 收紧（gap 20/10 → 10/6, padding 12-18 → 6-10）
 *   - 删除原 @media (min-width: 480px) 的 4 列规则（layout 不再随屏幕）
 */
.fridge-sticker-zone {
  display: grid;
  /* grid-template-columns 由 .sz-* 控制
   * v7.3 A.17："冰箱贴 pile" —— row-gap 8→4 让上下行更紧凑
   * 横向靠 icon 大于 cell 自然 overflow 实现重叠（见 sz-* icon size） */
  gap: 0;                        /* v7.3 A.22: 2 → 0，cell 紧贴 */
  padding: 0 0 4px;              /* v7.3 A.22: 上下左右挤到最紧 */
  position: relative;
  /* overflow 默认 visible，让 icon 突破 cell 跟邻居重叠 */
}

/* Layout classes：N 个 sticker → 列数 */
.fridge-sticker-zone.sz-1   { grid-template-columns: 1fr; justify-items: center; }
.fridge-sticker-zone.sz-2   { grid-template-columns: repeat(2, 1fr); }
.fridge-sticker-zone.sz-3   { grid-template-columns: repeat(3, 1fr); }
.fridge-sticker-zone.sz-2x2 { grid-template-columns: repeat(2, 1fr); }
.fridge-sticker-zone.sz-3x2 { grid-template-columns: repeat(3, 1fr); }
.fridge-sticker-zone.sz-4x2 { grid-template-columns: repeat(4, 1fr); }
.fridge-sticker-zone.sz-3x3 { grid-template-columns: repeat(3, 1fr); }
.fridge-sticker-zone.sz-4x3 { grid-template-columns: repeat(4, 1fr); }

/* 单个食材贴纸 —— 真"冰箱贴"，没有白色卡片，icon 直接浮在冰箱上
 * v7.3 A.14：gap 6 → 2，label 贴近 icon
 * v7.3 A.15：gap 2 → 0，配合 label margin-top: -8px 让 label 压进 icon 底部 */
.fridge-sticker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 4px 2px;
  background: transparent;                 /* 关键：透明，不是白色卡片 */
  border: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* button reset */
  font-family: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;                           /* v8.1 Step 7：去掉浏览器默认 focus 方框 */
}
.fridge-sticker:focus,
.fridge-sticker:focus-visible,
.fridge-sticker:active { outline: none; }
.fridge-sticker::-moz-focus-inner { border: 0; }    /* Firefox button 内部 border */

/* 自然错位（v7.3 A.18：wrapper 不超 cell 后，rotation 回温和 ±2deg / translate ±2px）
 * 5px cell 余地保证 transform 不冲出 cell，sticker 严格在 fridge 内
 * hover/active 加 z-index: 5 让被点中的 sticker 浮到最上层 */
.fridge-sticker:nth-child(5n+1) { transform: rotate(-1.5deg) translate( 1px, -1px); }
.fridge-sticker:nth-child(5n+2) { transform: rotate( 1deg)   translate(-1px,  1px); }
.fridge-sticker:nth-child(5n+3) { transform: rotate(-2deg)   translate( 0,    2px); }
.fridge-sticker:nth-child(5n+4) { transform: rotate( 1.5deg) translate( 2px,  0); }
.fridge-sticker:nth-child(5n+5) { transform: rotate(-0.5deg) translate(-1px, -2px); }
.fridge-sticker:hover  { transform: rotate(0) translate(0, 0) scale(1.08); z-index: 5; }
.fridge-sticker:active { transform: rotate(0) translate(0, 0) scale(0.92); z-index: 5; }

/* icon wrapper：viewport 行为（v7.3 A.18）
 * 关键：PNG 自带 ~50% 透明边距，所以 img 直接放大会让透明边伸出 cell。
 *      改用 wrapper 锁死 cell 大小 + overflow:hidden，
 *      img 内部 transform: scale(1.7) 放大食物本体（透明边被裁掉）。
 *      → 可视食物从 ~50% wrapper 变到 ~85% wrapper，且不外溢 */
.fridge-sticker .ing-icon-sticker {
  display: inline-block;
  overflow: hidden;
  border-radius: 12px;                          /* 软化矩形裁切边 */
  transition: filter 0.25s;
  position: relative;
}
.fridge-sticker .ing-icon-img {
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(1.5);                        /* 关键：放大图像内部，裁掉透明边 */
  transform-origin: center;
  /* 食物本体投影（被 wrapper overflow:hidden 裁，所以阴影主要落在 wrapper 内部）*/
  filter: drop-shadow(0 2px 4px rgba(140, 100, 70, 0.18));
}
/* default fallback 大小（layout class 缺失时兜底） */
.fridge-sticker .ing-icon-sticker { width: 52px; height: 52px; }
.fridge-sticker .ing-icon-emoji-fallback { font-size: 46px; }

/* per-layout wrapper size + emoji fallback size
 * v7.3 A.22：gap 归 0 后，wrapper 比 cell 略大，让边边轻微重叠
 *   mobile cell (board 22/22, zone-pad 0, gap 0):
 *     sz-4x3/4x2 cell = 308/4 = 77, wrapper 84 → 各方向溢出 3.5px = 7px 邻居重叠
 *     sz-3x*     cell = 308/3 ≈ 102, wrapper 110 → 4px 溢出 = 8px 重叠
 *     sz-2x*     cell = 308/2 = 154, wrapper 162 → 4px 溢出 = 8px 重叠
 *     sz-1       wrapper 200（单图，不需要满）*/
/* v7.3 A.23/A.24: wrapper × 0.85 → 再 × 0.9 = 总 -23.5% vs A.22 */
.fridge-sticker-zone.sz-1   .ing-icon-sticker { width: 153px; height: 153px; }
.fridge-sticker-zone.sz-1   .ing-icon-emoji-fallback { font-size: 131px; }

.fridge-sticker-zone.sz-2   .ing-icon-sticker { width: 124px; height: 124px; }
.fridge-sticker-zone.sz-2   .ing-icon-emoji-fallback { font-size: 107px; }

.fridge-sticker-zone.sz-3   .ing-icon-sticker { width: 85px; height: 85px; }
.fridge-sticker-zone.sz-3   .ing-icon-emoji-fallback { font-size: 72px; }

.fridge-sticker-zone.sz-2x2 .ing-icon-sticker { width: 124px; height: 124px; }
.fridge-sticker-zone.sz-2x2 .ing-icon-emoji-fallback { font-size: 107px; }

.fridge-sticker-zone.sz-3x2 .ing-icon-sticker { width: 85px; height: 85px; }
.fridge-sticker-zone.sz-3x2 .ing-icon-emoji-fallback { font-size: 72px; }

.fridge-sticker-zone.sz-4x2 .ing-icon-sticker { width: 65px; height: 65px; }
.fridge-sticker-zone.sz-4x2 .ing-icon-emoji-fallback { font-size: 56px; }

.fridge-sticker-zone.sz-3x3 .ing-icon-sticker { width: 85px; height: 85px; }
.fridge-sticker-zone.sz-3x3 .ing-icon-emoji-fallback { font-size: 72px; }

.fridge-sticker-zone.sz-4x3 .ing-icon-sticker { width: 65px; height: 65px; }
.fridge-sticker-zone.sz-4x3 .ing-icon-emoji-fallback { font-size: 56px; }

/* 食材名字 —— 奶油色小标签纸（不是大白卡）
 * v7.3 A.14：padding 缩 + 字号微缩
 * v7.3 A.15：margin-top: -8px 把 label 拉上去压进 icon 底沿
 *   - position: relative + z-index: 1 确保 label 在 icon drop-shadow 之上
 *   - DOM 顺序 icon → label，label 天然渲染在上
 *   - 视觉效果：食材名"贴"在食材底部，连成一个整体的"冰箱贴" */
.sticker-label {
  font-family: var(--font-handwritten);
  font-size: 10px;
  color: var(--brown-deep);
  background: rgba(255, 248, 235, 0.85);
  padding: 1px 7px;
  border-radius: 8px;
  letter-spacing: 0.3px;
  line-height: 1.3;
  white-space: nowrap;
  margin-top: -16px;             /* v7.3 A.20: -14 → -16 再压紧一点 */
  position: relative;
  z-index: 1;
  box-shadow:
    0 1px 2px rgba(140, 100, 70, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ====== 已加入菜篮子的视觉态（v8.1 Step 7 polish：保留 ✓ + glow + label 高亮，不加方框）====== */
/* 注意：不给 .in-basket 加 background / border / box-shadow（避免出现方形框），
   视觉反馈只靠 ✓ 角标、icon glow、label 文色三件 */
.fridge-sticker.in-basket .ing-icon-sticker {
  filter:
    drop-shadow(0 0 5px rgba(232, 180, 166, 0.55))
    drop-shadow(0 2px 4px rgba(140, 100, 70, 0.15));
}
/* 标签变浅粉，文色降权到暖棕（不再深珊瑚） */
.fridge-sticker.in-basket .sticker-label {
  background: var(--pink-soft);
  color: var(--brown-warm);
  font-weight: 600;
}
/* 右上小 ✓ 角标：缩小 + 软色 + 降透明 */
.fridge-sticker.in-basket::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 6px;
  width: 14px;
  height: 14px;
  background: var(--pink-rose);
  color: white;
  opacity: 0.85;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(140, 100, 70, 0.18);
}

/* ============================================================ */
/* v7.1.2：dashboard 卡片视觉升级（推荐 / 今日小记）              */
/* ============================================================ */

/* —— 卡片头部：标题 + 右侧"换一换"按钮 —— */
.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.dash-card-header .dash-card-title {
  margin-bottom: 0;          /* 头部 flex 已经控制间距 */
}
.dash-shuffle-btn {
  background: var(--cream-deep);
  border: none;
  border-radius: 100px;
  padding: 5px 12px;
  font-family: 'Quicksand', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.dash-shuffle-btn:hover {
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.dash-shuffle-btn:active {
  transform: scale(0.95);
}

/* —— 推荐行内 body（name + ingredient tag chips） —— */
.dash-rec-row {
  align-items: flex-start;   /* tag 多了可能换行，让顶部对齐 */
}
.dash-rec-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.dash-rec-name {
  font-family: var(--font-handwritten);
  font-size: 13.5px;
  color: var(--brown-deep);
  line-height: 1.3;
}
.dash-rec-ings {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dash-rec-ing-tag {
  background: var(--cream-deep);
  color: var(--text-soft);
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 100px;
  font-family: 'Quicksand', 'Noto Serif SC', sans-serif;
  letter-spacing: 0.2px;
}
.dash-rec-ing-tag.more {
  background: rgba(212, 165, 116, 0.18);
  color: var(--mustard);
  font-weight: 600;
}

/* —— 推荐卡底部 "查看全部 →" —— */
.dash-card-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 6px;
}
.dash-view-all {
  background: none;
  border: none;
  color: var(--pink-deep);
  font-family: 'Caveat', cursive;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.dash-view-all:hover { background: rgba(245, 217, 210, 0.30); }
.dash-view-all:active { background: rgba(245, 217, 210, 0.45); }

/* ============================================================ */
/* 今日小记 —— 大字 kcal + 进度条                                */
/* ============================================================ */
.dash-today-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-today-num {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px;
}
.dash-today-num .big {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  font-weight: 700;
  color: var(--pink-deep);
  line-height: 1;
}
.dash-today-num .big.over {
  color: var(--pink-deep);
  /* 超目标时数字稍重 */
  text-shadow: 0 0 1px var(--pink-rose);
}
.dash-today-num .goal {
  font-family: 'Caveat', cursive;
  font-size: 17px;
  color: var(--text-muted);
  margin-left: 2px;
}
.dash-today-num .unit {
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.5px;
  margin-left: 2px;
}
.dash-today-pct {
  margin-left: auto;
  background: var(--cream-deep);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 100px;
}
.dash-today-pct.over {
  background: rgba(201, 132, 111, 0.18);
  color: var(--pink-deep);
}
.dash-today-bar {
  height: 7px;
  background: var(--cream-deep);
  border-radius: 100px;
  overflow: hidden;
}
.dash-today-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, #F5D9D2, #E8B4A6);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.dash-today-bar-fill.over {
  background: linear-gradient(90deg, #E8A0A0, #C66060);
}
.dash-today-foot {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-align: right;
  margin-top: 2px;
}

/* ============================================================ */
/* v7.2 Phase A：mobile-first，不再做桌面双列                     */
/* ------------------------------------------------------------ */
/* 旧 v7.1.3 的 @media (min-width: 1024px) 双列规则已删除         */
/* 桌面端就是"放大的手机视图"，由 #fridge-dashboard max-width:560 */
/* 直接居中实现，冰箱永远是单列竖向主视觉                          */
/* ============================================================ */

/* ===== v7.x 阶段 2：智能推荐 reason 短句 =====
 * 文案规范：短、柔、有生活感
 * UI 永不展示 score / nutritionScore / balanceScore —— 只展示 reason 这一行
 * 风格：手写字体 + soft 灰，融入米白底，不抢戏 */

.dash-rec-reason {
  font-family: var(--font-handwritten);
  font-size: 11.5px;
  color: var(--text-soft);
  line-height: 1.3;
  letter-spacing: 0.3px;
  margin-top: 1px;
}

/* v8.0-α post 再调：reason 跟 cal 同行贴底
 *   Suki 反馈：reason 在 cal 上面看着别扭，要跟 cal 同行
 *   位置：bottom: 6px 跟 cal 同行；left: 70px 避开 cal 标签宽度；right: 10px 避免溢出
 *   字号略缩到 9px 让出空间 */
/* ===== v7.4: 搜索框（菜谱页 All 模式 + 管理页常驻） ===== */
.search-bar {
  display: flex;
  align-items: center;
  background: white;
  border: 1.5px solid var(--cream-deep);
  border-radius: 100px;
  padding: 3px 6px 3px 4px;
  margin: 0 4px 10px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}
.search-bar:focus-within {
  border-color: var(--pink-rose);
}
.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 8px 10px;
  font-family: var(--font-base);
  font-size: 13px;
  color: var(--text-primary);
}
.search-input::placeholder {
  color: var(--text-soft);
  opacity: 0.7;
}
.search-clear {
  display: none;            /* 默认隐藏，setDishSearch/setIngSearch 有值时改 flex */
  flex: 0 0 24px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--cream-deep);
  color: var(--text-soft);
  font-size: 11px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.search-clear:active { background: var(--pink-soft); color: var(--pink-deep); }
.search-result-count {
  font-size: 11px;
  color: var(--text-soft);
  padding: 0 8px 8px;
  letter-spacing: 0.3px;
}

/* ===== v7.4.1: 补录强提示 banner（today tab 顶部，state.currentDate 非今日时显示） ===== */
.editing-past-banner {
  display: flex;                /* 由 JS toggle 到 none/flex */
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, #F5E0C8, #EFD0A8);
  border: 1.5px solid #E0B888;
  border-radius: 14px;
  padding: 10px 14px;
  margin: 0 4px 12px;
  box-shadow: 0 2px 10px rgba(180, 120, 60, 0.15);
}
.editing-past-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #7A5530;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.editing-past-icon {
  font-size: 16px;
  flex: 0 0 auto;
}
.editing-past-text strong {
  font-weight: 700;
  color: #5A3F1E;
}
.editing-past-back-btn {
  flex: 0 0 auto;
  background: white;
  border: 1.5px solid #C9A06A;
  color: #7A5530;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.editing-past-back-btn:active {
  background: #C9A06A;
  color: white;
  transform: scale(0.96);
}

/* ===== v7.4.2: day-detail-card 底部"编辑这天"按钮区 ===== */
.day-detail-actions {
  padding: 12px 14px 4px;
  border-top: 1px dashed var(--cream-deep);
  margin-top: 10px;
}
.day-detail-sub {
  font-size: 12px;
  color: var(--text-soft);
  margin: 0 0 10px;
  line-height: 1.4;
}
.day-detail-edit-btn {
  width: 100%;
  background: var(--pink-soft);
  color: var(--pink-deep);
  border: 1.5px solid var(--pink-rose);
  border-radius: 100px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}
.day-detail-edit-btn:active {
  background: var(--pink-rose);
  color: white;
  transform: scale(0.98);
}

/* ===== v7.4.2: 补录态 inline 搜菜（quick-add） ===== */
.quick-add-dish-bar {
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  margin: 0 4px 12px;
  box-shadow: var(--shadow);
  border: 1px dashed #C9A06A;  /* 跟 banner 同一暖色，提示这是补录专属 */
}
.quick-add-label {
  font-size: 12px;
  color: #7A5530;
  font-weight: 600;
  margin-bottom: 8px;
}
.quick-add-input-wrap {
  display: flex;
}
.quick-add-input {
  flex: 1;
  border: 1.5px solid var(--cream-deep);
  border-radius: 100px;
  padding: 8px 14px;
  font-family: var(--font-base);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  background: var(--cream);
  transition: border-color 0.2s ease;
}
.quick-add-input:focus {
  border-color: var(--pink-rose);
  background: white;
}
.quick-add-input::placeholder {
  color: var(--text-soft);
  opacity: 0.7;
}
.quick-add-results {
  margin-top: 10px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.quick-add-row {
  display: flex; align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--cream-deep);
  border-radius: 10px;
}
.quick-add-emoji { font-size: 18px; flex: 0 0 auto; }
.quick-add-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  flex: 0 0 auto;
  white-space: nowrap;
}
.quick-add-meta {
  font-size: 10px;
  color: var(--text-soft);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-add-btn {
  flex: 0 0 28px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--pink-rose);
  color: white;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.quick-add-btn:active { background: var(--pink-deep); transform: scale(0.9); }
.quick-add-btn.added {
  background: var(--sage-deep);
  cursor: default;
}
.quick-add-empty {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
}
.quick-add-empty > div { margin-bottom: 8px; }
.quick-add-goto-menu {
  background: white;
  border: 1.5px solid var(--pink-rose);
  color: var(--pink-deep);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
}
.quick-add-goto-menu:active { background: var(--pink-soft); }

/* ============================================================
   v8.0-α: 搭配 tab (plan) 所有新组件
   ============================================================ */

/* ===== 营养试算表 ===== */
.nutrition-estimate-card {
  border-radius: 18px;
  /* v8.0-α post: 整体收紧 padding，sticky 时占屏少；统一缩，不分 sticky 状态 */
  padding: 10px 14px;
  margin: 0 4px 12px;
  box-shadow: var(--shadow);
  /* sticky 浮动，下滑时一直贴在屏幕顶部，方便实时看草稿对营养的影响 */
  position: sticky;
  top: 8px;
  z-index: 50;
  /* 半透明 + backdrop-filter blur：底下内容糊成色块，字不抢；浮起来感觉更轻盈 */
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.estimate-row {
  /* v8.0-α post: padding 8 → 5，6 行省 ~36px */
  padding: 5px 0;
  border-bottom: 1px dashed var(--cream-deep);
}
.estimate-row:last-child { border-bottom: none; }
.estimate-row-head {
  display: flex; justify-content: space-between; align-items: baseline;
  /* margin-bottom 5 → 3，6 行省 ~12px */
  margin-bottom: 3px;
}
.estimate-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
}
.estimate-value {
  font-size: 12px;
  color: var(--text-soft);
}
.estimate-value strong {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  margin-right: 2px;
}
.estimate-goal { color: var(--text-muted); margin-right: 4px; }
.estimate-delta {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  color: var(--pink-deep);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 100px;
  background: rgba(245, 217, 210, 0.5);
}
.estimate-row.warn .estimate-value strong { color: var(--pink-deep); }
/* 进度条 = flex 横排，inline width% 控制每段宽度 */
.estimate-bar {
  display: flex;
  align-items: stretch;
  /* v8.0-α post: height 6 → 5，6 行省 ~6px */
  height: 5px;
  background: var(--cream-deep);
  border-radius: 100px;
  overflow: hidden;
}
/* 已记录部分（sage 渐变，从左起） */
.estimate-bar-recorded {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--sage-deep));
  transition: width 0.3s ease;
}
/* 草稿增量部分（pink-rose，紧跟在已记录后面） */
.estimate-bar-draft {
  height: 100%;
  background: linear-gradient(90deg, var(--pink-rose), var(--pink-deep));
  transition: width 0.3s ease;
}
/* 超目标小标记（推到最右，仅 overshoot > 0 时渲染） */
.estimate-bar-over-mark {
  flex: 0 0 6px;
  background: var(--pink-deep);
  margin-left: auto;
}

/* ===== 草稿区 ===== */
.draft-section {
  background: white;
  border-radius: 18px;
  padding: 14px 16px;
  margin: 0 4px 12px;
  box-shadow: var(--shadow);
}
.draft-summary {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}
.draft-list {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.draft-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--cream-deep);
  border-radius: 12px;
}
.draft-emoji { font-size: 20px; flex: 0 0 auto; }
.draft-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.draft-cal {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
}
.draft-remove {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  border: none; border-radius: 50%;
  background: white;
  color: var(--text-soft);
  font-size: 16px; line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}
.draft-remove:active {
  background: var(--pink-rose);
  color: white;
}
.draft-confirm-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--pink-rose), var(--pink-deep));
  color: white;
  border: none;
  border-radius: 100px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(201, 132, 111, 0.35);
  transition: all 0.2s ease;
}
.draft-confirm-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(201, 132, 111, 0.25);
}
.draft-empty {
  text-align: center;
  padding: 24px 16px 18px;
}
.draft-empty-emoji {
  font-size: 38px;
  display: block;
  margin-bottom: 8px;
}
.draft-empty p {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.draft-empty-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== 今日已记录摘要 ===== */
.today-record-summary { margin: 0 4px 12px; }
.trs-card {
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.trs-card.empty {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-soft);
}
.trs-icon { font-size: 14px; }
.trs-text { color: var(--text-soft); }
.trs-header {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
  user-select: none;
}
.trs-title {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-primary);
}
.trs-toggle {
  font-size: 10px;
  color: var(--text-soft);
}
.trs-list {
  margin-top: 10px;
  display: flex; flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--cream-deep);
  border-radius: 10px;
}
.trs-item {
  font-size: 12px;
  color: var(--text-primary);
}
.trs-jump-btn {
  margin-top: 10px;
  width: 100%;
  background: var(--pink-soft);
  color: var(--pink-deep);
  border: 1.5px solid var(--pink-rose);
  border-radius: 100px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.trs-jump-btn:active {
  background: var(--pink-rose);
  color: white;
  transform: scale(0.98);
}

/* ===== 冰箱首页"今日搭配入口"卡 ===== */
.plan-entry-card { padding: 14px 16px; }
.plan-entry-empty {
  display: flex; align-items: center; gap: 12px;
}
.plan-entry-emoji {
  font-size: 32px;
  flex: 0 0 auto;
}
.plan-entry-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.plan-entry-sub {
  font-size: 11.5px;
  color: var(--text-soft);
  line-height: 1.4;
}
.plan-entry-active {
  display: flex; align-items: center;
}
.plan-entry-status {
  display: flex; align-items: center; gap: 12px;
  flex: 1;
}

/* ===== 菜谱卡 v8.0 新视觉态 ===== */
/* 草稿中（搭配 tab 单击加入）—— 浅金边 + 📋 角标 */
/* v8.0-α post 再修：in-draft 改成 sage 绿色描边（跟 added 的 pink 系完全错开）
 *   Suki 反馈：草稿框跟已吃要颜色区分开
 *   sage 绿色 = "新鲜选中、还在试算中"，跟营养试算表的"已记录"段 sage 色呼应
 *   added 是整卡 pink 渐变（嵌入背景的标签），in-draft 是 sage 描边（被点选的轮廓） */
.dish-card.in-draft {
  border: 2px solid var(--sage-deep);
  box-shadow: 0 2px 12px rgba(122, 146, 112, 0.30);
}
/* v8.0-α 修正：⋯ 详情按钮放卡片右上角，不再跟份量 / 热量 / tag 重叠 */
.dish-more-btn {
  position: absolute;
  top: 4px; right: 4px;
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-soft);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(140, 100, 70, 0.15);
  z-index: 3;
  display: flex; align-items: center; justify-content: center;
}
.dish-more-btn:active {
  background: var(--pink-rose);
  color: white;
  transform: scale(0.92);
}
/* v8.0-α post: in-draft 不再变色，⋯ 按钮也保持普通样式（不再加金边） */

/* ===== v7.4.4: 空冰箱时的把手引导便签 + 把手呼吸动画 ===== */
/* 便签贴在把手右侧（冰箱内部），告诉用户那条是门把手能打开 */
.fridge-hint-note {
  position: absolute;
  /* v8.0-α post: 把手下移到 top: 40% height: 18%（占 40%-58%），便签跟着下移
   *   把手垂直中点 = 49%，便签 top: 44% 让指向把手中段更准 */
  left: 36px;
  top: 44%;
  z-index: 4;
  background: #FDF6D3;          /* 跟现有 deco-note 同款淡黄便签 */
  color: #7A5530;
  font-family: 'Caveat', cursive;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 7px 12px;
  border-radius: 4px;
  border: 1px solid rgba(212, 165, 116, 0.25);
  box-shadow: 0 2px 8px rgba(140, 100, 70, 0.18);
  transform: rotate(-3deg);
  pointer-events: none;
  /* 进入动画：从无到有轻弹一下，吸引视线 */
  animation: hint-note-pop 0.6s ease-out 0.3s both, hint-note-sway 4s ease-in-out 1.2s infinite;
}
/* 顶部小胶带（跟 .fridge-deco-note.side 的胶带视觉一致） */
.fridge-hint-note::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 18%;
  width: 22px;
  height: 8px;
  background: rgba(212, 165, 116, 0.3);
  border-radius: 1px;
  transform: rotate(-2deg);
}
@keyframes hint-note-pop {
  0%   { opacity: 0; transform: rotate(-3deg) scale(0.6) translateY(-4px); }
  60%  { opacity: 1; transform: rotate(-3deg) scale(1.06); }
  100% { opacity: 1; transform: rotate(-3deg) scale(1); }
}
@keyframes hint-note-sway {
  /* 慢节奏轻摇，每 4 秒一次，3 秒静止 1 秒动 —— 不打扰但被余光捕捉得到 */
  0%, 75%, 100% { transform: rotate(-3deg); }
  82% { transform: rotate(-5deg) translateX(-1px); }
  90% { transform: rotate(-1deg) translateX(1px); }
}

/* 把手"准备被点"动画：仅在空态加 .guide-pulse 类时生效 */
@keyframes handle-guide-pulse {
  /* 90% 时间静止 + 10% 时间高亮 + 微胀。呼吸感 ≠ 闪烁感 */
  0%, 85%, 100% {
    background: linear-gradient(180deg,
      rgba(140, 100, 70, 0.22) 0%,
      rgba(140, 100, 70, 0.32) 100%);
    transform: scaleY(1);
  }
  92% {
    background: linear-gradient(180deg,
      rgba(201, 132, 111, 0.45) 0%,
      rgba(201, 132, 111, 0.6) 100%);  /* pink-deep 高亮提示 */
    transform: scaleY(1.04);
  }
}
.fridge-handle.guide-pulse {
  animation: handle-guide-pulse 3s ease-in-out infinite;
}
/* hover / active 时停掉引导动画 —— 用户已经发现它了，不需要再提醒 */
.fridge-handle.guide-pulse:hover,
.fridge-handle.guide-pulse:active {
  animation: none;
}

/* v7.4: 食材搜索结果上的 cat 小标签（top-left，避开 top-right 的菜篮子 ✓） */
.ing-card .ing-cat-tag {
  position: absolute;
  top: 4px; left: 4px;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 100px;
  background: var(--cream-deep);
  color: var(--text-soft);
  line-height: 1.5;
  letter-spacing: 0.3px;
  pointer-events: none;
}

/* v8.2 i18n: 英文比中文长，移动端优先保证控件不撑破、不影响底栏 fixed 锚点 */
body.lang-en .bottom-nav .tab .nav-label {
  font-size: 10.5px;
  letter-spacing: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.lang-en .dish-name {
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.18;
  min-height: 30px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.lang-en .modal-title {
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.22;
  overflow-wrap: anywhere;
}
body.lang-en .mode-btn {
  font-size: 11.5px;
  padding: 9px 6px;
  letter-spacing: 0;
  white-space: nowrap;
}
body.lang-en .recipe-ing-chip {
  font-size: 11px;
  padding: 4px 8px;
  line-height: 1.08;
  min-height: 32px;
  max-height: 32px;
  max-width: 142px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.lang-en .dash-rec-name {
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.lang-en .sticker-label {
  font-family: var(--font-ui);
  font-size: 9.5px;
  line-height: 1.02;
  letter-spacing: 0;
  box-sizing: border-box;
  width: 76px;
  min-height: 0;
  max-height: 20px;
  padding: 0 6px;
  border-radius: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  align-content: center;
}
body.lang-en .ing-name {
  font-family: var(--font-ui);
  font-size: 10.8px;
  line-height: 1.08;
  min-height: 24px;
  max-height: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
body.lang-en .basket-item {
  border-radius: 16px;
  min-height: 42px;
  max-width: 152px;
  padding: 6px 10px;
  align-items: center;
}
body.lang-en .basket-ing-name,
body.lang-en .shopping-ing,
body.lang-en .dash-rec-ing-tag {
  line-height: 1.08;
  max-height: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
body.lang-en .basket-ing-name {
  max-width: 104px;
  min-width: 0;
}
body.lang-en .shopping-ing {
  max-width: 190px;
  min-width: 0;
}
body.lang-en .dash-rec-ing-tag,
body.lang-en .ing-cat-tag,
body.lang-en .cat-tag-name,
body.lang-en .shopping-count,
body.lang-en .dish-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.lang-en .modal-bottom-fixed .action-btn {
  font-size: 12px;
  padding-left: 10px;
  padding-right: 10px;
}
