/* ============================================================
   奶粉测评网站 — 前台样式 v2
   风格:干净明亮、母婴感、柔和蓝调、精致卡片与微交互
   ============================================================ */

:root {
  --primary: #3d93da;
  --primary-dark: #2275bd;
  --primary-light: #ecf6ff;
  --primary-soft: #f5fbff;
  --accent: #ff8a65;
  --accent-dark: #f4663a;
  --green: #4cc1a0;
  --green-light: #e9faf4;
  --gold: #f5b945;

  --text: #1f3145;
  --text-mid: #4f6075;
  --text-light: #8696a8;
  --bg: #f4f8fc;
  --bg-deep: #eef4fa;
  --card-bg: #ffffff;
  --border: #e9eff6;
  --border-soft: #f1f5f9;

  --shadow-sm: 0 2px 8px rgba(46, 110, 170, 0.06);
  --shadow: 0 6px 24px rgba(46, 110, 170, 0.09);
  --shadow-hover: 0 14px 40px rgba(46, 110, 170, 0.16);
  --shadow-nav: 0 2px 16px rgba(46, 110, 170, 0.06);

  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --ease: cubic-bezier(0.4, 0.14, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--primary-light); color: var(--primary-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* 滚动条美化 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4e0ec; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #bcccdc; }

/* ---------- 顶部导航 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(233, 239, 246, 0.8);
  box-shadow: var(--shadow-nav);
}
.navbar .container { display: flex; align-items: center; gap: 26px; height: 68px; }
.logo {
  font-size: 23px; font-weight: 800; color: var(--primary-dark);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  letter-spacing: -0.5px;
}
.logo::before {
  content: '🍼'; font-size: 22px;
  filter: drop-shadow(0 2px 3px rgba(61, 147, 218, 0.25));
}
.logo .dot { color: var(--accent); }
.nav-links { display: flex; gap: 2px; margin-left: 6px; }
.nav-links a {
  padding: 8px 15px; border-radius: 20px; font-size: 15px;
  color: var(--text-mid); transition: all .22s var(--ease); font-weight: 500; position: relative;
}
.nav-links a:hover { color: var(--primary-dark); background: var(--primary-light); }
.nav-links a.active { color: var(--primary-dark); background: var(--primary-light); font-weight: 600; }

.nav-search {
  margin-left: auto; display: flex; align-items: center;
  background: var(--bg-deep); border: 1.5px solid transparent;
  border-radius: 24px; padding: 5px 6px 5px 18px; transition: all .22s var(--ease);
}
.nav-search:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-light); }
.nav-search input { border: none; background: none; outline: none; font-size: 14px; width: 190px; color: var(--text); }
.nav-search input::placeholder { color: var(--text-light); }
.nav-search button {
  border: none; cursor: pointer; background: var(--primary); color: #fff;
  width: 34px; height: 34px; border-radius: 50%; font-size: 15px;
  transition: all .22s var(--ease); display: flex; align-items: center; justify-content: center;
}
.nav-search button:hover { background: var(--primary-dark); transform: scale(1.06); }

.nav-compare {
  position: relative; margin-left: 18px; cursor: pointer;
  color: var(--text-mid); font-size: 23px; transition: transform .22s var(--ease);
  line-height: 1;
}
.nav-compare:hover { transform: translateY(-2px) scale(1.08); }
.nav-compare.active { filter: drop-shadow(0 2px 6px rgba(61,147,218,.3)); }
.nav-compare .badge {
  position: absolute; top: -7px; right: -9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; line-height: 19px; text-align: center;
  border-radius: 10px; padding: 0 5px; box-shadow: 0 2px 6px rgba(255,138,101,.5);
  border: 2px solid #fff;
}

/* ---------- 通用区块 ---------- */
.section { padding: 48px 0; }
.section-title {
  font-size: 25px; font-weight: 800; margin-bottom: 7px;
  display: flex; align-items: center; gap: 11px; letter-spacing: -0.5px;
}
.section-title .bar {
  width: 5px; height: 23px; border-radius: 3px;
  background: linear-gradient(180deg, var(--primary), var(--green));
}
.section-sub { color: var(--text-light); font-size: 14.5px; margin-bottom: 26px; }

/* ---------- 首页 Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #e8f4ff 0%, #eef9f4 55%, #fff3ec 100%);
  padding: 72px 0 64px; text-align: center;
}
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(8px); opacity: .5;
}
.hero::before { width: 260px; height: 260px; background: radial-gradient(circle, #c9e6ff, transparent 70%); top: -80px; left: -40px; }
.hero::after { width: 320px; height: 320px; background: radial-gradient(circle, #ffe0d2, transparent 70%); bottom: -120px; right: -60px; }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-size: 42px; font-weight: 800; color: var(--text); margin-bottom: 14px; letter-spacing: -1px; }
.hero h1 .hl {
  background: linear-gradient(120deg, var(--primary-dark), var(--green));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { font-size: 17.5px; color: var(--text-mid); margin-bottom: 32px; }
.hero-search {
  max-width: 560px; margin: 0 auto; display: flex;
  background: #fff; border-radius: 32px; padding: 8px;
  box-shadow: 0 12px 40px rgba(46, 110, 170, 0.14); transition: box-shadow .22s var(--ease);
}
.hero-search:focus-within { box-shadow: 0 16px 48px rgba(46, 110, 170, 0.22); }
.hero-search input { flex: 1; border: none; outline: none; padding: 0 22px; font-size: 16px; background: none; color: var(--text); }
.hero-search button {
  border: none; cursor: pointer; color: #fff; padding: 0 34px; border-radius: 26px;
  font-size: 16px; font-weight: 700; transition: all .22s var(--ease);
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
}
.hero-search button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(61,147,218,.4); }

/* ---------- 品类网格 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.cat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 28px 24px;
  box-shadow: var(--shadow); transition: all .3s var(--ease); cursor: pointer;
  border: 1px solid var(--border-soft); position: relative; overflow: hidden;
}
.cat-card::after {
  content: ''; position: absolute; inset: 0; border-radius: var(--radius);
  background: linear-gradient(135deg, transparent 60%, rgba(61,147,218,.04));
  opacity: 0; transition: opacity .3s var(--ease);
}
.cat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: var(--primary-light); }
.cat-card:hover::after { opacity: 1; }
.cat-card .icon {
  width: 60px; height: 60px; border-radius: 17px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: var(--primary-light); transition: transform .3s var(--ease);
  box-shadow: inset 0 0 0 1px rgba(61,147,218,.06);
}
.cat-card:hover .icon { transform: scale(1.08) rotate(-4deg); }
.cat-card:nth-child(5n+1) .icon { background: #e8f4ff; }
.cat-card:nth-child(5n+2) .icon { background: #e9faf4; }
.cat-card:nth-child(5n+3) .icon { background: #fff3ec; }
.cat-card:nth-child(5n+4) .icon { background: #f3eeff; }
.cat-card:nth-child(5n) .icon { background: #fff6e6; }
.cat-card h3 { font-size: 17.5px; font-weight: 700; margin-bottom: 7px; }
.cat-card p { font-size: 13px; color: var(--text-light); min-height: 38px; line-height: 1.5; }
.cat-card .count { font-size: 13px; color: var(--primary); font-weight: 700; margin-top: 10px; display: flex; align-items: center; gap: 3px; }
.cat-card:hover .count { color: var(--primary-dark); }

/* ---------- 产品卡片 ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 22px; }
.product-card {
  background: var(--card-bg); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: all .3s var(--ease); cursor: pointer;
  display: flex; flex-direction: column; border: 1px solid var(--border-soft);
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: var(--primary-light); }
.product-card .cover {
  aspect-ratio: 1/1; overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-light));
}
.product-card .cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 70%, rgba(0,0,0,.03));
}
.product-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.product-card:hover .cover img { transform: scale(1.07); }
.product-card .body { padding: 15px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.product-card .brand { font-size: 12px; color: var(--text-light); margin-bottom: 5px; font-weight: 500; }
.product-card .name {
  font-size: 15px; font-weight: 700; line-height: 1.42; margin-bottom: 9px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 43px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }
.tag {
  font-size: 11px; padding: 3px 10px; border-radius: 11px;
  background: var(--primary-light); color: var(--primary-dark); font-weight: 600;
  white-space: nowrap;
}
.tag.green { background: var(--green-light); color: var(--green); }
.product-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { color: var(--accent-dark); font-size: 20px; font-weight: 800; letter-spacing: -0.5px; white-space: nowrap; }
.price small { font-size: 12px; font-weight: 500; color: var(--text-light); }
.btn-compare {
  border: 1.5px solid var(--border); background: #fff; color: var(--text-light);
  font-size: 12px; padding: 5px 11px; border-radius: 15px; cursor: pointer;
  transition: all .22s var(--ease); white-space: nowrap; font-weight: 600;
}
.btn-compare:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-compare.added { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; cursor: pointer; border-radius: 26px; font-size: 15px; font-weight: 600;
  padding: 12px 28px; transition: all .22s var(--ease);
}
.btn-primary { background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(61,147,218,.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(61,147,218,.42); }
.btn-ghost { background: #fff; color: var(--primary-dark); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- 横向滚动 ---------- */
.scroll-row { display: flex; gap: 20px; overflow-x: auto; padding: 4px 4px 14px; scroll-snap-type: x mandatory; }
.scroll-row::-webkit-scrollbar { height: 7px; }
.scroll-row > * { flex: 0 0 235px; scroll-snap-align: start; }

/* ---------- 品类页布局 ---------- */
.cat-layout { display: grid; grid-template-columns: 256px 1fr; gap: 30px; align-items: start; }
.filter-panel {
  background: var(--card-bg); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); position: sticky; top: 88px; border: 1px solid var(--border-soft);
}
.filter-group { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border-soft); }
.filter-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.filter-group h4 { font-size: 14px; font-weight: 700; margin-bottom: 13px; display: flex; align-items: center; gap: 7px; }
.filter-group h4::before { content: ''; width: 4px; height: 14px; background: var(--primary); border-radius: 2px; }
.filter-options { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  font-size: 13px; padding: 6px 14px; border-radius: 17px; cursor: pointer;
  background: var(--bg-deep); border: 1.5px solid transparent; transition: all .22s var(--ease); color: var(--text-mid);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 3px 10px rgba(61,147,218,.3); }
