/* ==========================================================
   食鉴 FoodWiki · 前台样式
   浅色清爽科普风，主色取自蔬菜绿，移动端优先适配
   ========================================================== */

:root {
  --green-900: #1d4d33;
  --green-700: #2f7a4f;
  --green-600: #3d9160;
  --green-100: #e4f2e8;
  --green-050: #f1f8f3;
  --amber-600: #d98c28;
  --amber-100: #fdf3e3;
  --ink-900: #1f2b23;
  --ink-700: #3a4a40;
  --ink-500: #6b7c71;
  --ink-300: #9aa8a0;
  --line: #e3e9e4;
  --bg: #f6f8f4;
  --card: #ffffff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(31, 43, 35, .04), 0 6px 20px rgba(31, 43, 35, .05);
  --shadow-hover: 0 2px 6px rgba(31, 43, 35, .06), 0 14px 34px rgba(31, 43, 35, .10);
  --max: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: #f6f8f4;              /* 兜底色，老浏览器不支持 CSS 变量时生效 */
  background: var(--bg);
  color: #1f2b23;
  color: var(--ink-900);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-900); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.35; font-weight: 700; color: var(--ink-900); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: .35em; }
strong { color: var(--ink-900); font-weight: 600; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-500); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 64px; flex-wrap: wrap; }

.logo { display: flex; align-items: center; gap: 10px; color: var(--ink-900); }
.logo:hover { color: var(--ink-900); }
.logo-mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--green-600), var(--green-900));
  color: #fff; font-weight: 700; font-size: 18px;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.2; font-weight: 700; font-size: 1rem; }
.logo-text em { font-style: normal; font-weight: 400; font-size: .74rem; color: var(--ink-500); }

.main-nav { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: wrap; }
.main-nav a {
  padding: 7px 12px; border-radius: 999px; color: var(--ink-700);
  font-size: .94rem; white-space: nowrap; transition: background .15s, color .15s;
}
.main-nav a:hover { background: var(--green-050); color: var(--green-700); }
.main-nav a.active { background: var(--green-100); color: var(--green-900); font-weight: 600; }

.header-search { display: flex; align-items: stretch; gap: 6px; }
.header-search input {
  width: 170px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); font-size: .9rem; outline: none; transition: border-color .15s, background .15s;
}
.header-search input:focus { border-color: var(--green-600); background: #fff; }
.header-search button {
  padding: 8px 16px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--green-700); color: #fff; font-size: .9rem; transition: background .15s;
}
.header-search button:hover { background: var(--green-900); }

.nav-toggle {
  display: none; width: 40px; height: 36px; padding: 8px 9px;
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  flex-direction: column; justify-content: space-between;
}
.nav-toggle span { display: block; height: 2px; background: var(--ink-700); border-radius: 2px; }

/* ---------------- 主区域 ---------------- */
.site-main { padding: 28px 0 56px; min-height: 60vh; }

