/* 标新悦意 前台样式
   风格：标本目录——象牙纸色底、细线网格、衬线标题、学名斜体；只用系统字体（不引用外部字体）。 */

:root {
  --paper: #f6f3ea;
  --paper-2: #fbf9f3;
  --card: #fffdf8;
  --ink: #1f2a2e;
  --ink-2: #47524f;
  --muted: #7b8380;
  --line: rgba(31, 42, 46, 0.14);
  --line-strong: rgba(31, 42, 46, 0.28);
  --accent: #12655e;       /* 深青 */
  --accent-soft: #e2eeeb;
  --amber: #a8742a;        /* 琥珀，用于强调字 */
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --latin: Georgia, "Times New Roman", serif;
  --radius: 4px;
}

/* IUCN 等级配色：风险越高越暖 */
.iucn-EX { --c: #2b2b2b; } .iucn-EW { --c: #4a3527; } .iucn-CR { --c: #b3362a; }
.iucn-EN { --c: #c9622a; } .iucn-VU { --c: #b98a14; } .iucn-NT { --c: #6f9a3a; }
.iucn-LC { --c: #2e7d4f; } .iucn-DD { --c: #7c8483; } .iucn-NE { --c: #a3a9a7; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; }
.latin, em.latin { font-family: var(--latin); font-style: italic; }
.shell { width: min(1360px, 100% - 64px); margin-inline: auto; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246, 243, 234, 0.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--ink); display: grid; place-items: center;
  font-family: var(--latin); font-style: italic; font-size: 21px;
}
.brand-text { display: grid; line-height: 1.25; }
.brand-text strong { font-family: var(--serif); font-size: 19px; letter-spacing: 0.06em; }
.brand-text small { font-size: 10px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.brand.small .brand-mark { width: 34px; height: 34px; font-size: 17px; }
.mainnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mainnav a {
  text-decoration: none; font-size: 14px; padding: 7px 14px; border-radius: 99px; border: 1px solid transparent;
}
.mainnav a:hover { border-color: var(--line-strong); }
.mainnav a.active { background: var(--ink); color: var(--paper-2); }
.mainnav { margin-left: auto; }

/* 语言菜单：顶栏最右侧，地球图标 + 当前语言，点开列出全部语言（不依赖脚本） */
.langmenu { position: relative; flex: none; }
.langmenu summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 13px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 99px; user-select: none;
}
.langmenu summary::-webkit-details-marker { display: none; }
.langmenu summary:hover, .langmenu[open] summary { border-color: var(--ink); }
.langmenu .caret { transition: transform 0.2s; }
.langmenu[open] .caret { transform: rotate(180deg); }
.langmenu ul {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 180px;
  list-style: none; margin: 0; padding: 6px; background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 16px 36px -18px rgba(31, 42, 46, 0.45);
}
.langmenu li a { display: block; padding: 7px 12px; border-radius: 5px; text-decoration: none; font-size: 14px; }
.langmenu li a:hover { background: var(--accent-soft); }
.langmenu li a.on { font-weight: 700; color: var(--accent); }
.langmenu li a.on::after { content: " ✓"; }

/* ---------- 首屏 ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px; align-items: center; padding: 64px 0 40px; min-height: 560px;
}
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: 0.14em; color: var(--ink-2); margin: 0 0 22px; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-size: clamp(44px, 7vw, 96px); letter-spacing: 0.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 17px; color: var(--ink-2); max-width: 34em; margin: 22px 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 34px; }
.btn {
  display: inline-flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--ink); color: var(--paper-2); padding: 14px 24px; border-radius: var(--radius); font-weight: 600;
}
.btn:hover { background: var(--accent); }
.textlink { text-decoration: none; border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; font-size: 14px; }
.textlink:hover { color: var(--accent); border-color: var(--accent); }
.hero-figure {
  position: relative; display: block; text-decoration: none;
  aspect-ratio: 4 / 3.2; border-radius: 6px; overflow: hidden; background: #e3e0d4;
  box-shadow: 0 1px 0 var(--line), 0 24px 48px -28px rgba(31, 42, 46, 0.45);
}
.hero-figure img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.hero-figure:hover img { transform: scale(1.03); }
.hero-caption {
  position: absolute; left: 16px; bottom: 16px; right: 16px; display: grid; gap: 2px;
  background: rgba(251, 249, 243, 0.92); padding: 12px 16px; border-radius: var(--radius); max-width: 360px;
}
.hero-caption small { font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.hero-caption strong { font-family: var(--serif); font-size: 20px; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 72px;
}
.stats div { padding: 22px 0 20px; display: grid; gap: 2px; }
.stats div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.stats strong { font-family: var(--latin); font-size: 34px; font-weight: 400; line-height: 1; }
.stats span { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }

/* ---------- 面包屑 ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); padding: 26px 0 8px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs strong { color: var(--ink); font-weight: 600; }

/* ---------- 图鉴 ---------- */
.archive { padding-bottom: 96px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 28px 0 22px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { font-size: clamp(30px, 4vw, 46px); }
.section-head > p { max-width: 30em; margin: 0; color: var(--ink-2); font-size: 14px; }
.kicker { font-size: 12px; letter-spacing: 0.16em; color: var(--accent); margin: 0 0 8px; text-transform: uppercase; }

.filters { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); padding: 14px 0 12px; margin-bottom: 28px; display: grid; gap: 10px; }
.filter-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; }
.filter-label { font-size: 12px; color: var(--muted); padding-top: 6px; letter-spacing: 0.08em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
/* 选项多时只显示 3 行，右侧箭头翻页（site.js）；没有脚本时全部显示 */
.chips-box { display: flex; align-items: flex-start; gap: 10px; }
.chips a[hidden] { display: none; }
.chips-pager { display: flex; align-items: center; gap: 6px; flex: none; font-size: 12px; color: var(--muted); padding-top: 2px; }
.chips-pager button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper-2);
  color: var(--ink); font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.chips-pager button:hover:not(:disabled) { border-color: var(--ink); }
.chips-pager button:disabled { opacity: 0.35; cursor: default; }
.chips-pager span { min-width: 3.4em; text-align: center; font-variant-numeric: tabular-nums; }
.chips a {
  text-decoration: none; font-size: 13px; border: 1px solid var(--line-strong); border-radius: 99px; padding: 4px 12px; background: var(--paper-2);
}
.chips a small { color: var(--muted); font-size: 11px; }
.chips a:hover { border-color: var(--ink); }
.chips a.on { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }
.chips a.on small { color: rgba(251, 249, 243, 0.7); }
.chips a.chip-iucn::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.filter-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); padding-top: 4px; }
.filter-foot a { color: var(--accent); }

.grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.card {
  display: flex; flex-direction: column; text-decoration: none; background: var(--card);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background 0.2s;
}
.card:hover { background: #fff; }
.card-figure { position: relative; display: block; aspect-ratio: 5 / 4; overflow: hidden; background: #e6e3d8; }
.card-figure img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.88); transition: transform 0.5s ease, filter 0.3s; }
.card:hover .card-figure img { transform: scale(1.04); filter: none; }
.noimage {
  display: block; width: 100%; height: 100%;
  background: repeating-linear-gradient(-45deg, #e6e3d8 0 10px, #ece9df 10px 20px);
}
.iucn {
  position: absolute; right: 10px; bottom: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: #fff; background: var(--c); padding: 3px 8px; border-radius: 3px;
}
.card-body { display: grid; gap: 2px; padding: 14px 16px 18px; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.card-meta .no { font-family: var(--latin); }
.card-name { font-family: var(--serif); font-size: 19px; margin-top: 4px; }
.card-body .latin:not(.card-name) { font-size: 14px; color: var(--ink-2); }
.card-sub { font-size: 14px; color: var(--ink-2); }
.card-regions { font-size: 12px; color: var(--muted); margin-top: 6px; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 32px; font-size: 14px; }
.pager a { text-decoration: none; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 14px; justify-self: start; }
.pager a[rel="next"] { justify-self: end; }
.pager a:hover { border-color: var(--ink); }

/* ---------- 条目详情 ---------- */
.record {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  gap: clamp(32px, 6vw, 88px); padding: 18px 0 56px; align-items: start;
}
.gallery-main { margin: 0; background: #e6e3d8; border-radius: 6px; overflow: hidden; }
.gallery-main img { width: 100%; height: auto; max-height: 72vh; object-fit: contain; background: #ece9df; }
.gallery-main.empty { aspect-ratio: 4 / 3; display: grid; }
/* 没有图片时显示的专题默认图（线稿）：按原比例显示，不裁切 */
.gallery-main.empty:has(img.placeholder) { aspect-ratio: auto; display: block; padding: 0; }
img.placeholder { background: #f3efe4; }
.gallery-main figcaption {
  display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted);
  background: var(--paper-2); padding: 10px 14px; border-top: 1px solid var(--line);
}
.gallery-main .no { font-family: var(--latin); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.thumb { padding: 0; border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: none; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.on { border-color: var(--accent); }
.record-copy h1 { font-size: clamp(34px, 4.6vw, 60px); margin-top: 4px; }
.name-en { font-family: var(--serif); font-size: 22px; margin: 6px 0 0; color: var(--ink); }
.badge { display: inline-block; color: #fff; background: var(--c); font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 3px; letter-spacing: 0.06em; }
.facts { border-top: 1px solid var(--ink); margin: 30px 0 0; }
.facts div { display: grid; grid-template-columns: 116px 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; }
.facts dd a { color: var(--accent); text-decoration: none; }
.facts dd a:hover { text-decoration: underline; }
.facts .sep { color: var(--muted); }

.section-title { font-size: 28px; margin-bottom: 18px; }
.section-title.small { font-size: 18px; }
.prose-wrap { border-top: 1px solid var(--line); padding: 40px 0 24px; }
.prose { max-width: 46em; font-size: 16px; line-height: 1.9; }
.prose p { margin: 0 0 1em; }
.prose h3, .prose h4 { font-family: var(--serif); margin: 1.4em 0 0.6em; }
.prose blockquote { border-left: 3px solid var(--accent); margin: 1em 0; padding: 2px 0 2px 16px; color: var(--ink-2); }
.prose a { color: var(--accent); }
.credits { padding: 8px 0 24px; font-size: 13px; color: var(--muted); }
.credits ul { margin: 0; padding-left: 18px; }
.related { border-top: 1px solid var(--line); padding: 8px 0 96px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.notfound { padding: 120px 0; display: grid; gap: 16px; justify-items: start; }
.notfound h1 { font-size: 48px; }

/* ---------- 物种对比 ---------- */
/* 卡片外包一层，放“加入对比”按钮（按钮不能放进卡片的链接里） */
.card-item { position: relative; display: flex; min-width: 0; }
.card-item > .card { flex: 1; min-width: 0; }
.cmp-toggle {
  font: inherit; font-size: 12px; cursor: pointer; border: 1px solid var(--line-strong); border-radius: 999px;
  background: rgba(255, 253, 248, 0.92); color: var(--ink); padding: 4px 10px; line-height: 1.4;
}
.cmp-toggle::before { content: "+ "; }
.cmp-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.cmp-toggle[aria-pressed="true"]::before { content: "✓ "; }
.cmp-toggle:disabled { opacity: 0.45; cursor: not-allowed; }
.card-item .cmp-toggle { position: absolute; top: 10px; right: 10px; z-index: 2; backdrop-filter: blur(4px); }
.cmp-inline { margin: 14px 0 0; font-size: 13px; padding: 6px 14px; }
.cmp-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 18px 0 0; font-size: 14px; }
.cmp-quick span { color: var(--muted); font-size: 13px; }
.cmp-quick a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }

/* 底部对比栏 */
.cmp-tray {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(31, 42, 46, 0.96); color: #fff;
  box-shadow: 0 -12px 30px -18px rgba(0, 0, 0, 0.6); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cmp-tray-inner { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.cmp-tray-toggle { display: none; }
.cmp-tray-items { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.cmp-tray-items li { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.08); border-radius: var(--radius); padding: 4px 6px 4px 4px; min-width: 0; max-width: 260px; }
.cmp-tray-items img { width: 44px; height: 36px; object-fit: cover; border-radius: 3px; flex: none; background: #e6e3d8; }
.cmp-tray-items span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-tray-items button { background: none; border: 0; color: rgba(255, 255, 255, 0.7); font-size: 18px; cursor: pointer; padding: 0 4px; }
.cmp-tray-items li.slot { border: 1px dashed rgba(255, 255, 255, 0.3); background: none; padding: 4px 12px; color: rgba(255, 255, 255, 0.6); font-size: 12px; }
.cmp-tray-msg { font-size: 12px; color: rgba(255, 255, 255, 0.7); }
.cmp-tray-clear { background: none; border: 0; color: rgba(255, 255, 255, 0.75); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.cmp-tray .btn { background: var(--accent); color: #fff; white-space: nowrap; }
.cmp-tray .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
body.has-tray { padding-bottom: 72px; }
body.has-tray .to-top { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }

/* 对比页 */
.cmp-page { padding: 18px 0 96px; }
.cmp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.cmp-head h1 { font-size: clamp(30px, 4vw, 48px); margin: 0; }
.cmp-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.cmp-switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.cmp-guide { max-width: 40em; font-size: 16px; line-height: 1.8; display: grid; gap: 6px; }
.cmp { --label: 120px; border-top: 1px solid var(--ink); }
.cmp-row { display: grid; grid-template-columns: var(--label) repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cmp-label { font-size: 13px; color: var(--muted); padding: 14px 12px 14px 0; background: var(--paper); }
.cmp-cell { padding: 14px 14px; min-width: 0; border-left: 1px solid var(--line); font-size: 15px; overflow-wrap: anywhere; }
.cmp-cell a { color: var(--accent); text-decoration: none; }
.cmp-cell a:hover { text-decoration: underline; }
.cmp-na { color: var(--muted); }
.cmp-void { background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(31, 42, 46, 0.025) 8px 16px); }
.cmp-sticky { position: sticky; top: 77px; z-index: 5; /* 顶栏（固定，高 77px）下面 */ background: var(--paper); box-shadow: 0 1px 0 var(--line-strong); }
.cmp-name { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; background: var(--paper); }
.cmp-thumb { width: 56px; height: 45px; object-fit: cover; border-radius: 3px; background: #e6e3d8; }
.cmp-title { display: block; font-family: var(--serif); font-size: 18px; color: var(--ink) !important; line-height: 1.3; }
.cmp-title.latin { font-family: var(--latin); font-style: italic; }
.cmp-name em { font-size: 13px; color: var(--ink-2); }
.cmp-x { font-size: 22px; line-height: 1; color: var(--muted) !important; padding: 2px 4px; }
.cmp-x:hover { color: #b3362a !important; text-decoration: none !important; }
.cmp-add { display: grid; align-content: center; justify-items: start; gap: 4px; background: var(--paper); }
.cmp-add a { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; line-height: 26px; }
/* 加号用两条线画在圆的正中（字符“+”的位置随字体偏移） */
.cmp-add a .cmp-plus {
  flex: none; width: 26px; height: 26px; box-sizing: border-box; border: 1px dashed currentColor; border-radius: 50%;
  background: linear-gradient(currentColor, currentColor) center / 10px 1.5px no-repeat, linear-gradient(currentColor, currentColor) center / 1.5px 10px no-repeat;
}
.cmp-add small { font-size: 12px; color: var(--muted); }
.cmp-photos .cmp-cell { padding: 14px; }
.cmp-figure { margin: 0; aspect-ratio: 5 / 4; background: #e6e3d8; border-radius: var(--radius); overflow: hidden; }
.cmp-figure img { width: 100%; height: 100%; object-fit: cover; }
.cmp-figure img.placeholder { object-fit: contain; }
.cmp-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.cmp-dots .thumb { width: 9px; height: 9px; aspect-ratio: auto; border-radius: 50%; border: 0; background: var(--line-strong); padding: 0; }
.cmp-dots .thumb.on { background: var(--accent); }
.cmp-note-row .cmp-note { grid-column: 2 / -1; padding: 14px; border-left: 1px solid var(--line); background: var(--accent-soft); font-size: 15px; }
.cmp-note a { color: var(--accent); text-decoration: none; }
.cmp-note-row + .cmp-row { border-top: 0; }
.cmp-bar { position: relative; display: block; height: 10px; border-radius: 5px; background: rgba(31, 42, 46, 0.08); margin: 6px 0 8px; }
.cmp-bar span { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); }
.cmp-bar-label { font-size: 14px; }
.cmp-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-tags a { font-size: 13px; padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2) !important; }
.cmp-tags a.unique { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.cmp-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.cmp-key { display: inline-block; width: 22px; height: 12px; border-radius: 6px; background: var(--accent); }
.cmp-foot .cmp-cell { padding: 16px 14px; }
/* 只看不同：所有物种都一样的行收起（不需要脚本） */
.cmp-page:has(#cmp-diff:checked) .cmp-group.same { display: none; }

@media (max-width: 760px) {
  /* 手机：一屏两列，左右滑动看第三列；左侧标签列固定 */
  .cmp-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
  .cmp { --label: 72px; min-width: calc(72px + var(--cols) * 42vw); }
  .cmp-label { position: sticky; left: 0; z-index: 2; font-size: 12px; padding-right: 8px; }
  .cmp-sticky { position: static; }
  .cmp-name { grid-template-columns: 1fr auto; }
  .cmp-thumb { display: none; }
  .cmp-title { font-size: 16px; }
  .cmp-cell { padding: 12px 10px; font-size: 14px; }
  .cmp-head { flex-direction: column; align-items: flex-start; }
  /* 对比栏收成一个按钮，点开再看 */
  .cmp-tray { left: auto; right: 12px; bottom: 12px; border-radius: 14px; max-width: calc(100% - 24px); }
  .cmp-tray-inner { width: auto; flex-wrap: wrap; padding: 8px 10px; }
  .cmp-tray:not(.open) .cmp-tray-inner { flex-wrap: nowrap; }
  .cmp-tray-toggle { display: inline-flex; white-space: nowrap; flex: none; gap: 6px; align-items: center; background: none; border: 0; color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
  .cmp-tray-toggle b { background: var(--accent); border-radius: 999px; padding: 0 8px; }
  .cmp-tray:not(.open) .cmp-tray-items, .cmp-tray:not(.open) .cmp-tray-msg, .cmp-tray:not(.open) .cmp-tray-clear { display: none; }
  .cmp-tray.open .cmp-tray-items { flex: 1 1 100%; flex-direction: column; order: 2; }
  .cmp-tray.open .cmp-tray-items li { max-width: none; }
  .cmp-tray .btn { padding: 6px 12px; font-size: 13px; }
  body.has-tray { padding-bottom: 0; }
  body.has-tray .to-top { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media print { .cmp-tray, .cmp-toggle, .cmp-x, .cmp-add, .cmp-switch { display: none !important; } }

/* ---------- 页脚、回到顶部 ---------- */
.footer { border-top: 1px solid var(--line); background: var(--paper-2); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 28px 0; font-size: 13px; color: var(--muted); }
.footer-inner p { margin: 0; }
.footer-inner > a { text-decoration: none; }
.to-top {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(31, 42, 46, 0.9); color: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}
.to-top:hover { background: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .grid, .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .record { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 32px, 1360px); }
  .topbar-inner { flex-wrap: wrap; padding: 10px 0; min-height: 0; row-gap: 8px; }
  .brand { min-width: 0; flex: 1 1 auto; }
  .brand-text { min-width: 0; }
  .brand-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 专题导航单独一行；专题多了横向滑动，不换行堆高顶栏 */
  .mainnav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { flex: none; }
  .langmenu { margin-left: auto; }
  /* 筛选项翻页：箭头放到选项下面靠右，选项占满整行 */
  .chips-box { flex-direction: column; align-items: stretch; gap: 8px; }
  .chips-pager { justify-content: flex-end; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 36px 0 28px; min-height: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 48px; }
  .stats div:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .stats div:nth-child(4) { border-top: 1px solid var(--line); }
  .grid, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row { grid-template-columns: 1fr; gap: 4px; }
  .facts div { grid-template-columns: 92px 1fr; }
}
@media (max-width: 480px) {
  /* 手机：语言按钮只显示地球图标（当前语言在菜单里打勾），和品牌放在同一行 */
  .langmenu summary span { display: none; }
  .langmenu summary { padding: 8px 10px; }
  .brand-mark { width: 38px; height: 38px; font-size: 19px; }
  .brand-text strong { font-size: 17px; }
}
@media (max-width: 430px) {
  .card-name { font-size: 16px; }
  .card-body { padding: 10px 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
@media print {
  .topbar, .footer, .to-top, .filters, .pager, .thumbs { display: none !important; }
  body { background: #fff; }
}
