/*
 * KFO Atlas 全站样式说明
 * --------------------------------------------------------------------------
 * 文件按以下顺序组织：
 * 1. 全局颜色、字体与页面宽度
 * 2. 顶栏导航与 Logo
 * 3. 首页基础样式和统计卡片
 * 4. 搜索、生成表单与结果卡片
 * 5. Formula / Compound 详情页和表格
 * 6. 分页控件与基础响应式规则
 * 7. Team Introduction 与底栏
 * 8. Editorial image system：装饰图片、首页拼贴和最终视觉覆盖
 *
 * 注意：CSS 遵循“后写规则覆盖先写规则”。文件末尾的 Editorial image
 * system 会再次定义 body、.topbar、.hero 等选择器，因此修改首页最终外观时，
 * 应优先查看文件末尾对应规则，而不是只修改前面的基础规则。
 */

/* 全站设计变量：修改这里可以统一调整网站色彩和玻璃质感。 */
:root {
  --green: #1f8a55; /* 主绿色：按钮、强调文字、链接和进度条。 */
  --green-dark: #0f5f3f; /* 深绿色：标题、重要数字及高对比文字。 */
  --yellow: #ffd166; /* 主黄色：强调背景、数值徽章和绿色渐变终点。 */
  --yellow-soft: #fff4c7; /* 浅黄色：柔和高亮背景。 */
  --ink: #18312a; /* 正文主文字颜色。 */
  --muted: #61746c; /* 次级说明、字段标签、CID 等辅助文字颜色。 */
  --glass: rgba(255, 255, 255, 0.72); /* 卡片玻璃背景；最后一位控制透明度。 */
  --line: rgba(31, 138, 85, 0.18); /* 输入框、按钮、卡片的统一浅绿色边线。 */
}

/* 全局盒模型：宽高计算包含 padding 和 border，避免控件尺寸意外变大。 */
* {
  box-sizing: border-box;
}

/* 页面基础：设置全局字体、主文字颜色及最底层背景。文件末尾还有最终背景覆盖。 */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 209, 102, 0.42), transparent 34%),
    radial-gradient(circle at 90% 20%, rgba(79, 199, 132, 0.22), transparent 32%),
    linear-gradient(135deg, #f9fff8 0%, #ffffff 42%, #fff9df 100%);
}

/* 主内容容器：最大宽度 1440px；左右至少保留 20px 空白，形成居中版心。 */
.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

/* 顶栏容器：sticky 使导航滚动时停留在顶部；三列分别为品牌、导航、语言/Logo。 */
.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto; /* 品牌 / 自适应导航 / 右侧操作区。 */
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 60px rgba(31, 138, 85, 0.12);
  backdrop-filter: blur(18px);
}

/* 左上角“KFO Atlas”品牌文字。font-weight 控制粗细，white-space 防止换行。 */
.brand {
  color: var(--green-dark);
  font-size: 19px;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}

/* 顶栏中部导航按钮组；gap 控制 Home、KFO Search 等按钮间距。 */
.nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* 顶栏右侧操作区：包含语言按钮；padding-right 为最右侧绝对定位 Logo 预留空间。 */
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* 顶栏 Logo：绝对定位在右侧，高度跟随顶栏；不会参与布局或撑高顶栏。 */
/* 导航按钮和语言按钮的公共外观：尺寸、边框、圆角、文字颜色和玻璃背景。 */
.nav-btn,
.lang-btn {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  font-weight: 850;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.62);
}

/* 当前页面按钮及鼠标悬停状态：提高边框对比并添加绿黄渐变。 */
.nav-btn.active,
.lang-btn:hover,
.nav-btn:hover {
  border-color: rgba(31, 138, 85, 0.38);
  background: linear-gradient(135deg, rgba(31, 138, 85, 0.14), rgba(255, 209, 102, 0.32));
}

/* 首页 Hero 的基础规则。最终首屏高度、拼贴和背景由文件末尾同名规则覆盖。 */
.hero {
  min-height: 230px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: end;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(237,255,237,0.42));
  box-shadow: 0 24px 80px rgba(31, 138, 85, 0.18);
  backdrop-filter: blur(22px);
}

/* 页面标题上方的小型栏目文字，如 Search、CVAE、About。 */
.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