.section { margin-bottom: 42px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .more { font-size: .9rem; color: var(--ink-500); }
.section-head .more:hover { color: var(--green-700); }

/* ---------------- 首页 Hero ---------------- */
.hero {
  background: linear-gradient(140deg, #eaf5ee 0%, #f4f9f2 55%, #fdf6e9 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 34px;
  margin-bottom: 34px;
}
.hero h1 { font-size: 2rem; margin-bottom: .4em; }
.hero h1 span { color: var(--green-700); }
.hero p.lead { color: var(--ink-700); font-size: 1.05rem; margin-bottom: 1.4em; max-width: 62ch; }

.hero-search { display: flex; gap: 10px; max-width: 620px; }
.hero-search input {
  flex: 1; padding: 13px 18px; font-size: 1rem;
  border: 1px solid #d8e3da; border-radius: 999px; background: #fff; outline: none;
  box-shadow: 0 2px 10px rgba(31, 43, 35, .04);
}
.hero-search input:focus { border-color: var(--green-600); }
.hero-search button {
  padding: 13px 28px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--green-700); color: #fff; font-size: 1rem; font-weight: 600;
  transition: background .15s, transform .1s;
}
.hero-search button:hover { background: var(--green-900); }
.hero-search button:active { transform: scale(.98); }

.hero-stats { display: flex; gap: 28px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 1.5rem; color: var(--green-700); line-height: 1.2; }
.hero-stats span { font-size: .82rem; color: var(--ink-500); }

/* ---------------- 栏目卡片 ---------------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.cat-card {
  display: block; padding: 20px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #cfe3d6; color: inherit; }
.cat-card .cat-icon { font-size: 28px; line-height: 1; margin-bottom: 10px; }
.cat-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.cat-card p { margin: 0 0 10px; font-size: .87rem; color: var(--ink-500); }
.cat-card .cat-count { font-size: .8rem; color: var(--green-700); font-weight: 600; }

/* ---------------- 食材卡片 ---------------- */
.food-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.food-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.food-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #cfe3d6; }
.food-card .thumb {
  height: 148px; background: linear-gradient(140deg, var(--green-050), #fdf6e9);
  display: grid; place-items: center; font-size: 2.6rem; position: relative;
  overflow: hidden;            /* 兜底：图片再大也不会溢出到 body 区遮挡中文名 */
  flex: none;
}
.food-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
/* 图片左上角：所属栏目 */
.food-card .card-cat {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(255, 255, 255, .93); color: #2f7a4f; color: var(--green-700);
  padding: 2px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; line-height: 1.7;
  box-shadow: 0 1px 5px rgba(31, 43, 35, .10);
}
.food-card .body {
  padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1;
  position: relative; z-index: 1;     /* 兜底：body 永远在图片层之上，中文名不会被任何溢出元素遮挡 */
}
/* 食材名称：卡片的主视觉，字号与字重都要明显强于下面的描述 */
.food-card h3 {
  margin: 0 0 8px;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.45;            /* 加大行高，防止小字号下文字下半部被某些字体裁切 */
  letter-spacing: .01em;
  word-break: break-word;       /* 防止长食材名溢出 */
  color: #1f2b23;               /* 兜底色：老浏览器不支持 CSS 变量时也能正常显示 */
  color: var(--ink-900);
}
.food-card h3 a {
  color: #1f2b23;
  color: var(--ink-900);
}
.food-card h3 a:hover { color: #2f7a4f; color: var(--green-700); }
.food-card .summary {
  font-size: .85rem; line-height: 1.65; margin: 0 0 12px;
  color: #6b7c71;
  color: var(--ink-500);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* 英文名 */
.food-card .en-name {
  margin: -4px 0 10px;
  font-size: .78rem; line-height: 1.4;
  letter-spacing: .02em;
  color: #9aa8a0; color: var(--ink-300);
}

/* 营养亮点前三 */
.nut-highlights {
  list-style: none;
  margin: 0 0 12px; padding: 9px 0 0;
  border-top: 1px dashed #e3e9e4; border-top: 1px dashed var(--line);
}
.nut-highlights li {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin: 0; padding: 2px 0; font-size: .82rem;
}
.nut-highlights .nh-name {
  color: #6b7c71; color: var(--ink-500);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nut-highlights .nh-val {
  color: #2f7a4f; color: var(--green-700);
  font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.nut-highlights .nh-val b { font-size: .95rem; }

/* 卡片底部：分类 + 浏览量 */
.food-card .meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .76rem; margin-top: auto; padding-top: 2px;
  color: #6b7c71; color: var(--ink-500);
}
.food-card .cat-tag {
  background: #f1f8f3; background: var(--green-050);
  color: #2f7a4f; color: var(--green-700);
  padding: 1px 9px; border-radius: 999px; font-weight: 600;
}
.food-card .views { color: #9aa8a0; color: var(--ink-300); }

.tag {
  display: inline-block; padding: 2px 9px; margin: 0 5px 5px 0;
  background: var(--green-050); color: var(--green-700);
  border-radius: 999px; font-size: .76rem;
}
.tag.amber { background: var(--amber-100); color: var(--amber-600); }
.tag-link { text-decoration: none; cursor: pointer; transition: background .15s ease, color .15s ease; }
.tag-link:hover { background: var(--green-600); color: #fff; }
.bio-tags-label { display: block; font-size: .8rem; color: var(--ink-500); margin-bottom: 8px; }
.bio-tags-list { display: flex; flex-wrap: wrap; }
.bio-cloud { margin: 0 0 22px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.bio-cloud-label { font-size: .82rem; color: var(--ink-500); margin-right: 6px; }

/* ---------------- 榜单 ---------------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.board {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.board h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 1.05rem; }
.board h3 em { font-style: normal; font-size: .78rem; font-weight: 400; color: var(--ink-500); }
.board ol.rank-list { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: rank; }
.board ol.rank-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--line); counter-increment: rank;
}
.board ol.rank-list li:last-child { border-bottom: none; }
.board ol.rank-list li::before {
  content: counter(rank); flex: none;
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--green-050); color: var(--green-700);
  font-size: .78rem; font-weight: 700;
}
.board ol.rank-list li:nth-child(1)::before { background: var(--green-700); color: #fff; }
.board ol.rank-list li:nth-child(2)::before { background: #58a377; color: #fff; }
.board ol.rank-list li:nth-child(3)::before { background: #86bd9c; color: #fff; }
.board .rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .rank-value { font-weight: 700; color: var(--green-700); font-size: .92rem; }
.board .rank-unit { font-size: .74rem; color: var(--ink-300); font-weight: 400; margin-left: 2px; }

/* ---------------- 营养素按钮组 ---------------- */
.nutrient-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink-700); font-size: .87rem; transition: all .15s;
}
.chip:hover { border-color: var(--green-600); color: var(--green-700); background: var(--green-050); }
.chip.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.chip .unit { font-size: .72rem; opacity: .7; }

/* ---------------- 筛选栏 ---------------- */
.filter-bar {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 22px;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-field label { font-size: .8rem; color: var(--ink-500); }
.filter-field input, .filter-field select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font-size: .9rem; outline: none; min-width: 120px;
  font-family: inherit;
}
.filter-field input:focus, .filter-field select:focus { border-color: var(--green-600); }
.filter-field input[type=number] { min-width: 92px; }
.btn {
  padding: 9px 20px; border: 1px solid var(--green-700); border-radius: var(--radius-sm);
  background: var(--green-700); color: #fff; font-size: .9rem; cursor: pointer;
  font-family: inherit; transition: background .15s, color .15s;
}
.btn:hover { background: var(--green-900); color: #fff; }
.btn.ghost { background: #fff; color: var(--green-700); }
.btn.ghost:hover { background: var(--green-050); color: var(--green-900); }
.btn.small { padding: 5px 13px; font-size: .82rem; }

/* ---------------- 面包屑 ---------------- */
/* 面包屑写在 .wrap 之外，需自带最大宽度与左右内边距，才能与下方内容左对齐 */
.breadcrumb {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto 18px;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: .86rem;
  line-height: 1.6;
  color: var(--ink-700);
  font-weight: 500;
}
.breadcrumb a {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  margin: 0 -9px;               /* 抵消内边距，保证文字仍与内容左边线对齐 */
  border-radius: 999px;
  color: var(--ink-500);
  font-weight: 400;
  transition: background .15s, color .15s;
}
.breadcrumb a:hover { background: var(--green-050); color: var(--green-700); }

/* 分隔符：模板里是裸斜杠，这里换成更精致的箭头（文字保留，读屏仍可读） */
.breadcrumb span { font-size: 0; line-height: 0; flex: none; }
.breadcrumb span::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  margin: 0 10px;
  border-top: 1.5px solid var(--ink-300);
  border-right: 1.5px solid var(--ink-300);
  transform: rotate(45deg);
  vertical-align: middle;
}
@media (max-width: 480px) {
  .breadcrumb { font-size: .8rem; margin-bottom: 14px; }
  .breadcrumb span::before { margin: 0 7px; }
}

/* ---------------- 详情页 ---------------- */

.food-header {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; margin-bottom: 22px;
  display: grid; grid-template-columns: 180px 1fr; gap: 26px; align-items: start;
}
.food-figure {
  height: 180px; border-radius: var(--radius-sm); overflow: hidden;
  background: linear-gradient(140deg, var(--green-050), #fdf6e9);
  display: grid; place-items: center; font-size: 4rem;
}
.food-figure img { width: 100%; height: 100%; object-fit: cover; }
.food-title h1 { margin-bottom: .3em; }
.food-alias { color: var(--ink-500); font-size: .9rem; margin-bottom: 12px; }
.food-summary { color: var(--ink-700); }
.food-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .86rem; color: var(--ink-500); margin-top: 12px; }
.food-facts b { color: var(--ink-700); font-weight: 600; }

.core-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-align: center;
}
.metric .m-value { font-size: 1.45rem; font-weight: 700; color: var(--green-700); line-height: 1.2; }
.metric .m-value small { font-size: .78rem; font-weight: 500; color: var(--ink-500); margin-left: 2px; }
.metric .m-name { font-size: .82rem; color: var(--ink-500); }
.metric .m-nrv { font-size: .72rem; color: var(--ink-300); }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 26px; margin-bottom: 22px;
}
.panel h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.panel h3 { margin-top: 1.4em; }
.panel p { color: var(--ink-700); }
.panel ul li { color: var(--ink-700); }
.notice {
  background: var(--amber-100); border-left: 3px solid var(--amber-600);
  padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .88rem; color: #7a5a1e; margin-bottom: 18px;
}

/* 营养表 */
.nut-table-wrap { overflow-x: auto; }
table.nut-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.nut-table th, table.nut-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.nut-table thead th { background: var(--green-050); color: var(--green-900); font-size: .86rem; font-weight: 600; }
table.nut-table tbody tr:hover { background: var(--green-050); }
table.nut-table td.num, table.nut-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.nut-table .group-row td {
  background: var(--green-050); font-weight: 600; color: var(--green-900);
  font-size: .86rem; padding: 7px 12px;
}
table.nut-table .n-name a { color: var(--ink-900); }
table.nut-table .n-name a:hover { color: var(--green-700); }
table.nut-table .n-unit { color: var(--ink-300); font-size: .8rem; }
.rank-badge {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  background: var(--green-050); color: var(--green-700); font-size: .74rem; font-weight: 600;
}
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green-700)); }

/* ---------------- 排行榜 ---------------- */
.rank-table-wrap { overflow-x: auto; }
table.rank-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.rank-table th, table.rank-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
table.rank-table thead th { background: var(--green-050); color: var(--green-900); font-size: .86rem; }
table.rank-table tbody tr:hover { background: var(--green-050); }
table.rank-table .idx { width: 52px; font-weight: 700; color: var(--ink-300); }
table.rank-table tr.top1 .idx { color: var(--amber-600); }
table.rank-table .val { text-align: right; font-weight: 700; color: var(--green-700); font-variant-numeric: tabular-nums; }

/* ---------------- 对比页 ---------------- */
.compare-picker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.compare-picker select { max-width: 240px; }
table.compare-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.compare-table th, table.compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.compare-table thead th { background: var(--green-050); color: var(--green-900); }
table.compare-table tbody tr:hover { background: var(--green-050); }
table.compare-table .best { color: var(--green-700); font-weight: 700; }
.best-mark { font-size: .7rem; background: var(--amber-100); color: var(--amber-600); padding: 1px 6px; border-radius: 5px; margin-left: 4px; }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 26px 0 0; }
.page-btn {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink-700); font-size: .88rem;
}
.page-btn:hover { border-color: var(--green-600); color: var(--green-700); }
.page-btn.active { background: var(--green-700); border-color: var(--green-700); color: #fff; font-weight: 600; }
.page-btn.disabled { opacity: .45; pointer-events: none; }
.page-info { margin-left: auto; font-size: .82rem; color: var(--ink-500); }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center; padding: 56px 20px; background: var(--card);
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-500);
}
.empty .empty-icon { font-size: 2.6rem; margin-bottom: 10px; }