.price-inputs { display: flex; align-items: center; gap: 9px; }
.price-inputs input {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--border); border-radius: 9px;
  outline: none; font-size: 13px; transition: all .2s var(--ease);
}
.price-inputs input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.sort-tabs { display: flex; gap: 4px; background: var(--card-bg); padding: 5px; border-radius: 22px; box-shadow: var(--shadow-sm); }
.sort-tabs span {
  font-size: 14px; padding: 7px 16px; border-radius: 18px; cursor: pointer; color: var(--text-light); transition: all .22s var(--ease); font-weight: 500;
}
.sort-tabs span:hover { color: var(--primary); }
.sort-tabs span.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }

/* ---------- 分页 ---------- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination button {
  min-width: 40px; height: 40px; border: 1.5px solid var(--border); background: #fff; border-radius: 11px;
  cursor: pointer; font-size: 14px; transition: all .22s var(--ease); color: var(--text-mid); font-weight: 600;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(61,147,218,.32); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 产品详情 ---------- */
.detail-top { display: grid; grid-template-columns: 440px 1fr; gap: 46px; align-items: start; }
.gallery .main-img {
  aspect-ratio: 1/1; border-radius: var(--radius-lg); overflow: hidden;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-light));
  box-shadow: var(--shadow); border: 1px solid var(--border-soft);
}
.gallery .main-img img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: 11px; margin-top: 14px; }
.gallery .thumbs img {
  width: 68px; height: 68px; object-fit: cover; border-radius: 12px; cursor: pointer;
  border: 2.5px solid transparent; transition: all .22s var(--ease); box-shadow: var(--shadow-sm);
}
.gallery .thumbs img.active { border-color: var(--primary); }
.gallery .thumbs img:hover { transform: translateY(-2px); }