/* 一级和二级标题的公共重置：清除浏览器默认外边距。 */
h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

/* 首页“KFO Atlas”大标题的基础字号；clamp 设置最小、响应式和最大字号。 */
h1 {
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.94;
}

/* 搜索页、生成页和 Team 页的面板标题字号。 */
h2 {
  font-size: 24px;
}

/* 首页主标题下的说明文本；max-width 控制阅读行长，line-height 控制行距。 */
.sub {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

/* 首页四项数据库统计的网格：默认每行两张卡片。 */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* 统计卡、主面板、搜索结果卡和生成卡共享的玻璃卡片外观。 */
.stat,
.panel,
.result-card,
.formula-card {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: 0 18px 60px rgba(31, 138, 85, 0.12);
  backdrop-filter: blur(18px);
}

/* 单个首页统计卡的内部留白。 */
.stat {
  padding: 18px;
}

/* 统计卡中的数字，如 896、2282、20、87。 */
.stat strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

/* 统计数字下方的说明，如 KFO components、formulas。 */
.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

/* 单页应用的页面切换基础：默认隐藏所有页面。 */
.page {
  display: none;
  margin-top: 22px;
}

/* Home 页面不增加额外顶部间距，使 Hero 紧接顶栏。 */
#homePage {
  margin-top: 0;
}

/* JavaScript 给当前页面添加 active 后才显示该页面。 */
.page.active {
  display: block;
}

/* 搜索、生成、详情和团队页面的主玻璃面板内部留白。 */
.panel {
  padding: 22px;
}

/* 面板标题行：左侧标题，右侧结果数或返回按钮。 */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

/* 小型胶囊标签：结果数量、components 数量等轻量信息。 */
.pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 209, 102, 0.32);
  border: 1px solid rgba(255, 209, 102, 0.55);
  font-size: 12px;
  font-weight: 800;
}

/* KFO Search 控件区三列布局；列宽比例依次对应关键词和两个筛选框。 */
.controls {
  display: grid;
  grid-template-columns: 1.1fr 0.7fr 1fr;
  gap: 12px;
  align-items: end;
}

/* Formula Generation 控件列宽：category、KFO count、实时生成开关。 */
.generator-controls {
  grid-template-columns: 1fr 0.7fr 1fr;
}

/* Formula Search 四列筛选布局：关键词、结构类别、category、subcategory。 */
.formula-search-controls {
  grid-template-columns: 1.2fr 0.8fr 0.9fr 0.9fr;
}

/* 输入框上方字段标签的字体、颜色和下间距。 */
label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* 所有输入框、下拉框和按钮的统一高度、圆角及字体继承。 */
input,
select,
button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  font: inherit;
}

/* 文本框和下拉框的边框、内边距、文字及半透明背景。 */
input,
select {
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  outline: none;
}

/* 输入控件获得焦点时的绿色边框和外发光，帮助用户定位当前字段。 */
input:focus,
select:focus {
  border-color: rgba(31, 138, 85, 0.72);
  box-shadow: 0 0 0 4px rgba(31, 138, 85, 0.1);
}

/* “Run model in real time”复选开关的整体容器。 */
.toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

/* 复选框本体尺寸及选中后的主题绿色。 */
.toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.toggle span {
  margin: 0;
}

/* 主要命令按钮，如 Generate formulas：使用绿黄渐变和较强阴影。 */
.primary {
  margin-top: 12px;
  border: 0;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(135deg, var(--green), #68b35c 58%, #e9b93f);
  box-shadow: 0 14px 34px rgba(31, 138, 85, 0.24);
}

/* 生成过程中按钮禁用状态：等待光标和降低透明度。 */
.primary:disabled {
  cursor: progress;
  opacity: 0.68;
}

/* 搜索结果和生成结果列表：垂直网格，gap 控制卡片间距。 */
.results,
.formula-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

/* 生成结果顶部的数据来源说明，如 CVAE generated form cache。 */
.generation-source-note {
  padding: 12px 14px;
  border-left: 4px solid var(--green);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  background: rgba(246, 255, 239, 0.72);
}

/* KFO 数量不超过 20 时，每个生成配方及其 compound 表格的外框。 */
.generated-formula {
  overflow: hidden;
  border: 1px solid rgba(31, 138, 85, 0.18);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: 0 18px 60px rgba(31, 138, 85, 0.1);
  backdrop-filter: blur(18px);
}

/* 生成配方顶部信息行：左侧食品类别，右侧 components 数量。 */
.generated-formula-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(31, 138, 85, 0.18);
  color: var(--green-dark);
  background: rgba(246, 255, 239, 0.72);
}