/* ---------------- 页脚 ---------------- */
.site-footer { background: var(--card); border-top: 1px solid var(--line); padding: 40px 0 0; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; padding-bottom: 30px; }
.site-footer h4 { font-size: .95rem; margin-bottom: 10px; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { margin-bottom: 6px; font-size: .88rem; }
.footer-bottom {
  border-top: 1px solid var(--line); padding: 16px 20px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: .82rem; color: var(--ink-500);
}

/* ---------------- 响应式（平板 / 手机） ---------------- */
@media (max-width: 960px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .food-header { grid-template-columns: 1fr; }
  .food-figure { height: 200px; }
  .hero { padding: 32px 26px; }
}

@media (max-width: 768px) {
  /* ---- 页头：logo / 搜索 / 汉堡 一行，菜单展开时独占一行 ---- */
  .header-inner { min-height: 56px; padding-top: 8px; padding-bottom: 8px; gap: 10px; row-gap: 10px; }
  .logo { order: 1; flex: 0 1 auto; min-width: 0; }
  .logo-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
  .logo-text { font-size: .95rem; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .logo-text em { display: none; }
  .header-search { order: 2; flex: 1 1 150px; min-width: 0; margin-left: 0; }
  .header-search input { width: 100%; min-width: 0; padding: 8px 12px; font-size: 16px; }
  .header-search button { flex: none; padding: 8px 14px; }
  .nav-toggle { order: 3; display: flex; flex: none; }
  .main-nav { order: 4; display: none; width: 100%; flex-direction: column; gap: 2px; padding: 6px 0 10px; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 11px 12px; border-radius: var(--radius-sm); font-size: .95rem; }

  /* ---- 输入控件统一 16px，避免 iOS 聚焦时自动放大整页 ---- */
  .filter-field input, .filter-field select { font-size: 16px; }
  .header-search input, .hero-search input { font-size: 16px; }

  /* ---- Hero ---- */
  .hero { padding: 26px 18px; border-radius: 16px; margin-bottom: 24px; }
  .hero h1 { font-size: 1.45rem; }
  .hero p.lead { font-size: .98rem; margin-bottom: 1.2em; }
  .hero-search { flex-direction: column; gap: 8px; }
  .hero-search input { padding: 12px 16px; }
  .hero-search button { width: 100%; padding: 12px; }
  .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin-top: 20px; }
  .hero-stats b { font-size: 1.3rem; }
  .hero-stats span { font-size: .78rem; }

  /* ---- 内容容器 ---- */
  .site-main { padding: 16px 0 40px; }
  .section { margin-bottom: 32px; }
  .panel, .filter-bar { padding: 16px 14px; border-radius: 12px; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.18rem; }

  /* ---- 详情页 ---- */
  .food-header { padding: 16px 14px; gap: 16px; }
  .food-figure { height: 170px; font-size: 3rem; }
  .core-metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 12px 10px; }
  .metric .m-value { font-size: 1.25rem; }

  /* ---- 表格：横向滚动，不撑破页面 ---- */
  .nut-table-wrap, .rank-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nut-table { min-width: 480px; font-size: .86rem; }
  .rank-table, .compare-table { min-width: 420px; font-size: .88rem; }
  .nut-table th, .nut-table td,
  .rank-table th, .rank-table td,
  .compare-table th, .compare-table td { padding: 9px 10px; }

  /* ---- 触控目标放大 ---- */
  .chip { padding: 9px 14px; }
  .btn { min-height: 42px; }
  .page-btn { padding: 9px 14px; min-height: 40px; }
  .tag { padding: 4px 10px; }

  /* ---- 筛选栏：短字段两列并排，更紧凑；关键词字段有内联 flex 基准，仍独占一行 ---- */
  .filter-field { flex: 1 1 calc(50% - 6px); }
  .filter-field input, .filter-field select { width: 100%; min-height: 42px; }
  .filter-row .btn { width: 100%; }

  /* ---- 对比 / 分页 / 页脚 ---- */
  .compare-picker select { max-width: 100%; flex: 1 1 100%; }
  .pagination { justify-content: center; }
  .page-info { margin-left: 0; width: 100%; text-align: center; }
  .footer-inner { grid-template-columns: 1fr; gap: 22px; }
  .footer-bottom { flex-direction: column; align-items: center; text-align: center; gap: 6px; }

  /* ---- 刘海屏左右安全区 ---- */
  .wrap {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .breadcrumb {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

@media (max-width: 480px) {
  .wrap {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .breadcrumb {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .hero { padding: 22px 16px; }
  .hero h1 { font-size: 1.3rem; }

  /* 两列卡片：压缩内部排版，避免文字挤成一团 */
  .cat-grid, .food-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cat-card { padding: 14px 12px; }
  .cat-card .cat-icon { font-size: 24px; margin-bottom: 8px; }
  .cat-card p { font-size: .8rem; }
  .food-card .thumb { height: 112px; font-size: 2rem; }
  .food-card .body { padding: 11px 11px 13px; }
  .food-card h3 { font-size: 1rem; margin-bottom: 6px; }
  .food-card .summary { font-size: .78rem; -webkit-line-clamp: 2; margin-bottom: 8px; }
  .food-card .en-name { display: none; }
  .nut-highlights { margin-bottom: 9px; padding-top: 7px; }
  .nut-highlights li { font-size: .76rem; }
  .food-card .meta { font-size: .7rem; gap: 6px; }

  .food-figure { height: 150px; }
  .core-metrics { gap: 8px; }
  .board-grid { grid-template-columns: 1fr; }
  .empty { padding: 40px 16px; }
}