.detail-info h1 { font-size: 27px; font-weight: 800; margin-bottom: 14px; line-height: 1.35; letter-spacing: -0.5px; }
.detail-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; margin: 20px 0;
  padding: 18px 22px; background: var(--card-bg); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.detail-meta .item { font-size: 14px; display: flex; align-items: baseline; }
.detail-meta .item .label { color: var(--text-light); margin-right: 8px; min-width: 56px; }
.detail-meta .item .val { font-weight: 600; color: var(--text); }
.detail-price {
  background: linear-gradient(120deg, #fff3ec, #ffe7db); border-radius: var(--radius-sm);
  padding: 18px 24px; margin: 20px 0; display: flex; align-items: baseline; gap: 14px;
  box-shadow: inset 0 0 0 1px rgba(255,138,101,.12);
}
.detail-price .big { font-size: 34px; font-weight: 800; color: var(--accent-dark); letter-spacing: -1px; }
.detail-price .spec { color: var(--text-mid); font-size: 14px; }
.detail-actions { display: flex; gap: 13px; margin-top: 24px; }

.card-block {
  background: var(--card-bg); border-radius: var(--radius-lg); padding: 30px;
  box-shadow: var(--shadow); margin-bottom: 26px; border: 1px solid var(--border-soft);
}
.card-block h2 { font-size: 20px; font-weight: 800; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; letter-spacing: -0.5px; }
.card-block h2 .bar { width: 5px; height: 21px; border-radius: 3px; background: linear-gradient(180deg, var(--primary), var(--green)); }

/* 配方卡片 */
.formula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.formula-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px;
  background: linear-gradient(135deg, #fafdff, #f1f8ff); transition: all .25s var(--ease); position: relative; overflow: hidden;
}
.formula-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--green));
}
.formula-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.formula-item .fname { font-weight: 700; font-size: 15px; color: var(--primary-dark); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.formula-item .fval { font-size: 12.5px; color: var(--green); font-weight: 700; background: var(--green-light); padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.formula-item .fhl { font-size: 13px; color: var(--text-mid); margin-top: 9px; line-height: 1.55; }

/* 营养表 */
.nutrient-group { margin-bottom: 24px; }
.nutrient-group:last-child { margin-bottom: 0; }
.nutrient-group .gtitle {
  font-size: 14px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px;
  padding: 7px 14px; background: var(--primary-soft); border-radius: 9px; display: inline-block;
}
.nutrient-table { width: 100%; border-collapse: collapse; }
.nutrient-table tr { border-bottom: 1px solid var(--border-soft); transition: background .15s; }
.nutrient-table tr:last-child { border-bottom: none; }
.nutrient-table tr:hover { background: var(--primary-soft); }
.nutrient-table td { padding: 12px 10px; font-size: 14px; }
.nutrient-table td.nname { color: var(--text-mid); }
.nutrient-table td.nval { text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.nutrient-table td.nbasis { text-align: right; color: var(--text-light); font-size: 12px; width: 84px; }

/* ---------- 对比页 ---------- */
.compare-bar { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.compare-slot {
  width: 158px; background: var(--card-bg); border-radius: var(--radius); padding: 13px;
  box-shadow: var(--shadow); position: relative; text-align: center; border: 1px solid var(--border-soft);
  transition: all .25s var(--ease);
}
.compare-slot:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.compare-slot img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 10px; margin-bottom: 9px; background: var(--primary-light); }
.compare-slot .cname { font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-mid); }
.compare-slot .remove {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(31,49,69,.55); color: #fff; border: none; cursor: pointer; font-size: 15px;
  line-height: 1; transition: background .2s; display: flex; align-items: center; justify-content: center;
}
.compare-slot .remove:hover { background: var(--accent-dark); }
.compare-table-wrap { overflow-x: auto; background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border-soft); }
.compare-table { width: 100%; border-collapse: collapse; min-width: 620px; }
.compare-table th, .compare-table td { padding: 15px 18px; text-align: center; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.compare-table thead th { background: linear-gradient(135deg, var(--primary-light), #e3f1fd); font-weight: 700; color: var(--primary-dark); font-size: 14.5px; line-height: 1.4; }
.compare-table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.compare-table thead th:last-child { border-top-right-radius: var(--radius-lg); }
.compare-table td.row-label { background: var(--primary-soft); font-weight: 600; text-align: left; color: var(--text-mid); position: sticky; left: 0; z-index: 1; }
.compare-table tbody tr:hover td { background: #fbfdff; }
.compare-table tbody tr:hover td.row-label { background: var(--primary-light); }
.compare-table td.diff { background: #fff6f1 !important; color: var(--accent-dark); font-weight: 700; }
.compare-table .group-row td { background: var(--bg-deep); font-weight: 700; text-align: left; color: var(--primary-dark); font-size: 13.5px; letter-spacing: .3px; }

/* ---------- 加载/空态 ---------- */
.loading, .empty { text-align: center; padding: 70px 20px; color: var(--text-light); font-size: 15px; }
.loading .spinner {
  width: 42px; height: 42px; border: 3.5px solid var(--primary-light); border-top-color: var(--primary);
  border-radius: 50%; margin: 0 auto 18px; animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty .icon { font-size: 52px; margin-bottom: 14px; opacity: .55; }

/* ---------- 页脚 ---------- */
.footer { background: #fff; border-top: 1px solid var(--border); margin-top: 56px; padding: 34px 0; text-align: center; color: var(--text-light); font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 86px; left: 50%; transform: translateX(-50%);
  background: rgba(31,49,69,.94); color: #fff; padding: 11px 24px; border-radius: 24px;
  font-size: 14px; z-index: 999; animation: toastIn .3s var(--ease); box-shadow: 0 8px 24px rgba(31,49,69,.3);
  font-weight: 500;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .detail-top { grid-template-columns: 1fr; gap: 28px; }
  .gallery .main-img { max-width: 440px; margin: 0 auto; }
  .cat-layout { grid-template-columns: 1fr; }
  .filter-panel { position: static; }
  .filter-group { padding-bottom: 18px; margin-bottom: 18px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .navbar .container { gap: 10px; height: 56px; }
  .navbar { backdrop-filter: blur(12px); }
  /* 移动端:导航不隐藏,改为紧凑横滑;首页链接靠搜索图标补足 */
  .logo { font-size: 19px; }
  .logo::before { font-size: 18px; }
  .nav-links {
    display: flex; margin-left: 0; gap: 2px; overflow-x: auto;
    flex: 1; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .nav-search { margin-left: 4px; padding: 4px 5px 4px 12px; }
  .nav-search input { width: 0; min-width: 0; padding: 0; transition: width .25s, padding .25s; }
  .nav-search:focus-within input { width: 120px; padding: 0 8px 0 4px; }
  .section { padding: 34px 0; }
  .hero { padding: 52px 0 46px; }
  .hero h1 { font-size: 29px; }
  .hero p { font-size: 15px; }
  .hero-search button { padding: 0 22px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 13px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 13px; }
  .cat-card { padding: 20px 16px; }
  .cat-card .icon { width: 50px; height: 50px; font-size: 25px; }
  .section-title { font-size: 21px; }
  .detail-info h1 { font-size: 22px; }
  .detail-meta { grid-template-columns: 1fr; gap: 10px; padding: 15px 18px; }
  .detail-price .big { font-size: 28px; }
  .detail-actions { flex-direction: column; }
  .detail-actions .btn { width: 100%; }
  .card-block { padding: 22px 18px; }
  .formula-grid { grid-template-columns: 1fr; }
}