.generated-formula-head strong {
  font-size: 16px;
  text-transform: capitalize;
}

.generated-formula-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.generated-table-wrap {
  margin: 0;
}

/* 生成配方 compound 表格的最小宽度；窄屏时由外层横向滚动。 */
.generated-table {
  min-width: 620px;
}

/* KFO 数量超过 20 时展示的可点击简略配方卡。 */
.generated-formula-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  text-align: left;
}

/* 简略生成卡右侧的进入详情箭头。 */
.generated-card-arrow {
  color: var(--green);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

/* 详情页中表格上方的分区标题和记录数量行。 */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 4px 2px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-title strong {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(31, 138, 85, 0.1);
}

.result-card,
.formula-card {
  padding: 16px;
}

/* KFO Search 结果的自适应多列网格；每张卡最小宽度为 260px。 */
.kfo-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* 空间允许时自动增加每行卡片数。 */
  gap: 14px;
}

/* 单个 KFO 卡：左侧 CID 区块 74px，右侧为名称和分类。 */
.kfo-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 112px;
  text-align: left;
}

/* KFO 卡最左侧的 CID 两行徽章；垂直居中并使用绿黄浅渐变。 */
.kfo-cid-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 72px;
  padding: 10px 6px;
  border: 1px solid rgba(31, 138, 85, 0.18);
  border-radius: 8px;
  color: var(--green-dark);
  background: linear-gradient(180deg, rgba(246, 255, 239, 0.9), rgba(255, 244, 199, 0.72));
}

.kfo-cid-badge span {
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.kfo-cid-badge strong {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.1;
}

.kfo-card-body {
  min-width: 0;
}

/* KFO 卡片中的化合物名称；过长时允许任意换行，防止撑破卡片。 */
.kfo-card .compound {
  overflow-wrap: anywhere;
}

/* KFO 卡片中 KFO class、structural class 标签区域的上间距。 */
.kfo-card .meta {
  margin-top: 10px;
}

/* 搜索结果卡或旧生成卡的顶部信息行布局。 */
.result-top,
.formula-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.compound {
  font-size: 16px;
  font-weight: 900;
}

/* CID、category 描述等次级文字。 */
.cid {
  color: var(--muted);
  font-size: 13px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* 单个分类标签的胶囊背景、字体和内边距。 */
.meta span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(31, 138, 85, 0.08);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

/* 旧式生成结果中的单个 compound 行；当前主要由表格样式替代。 */
.component {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

/* compound proportion 的水平进度条底槽。 */
.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 138, 85, 0.1);
}

/* 进度条实际填充部分，宽度由 JavaScript 的内联 style 控制。 */
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
}


/* 次级命令按钮，如 Back to Formula Search / Back to KFO Search。 */
.secondary {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  font-weight: 850;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.68);
}

.secondary:hover {
  border-color: rgba(31, 138, 85, 0.38);
  background: rgba(255, 209, 102, 0.26);
}

/* 所有可点击结果卡的基础交互：整卡按钮、左对齐和手型光标。 */
.clickable-card {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}


/* Formula Search 卡片：左侧配方编号，右侧食品和分类信息。 */
.formula-search-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

/* Formula Search 卡片最左侧的纯数字 Formula No。 */
.formula-no-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 58px;
  border-right: 1px solid rgba(31, 138, 85, 0.16);
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 950;
}

.formula-card-main {
  min-width: 0;
}

/* 可点击卡片悬停反馈：轻微上移、加深边框和阴影。 */
.clickable-card:hover {
  border-color: rgba(31, 138, 85, 0.42);
  transform: translateY(-1px);
  box-shadow: 0 22px 64px rgba(31, 138, 85, 0.16);
}

/* Formula Detail、Compound Detail 内容的纵向布局和块间距。 */
.detail-content {
  display: grid;
  gap: 18px;
}

/* 详情页面板的浅白绿色玻璃背景。 */
.detail-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(246, 255, 239, 0.62)),
    var(--glass);
}

/* 详情页顶部彩色摘要区：用于突出 compound 或 food 的核心信息。 */
.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 0.6fr 0.6fr;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(31, 138, 85, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(31, 138, 85, 0.1), rgba(255, 209, 102, 0.22));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}



/* Compound Detail 摘要列：名称、CID、KFO class、structural class。 */
.compound-hero {
  grid-template-columns: minmax(0, 1.3fr) 0.55fr 0.75fr minmax(0, 1fr);
}

.compound-hero strong {
  font-size: clamp(18px, 2.4vw, 30px);
}

/* Formula Detail 的食品名称彩色卡，仅保留单列大标题。 */
.food-hero {
  grid-template-columns: 1fr;
}

.food-hero strong {
  font-size: clamp(30px, 5vw, 58px);
}

.detail-hero div {
  min-width: 0;
}

.detail-hero span,
.detail-summary span,
.detail-link span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.detail-hero strong {
  display: block;
  color: var(--green-dark);
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

/* Formula Detail 下方白色信息卡：Formula No、category、subcategory、processing。 */
.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* 详情白色信息块、来源链接和表格外框的公共边框与玻璃背景。 */
.detail-summary div,
.detail-link,
.detail-table-wrap {
  border: 1px solid rgba(31, 138, 85, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 10px 30px rgba(31, 138, 85, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.detail-summary div {
  padding: 14px;
}

.detail-summary strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Formula Detail 的文献链接区域。 */
.detail-link {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  overflow-wrap: anywhere;
}

.detail-link a {
  color: var(--green-dark);
  font-weight: 850;
  text-decoration-color: rgba(31, 138, 85, 0.35);
  text-underline-offset: 3px;
}

.detail-link a:hover {
  color: var(--green);
}

/* 表格滚动容器：当列宽超过屏幕时允许横向滚动。 */
.detail-table-wrap {
  overflow-x: auto;
  padding: 0;
}

/* Formula/Compound/Generated Formula 共用表格；980px 最小宽度保证列可读。 */
.detail-table {
  width: 100%;
  min-width: 980px; /* 列较多时保持可读宽度，外层负责横向滚动。 */
  border-collapse: separate;
  border-spacing: 0;
}

/* 表格表头和单元格公共内边距、分隔线及左对齐方式。 */
.detail-table th,
/* 表格正文的字体、颜色和半透明白色背景。 */
.detail-table td {
  padding: 12px 14px;
  border-right: 1px solid rgba(31, 138, 85, 0.14);
  border-bottom: 1px solid rgba(31, 138, 85, 0.14);
  text-align: left;
  vertical-align: top;
}

.detail-table th:last-child,
.detail-table td:last-child {
  border-right: 0;
}

/* 表头：滚动时吸附顶部，使用浅绿渐变和深绿文字。 */
.detail-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 950;
  background: linear-gradient(180deg, rgba(226, 248, 226, 0.98), rgba(250, 255, 234, 0.98));
  box-shadow: inset 0 -1px 0 rgba(31, 138, 85, 0.18);
}

.detail-table td {
  color: var(--ink);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.62);
}

/* 偶数行交替底色，增强长表格的横向阅读定位。 */
.detail-table tbody tr:nth-child(even) td {
  background: rgba(246, 255, 239, 0.6);
}

/* 鼠标经过表格行时使用浅黄色高亮。 */
.detail-table tbody tr:hover td {
  background: rgba(255, 244, 199, 0.62);
}

.detail-table tr:last-child td {
  border-bottom: 0;
}

.detail-table td:nth-child(1),
.detail-table td:nth-child(2),
.detail-table td:nth-child(5),
.detail-table td:nth-child(6),
.detail-table th:nth-child(1),
.detail-table th:nth-child(2),
.detail-table th:nth-child(5),
.detail-table th:nth-child(6) {
  white-space: nowrap;
}

/* Proportion 数值的黄色胶囊徽章。 */
.value-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 209, 102, 0.65);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  background: rgba(255, 209, 102, 0.28);
}

/* Compound Detail 表格最后一列的文献跳转按钮。 */
.source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid rgba(31, 138, 85, 0.24);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(246, 255, 239, 0.96), rgba(255, 244, 199, 0.8));
  box-shadow: 0 8px 18px rgba(31, 138, 85, 0.12);
}

.source-button:hover {
  border-color: rgba(31, 138, 85, 0.48);
  color: var(--green);
  transform: translateY(-1px);
}

/* 无数据或错误信息的空状态框。 */
.empty {
  padding: 26px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.48);
}

/* 分页控件总布局：Previous、页码输入、Next 横向排列。 */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  white-space: nowrap;
}

/* Previous 和 Next 按钮的尺寸与玻璃外观。 */
.pager button {
  width: auto;
  min-width: 112px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  font-weight: 850;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.72);
}

.pager button:hover:not(:disabled) {
  border-color: rgba(31, 138, 85, 0.38);
  background: rgba(255, 209, 102, 0.28);
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

/* 中间“当前页 / 总页数”及直接跳页输入框的容器。 */
.page-jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid rgba(31, 138, 85, 0.14);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.58);
}

/* 直接输入页码的数字框宽度和居中字体。 */
.page-jump input {
  width: 70px;
  min-height: 30px;
  padding: 0 8px;
  text-align: center;
  font-weight: 900;
}

.page-jump span {
  color: var(--muted);
}

/* 平板断点：Hero、筛选器、摘要信息由多列收为单列。 */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .controls,
  .generator-controls,
  .formula-search-controls,
  .detail-summary,
  .detail-hero {
    grid-template-columns: 1fr;
  }
}

/* 小屏顶栏基础规则：取消 sticky，并让导航/语言按钮铺满宽度。 */
@media (max-width: 720px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .nav {
    justify-content: stretch;
  }

  .nav-btn,
  .lang-btn {
    width: 100%;
  }
}

/* 手机断点：缩小页面边距与面板留白，统计卡改为单列。 */
@media (max-width: 560px) {
  .shell {
    width: min(100% - 24px, 1440px);
    padding-top: 12px;
  }

  .hero,
  .panel {
    padding: 18px;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

/* 顶栏专用断点：导航移动到第二行并允许横向滚动。 */
@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .topbar-actions {
    justify-self: end;
  }
}


/* Team Introduction 主面板的内部留白。 */
.team-panel {
  padding: 28px;
}

.team-heading {
  margin-bottom: 22px;
}

/* 四位团队成员介绍的纵向列表。 */
.team-list {
  display: grid;
  gap: 20px;
}

/* 单个成员：左侧原始比例头像，右侧姓名、职位和介绍。 */
.team-member {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.team-member:first-child {
  padding-top: 0;
  border-top: 0;
}

/* 团队头像：使用原图、自动高度、最大显示宽度 180px，不裁切比例。 */
.team-member img {
  display: block;
  width: auto;
  max-width: 180px;
  height: auto;
  border: 1px solid rgba(31, 138, 85, 0.18);
  border-radius: 8px;
  background: white;
}

/* 团队成员姓名。 */
.team-member-content h3 {
  margin: 0;
  color: var(--green-dark);
  font-size: 24px;
}

/* 团队成员介绍正文的颜色、字号和行距。 */
.team-member-content p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

/* 姓名下方的职位信息，使用主题绿色强调。 */
.team-member-content .team-role {
  margin-top: 5px;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
}

.team-member-content a {
  color: var(--green-dark);
  font-weight: 800;
}

/* 英文模式隐藏团队中文介绍。JavaScript 会修改 html 的 lang 属性。 */
html[lang="en"] .team-member [lang="zh-CN"] {
  display: none;
}

/* 中文模式隐藏团队英文介绍。 */
html[lang="zh-CN"] .team-member [lang="en"] {
  display: none;
}

/* 全站底栏外框：包含 Citation 和 Contact 两列。文件末尾会叠加装饰背景图。 */
.site-footer {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 60px rgba(31, 138, 85, 0.1);
  backdrop-filter: blur(18px);
}

/* 底栏内部横向布局：左侧 Citation，右侧 Contact。 */
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
}

/* Citation 和 Contact 公共三行网格：标题独占第一行，内容各占一行。 */
.footer-citation,
.footer-contact {
  display: grid;
  align-content: start;
  gap: 6px;
  font-size: 12px;
  line-height: 1.55;
}

/* 左侧引用信息的宽度、颜色和最大阅读行长。 */
.footer-citation {
  flex: 1 1 620px;
  max-width: 820px;
  color: var(--muted);
}

/* 右侧联系信息列的宽度和左对齐方式。 */
.footer-contact {
  flex: 0 1 390px;
  justify-items: start;
}

.footer-citation strong,
.footer-contact strong {
  color: var(--green-dark);
  font-size: 13px;
}

.footer-citation span,
.footer-contact a {
  display: block;
}

.footer-contact a {
  color: var(--muted);
  text-decoration: none;
}

.footer-contact a:hover {
  color: var(--green);
}

/* Team 与底栏手机布局：成员改为单列，底栏左右两列上下堆叠。 */
@media (max-width: 700px) {
  .team-member {
    grid-template-columns: 1fr;
  }

  .team-member img {
    width: auto;
    max-width: min(180px, 60vw);
    height: auto;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-citation,
  .footer-contact {
    width: 100%;
    max-width: none;
  }
}


/*
 * 装饰图片与最终视觉覆盖层
 * --------------------------------------------------------------------------
 * 本节位于文件末尾，因此会覆盖前面同名的 body、.topbar 和 .hero。
 * 首页拼贴使用 deco-1、2、4、7；搜索/详情/生成/Team 使用 deco-3、5、6、8；
 * 全站背景和底栏使用 deco-9。图片均为网页优化后的 WebP。
 */
body {
  background:
    linear-gradient(rgba(248, 252, 247, 0.94), rgba(255, 253, 241, 0.96)),
    url("/figures/web/deco-9.webp") center / cover fixed;
}

.topbar {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 45px rgba(24, 75, 52, 0.14);
}

.hero {
  position: relative;
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  grid-template-rows: 1fr auto;
  gap: 28px;
  align-items: end;
  overflow: hidden;
  padding: 58px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: #edf5e8;
  box-shadow: 0 28px 90px rgba(22, 83, 54, 0.2);
  isolation: isolate;
}

/* 首页四图拼贴的绝对定位画布；负 inset 让图片延伸到 Hero 边缘之外。 */
.hero-collage {
  position: absolute;
  inset: -36px;
  z-index: -3;
}

/* 每张拼贴图的公共边框、阴影和裁切容器。 */
.hero-image {
  position: absolute;
  overflow: hidden;
  margin: 0;
  border: 8px solid rgba(255, 255, 255, 0.74);
  box-shadow: 0 24px 55px rgba(17, 53, 39, 0.24);
}

/* 拼贴图片铺满容器，object-fit: cover 会裁掉超出部分以避免留白。 */
.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 拼贴左上图：宽高百分比、梯形 clip-path 和轻微逆时针旋转。 */
.hero-image-a {
  top: 3%;
  left: -2%;
  width: 36%;
  height: 47%;
  clip-path: polygon(0 0, 100% 8%, 92% 100%, 5% 94%);
  transform: rotate(-2deg);
}

/* 拼贴左下图：与左上图错位，形成编辑式非对称组合。 */
.hero-image-b {
  bottom: 2%;
  left: 4%;
  width: 39%;
  height: 49%;
  clip-path: polygon(8% 0, 96% 5%, 100% 92%, 0 100%);
  transform: rotate(1.5deg);
}

/* 拼贴右上大图：占据最大视觉面积。 */
.hero-image-c {
  top: -1%;
  right: -1%;
  width: 62%;
  height: 66%;
  clip-path: polygon(4% 4%, 100% 0, 95% 100%, 0 92%);
  transform: rotate(1deg);
}

/* 拼贴右下图：覆盖右下区域并轻微逆时针旋转。 */
.hero-image-d {
  right: 7%;
  bottom: -2%;
  width: 43%;
  height: 42%;
  clip-path: polygon(0 7%, 94% 0, 100% 94%, 8% 100%);
  transform: rotate(-2.5deg);
}

/* Hero 文字与图片之间的磨砂层：渐变保证左侧文字清晰，动画控制透明度呼吸。 */
.hero-frost {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(246, 252, 245, 0.9) 0%, rgba(246, 252, 245, 0.7) 42%, rgba(255, 251, 230, 0.26) 100%),
    linear-gradient(0deg, rgba(10, 48, 32, 0.22), transparent 48%);
  backdrop-filter: blur(3px) saturate(0.92);
  animation: frost-breathe 4s ease-in-out infinite alternate; /* 4 秒往返、无限循环的柔和透明度变化。 */
}

/* 磨砂层 4 秒透明度动画的起止状态。 */
@keyframes frost-breathe {
  from { opacity: 0.82; }
  to { opacity: 0.96; }
}

/* Hero 标题和介绍文字层；z-index 保证位于图片及磨砂层上方。 */
.hero-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  max-width: 720px;
  padding: 28px 0;
  text-shadow: 0 1px 24px rgba(255, 255, 255, 0.94);
}

/* Editorial Hero 最终大标题样式，会覆盖前面的基础 h1 尺寸。 */
.hero h1 {
  color: #103f2e;
  font-size: clamp(58px, 8vw, 112px);
  line-height: 0.88;
}

.hero .sub {
  max-width: 650px;
  color: #294f40;
  font-weight: 620;
}

/* Hero 右侧统计卡组，提升层级防止被图片覆盖。 */
.hero .stats {
  position: relative;
  z-index: 1;
  align-self: end;
}

.hero .stat {
  min-height: 112px;
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 16px 36px rgba(20, 71, 48, 0.14);
  backdrop-filter: blur(18px) saturate(1.1);
}

.hero .stat strong {
  color: var(--green-dark);
  font-size: 34px;
}

/* 各功能面板设为定位容器并裁掉装饰图溢出部分。 */
.search-panel,
.generator-panel,
.team-panel,
.detail-panel {
  position: relative;
  overflow: hidden;
}

/* 面板右上角装饰图片公共规则：低透明度并用 mask 渐隐到正文区域。 */
.search-panel::before,
.generator-panel::before,
.team-panel::before,
.detail-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: min(34%, 420px);
  height: 118px;
  pointer-events: none;
  opacity: 0.16;
  background-position: center;
  background-size: cover;
  mask-image: linear-gradient(90deg, transparent, black 44%);
}

/* KFO Search 面板使用 deco-3.webp。 */
#kfoPage .search-panel::before {
  background-image: url("/figures/web/deco-3.webp");
}

/* Formula Search 和详情页使用 deco-5.webp。 */
#formulaSearchPage .search-panel::before,
.detail-panel::before {
  background-image: url("/figures/web/deco-5.webp");
}

/* Formula Generation 面板使用 deco-6.webp。 */
.generator-panel::before {
  background-image: url("/figures/web/deco-6.webp");
}

/* Team 页面使用 deco-8.webp，并增加装饰图高度。 */
.team-panel::before {
  height: 190px;
  opacity: 0.13;
  background-image: url("/figures/web/deco-8.webp");
}

/* 将面板真实内容提升到装饰伪元素之上，确保文字和控件可点击。 */
.panel-head,
.controls,
.results,
.pager,
.formula-list,
.detail-content,
.team-list,
.primary {
  position: relative;
  z-index: 1;
}

.site-footer {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.91), rgba(247,255,240,0.84)),
    url("/figures/web/deco-9.webp") center 62% / cover;
}

/* 图片首屏平板布局：取消不规则旋转，四图改成 2×2 网格，文字移到下方。 */
@media (max-width: 900px) {
  .hero {
    min-height: 760px;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    padding: 34px 24px 28px;
  }

  .hero-collage {
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
  }

  .hero-image {
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    border-width: 0;
    clip-path: none;
    transform: none;
  }

  .hero-frost {
    background: linear-gradient(180deg, rgba(247, 252, 246, 0.58), rgba(247, 252, 246, 0.9) 55%, rgba(255, 252, 235, 0.96));
    backdrop-filter: blur(4px);
  }

  .hero-copy {
    align-self: end;
    padding-top: 190px;
  }

  .hero h1 {
    font-size: clamp(50px, 16vw, 78px);
  }
}

@media (max-width: 560px) {
  .hero {
    min-height: 820px;
  }

  .hero-collage {
    display: flex;
    flex-direction: column;
  }

  .hero-image {
    flex: 1 1 25%;
  }

  .hero-copy {
    padding-top: 260px;
  }

  .hero .stats {
    grid-template-columns: 1fr 1fr;
  }

  .hero .stat {
    min-height: 96px;
    padding: 14px;
  }

  .hero .stat strong {
    font-size: 28px;
  }
}
