/* ========== 变量 ========== */
:root {
  --bg-page: #f5f0e1;
  --bg-card: #ffffff;
  --red: #c0392b;
  --yellow: #e6b422;
  --green: #27ae60;
  --wood: #8b5e3c;
  --text: #3e2723;
  --text-sub: #8d6e63;
  --border: #d4c5a9;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 48px;
  --tabbar-h: 50px;
  --text-min: 16px;
  --page-pad-x: 16px;
  --content-w: 950px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: var(--text-min);
  background: #fff;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--wood); text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
input, select { font: inherit; touch-action: manipulation; }

/* hidden 占位项：避免 display:flex 等覆盖浏览器默认隐藏 */
.fav-item[hidden],
.recent-item[hidden],
.history-row[hidden],
.pair-card[hidden],
.qt-row[hidden],
.unit-chip[hidden] {
  display: none !important;
}

.ico { width: 22px; height: 22px; display: block; flex-shrink: 0; }

/* ========== 布局 ========== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  max-width: 100%;
  margin: 0 auto;
}

.main-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-page);
  justify-content: center;
}

.main-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

/* ========== 顶部标题栏 ========== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: var(--page-pad-x);
  padding-bottom: 0;
  padding-left: var(--page-pad-x);
  min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  background: #fff;
  border-bottom: 1px solid rgba(212, 197, 169, 0.4);
  flex-shrink: 0;
  z-index: 10;
}

.nav-spacer,
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.icon-btn {
  color: var(--text);
  border-radius: 8px;
}

.nav-title {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

/* ========== PC 顶栏（默认隐藏） ========== */
.pc-nav { display: none; }

/* ========== Tab 面板 ========== */
.convert-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.convert-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px var(--page-pad-x) 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body[data-tab="category"] .convert-pane,
body[data-tab="favorite"] .convert-pane {
  display: none;
}

.tab-pane {
  display: none;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

body[data-tab="category"] .category-pane,
body[data-tab="favorite"] .favorite-pane {
  display: flex;
}

.pane-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px var(--page-pad-x) 12px;
}

.pane-title { margin-bottom: 16px; padding: 0 4px; }
.pane-title h2 { font-size: 20px; font-weight: 600; color: var(--text); }
.pane-title p { font-size: 15px; color: var(--text-sub); margin-top: 6px; }

/* ========== 分类滑动条（首行） ========== */
.cat-strip-wrap {
  overflow: hidden;
  margin-bottom: 12px;
}

.cat-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.cat-strip::-webkit-scrollbar { display: none; }

.cat-tag {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(212, 197, 169, 0.5);
  background: #ffffff;
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: all 0.2s;
}

.cat-tag.active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(230, 180, 34, 0.3);
}

/* ========== 首屏换算卡片 ========== */
.hero-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(212, 197, 169, 0.3);
}

.hero-converter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  position: relative;
}

.conv-side {
  flex: 1;
  width: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conv-input {
  width: 100%;
  height: 56px !important;
  padding: 0 16px;
  font: 600 24px/1 var(--font-base);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.3s, box-shadow 0.3s;
  /* 防止数字过长时溢出 */
  text-overflow: ellipsis;
  overflow: hidden;
}

.conv-input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(230, 180, 34, 0.15);
  outline: none;
}

.conv-select {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fdfaf5;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.3s;
}
.conv-select:focus {
  border-color: var(--yellow);
  outline: none;
}

.hero-output {
  color: var(--wood);
  background: rgba(245, 240, 225, 0.3);
  border-color: rgba(212, 197, 169, 0.6);
}

.swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--wood);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s, background 0.2s;
  
  /* 横排下的居中与定位 */
  margin-top: -56px;
  z-index: 1;
}

.swap-btn:active {
  background: rgba(230, 180, 34, 0.15);
  transform: scale(0.92);
}

.hero-result {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed rgba(212, 197, 169, 0.5);
  text-align: center;
}

.result-big {
  font: 600 28px/1.3 var(--font-base);
  color: var(--wood);
  animation: popIn 0.3s ease;
  word-break: break-all;
}

.result-formula {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-sub);
  word-break: break-all;
}

@keyframes popIn {
  0% { opacity: 0; transform: translateY(6px) scale(0.98); }
  100% { opacity: 1; transform: none; }
}

.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.preset-tag {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(212, 197, 169, 0.5);
  background: #fdfaf5;
  color: var(--wood);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  transition: all 0.2s;
}

.preset-tag:active { 
  background: rgba(230, 180, 34, 0.15);
  transform: scale(0.96);
}

/* ========== 分类浏览 ========== */
.browse-area { margin-bottom: 14px; }

.pair-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  border: 1px solid rgba(212, 197, 169, 0.3);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pair-card:active { 
  transform: scale(0.98); 
  box-shadow: 0 2px 10px rgba(0,0,0,0.03); 
}

/* ========== 扩展面板（换算表等） ========== */
.extras-panel {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(212, 197, 169, 0.3);
}

/* ========== 详细换算面板（兼容） ========== */
.detail-panel {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid rgba(212, 197, 169, 0.3);
}

.converter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conv-side { flex: 1; min-width: 0; }

.conv-input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  font: 600 20px/1 "SFMono-Regular", Consolas, monospace;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  color: var(--text);
  background: #fff;
}

.conv-input:focus { border-color: var(--yellow); outline: none; }

.conv-select {
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
}

.conv-eq {
  flex: 0 0 auto;
  font-size: 24px;
  font-weight: 600;
  color: var(--wood);
  padding: 0 2px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 10px;
}

.quick-table { display: flex; flex-direction: column; gap: 6px; }

.qt-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: #fdfaf5;
  border: 1px solid rgba(212, 197, 169, 0.2);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text);
  transition: background 0.2s, transform 0.2s;
}

.qt-row:active { 
  background: rgba(230, 180, 34, 0.15);
  transform: scale(0.98);
}

.fav-pair-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--wood);
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: all 0.2s;
}

.fav-pair-btn:active {
  background: rgba(139, 94, 60, 0.05);
  transform: scale(0.98);
}

.fav-pair-btn.is-faved { color: var(--yellow); border-color: var(--yellow); }

/* ========== AI 推荐 ========== */
.ai-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  margin-bottom: 20px;
  border: 1px solid rgba(212, 197, 169, 0.3);
  overflow: hidden;
}

.ai-card summary {
  padding: 20px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.ai-card summary::-webkit-details-marker { display: none; }

.ai-body { padding: 0 24px 20px; }

.ai-block { margin-bottom: 12px; }
.ai-block:last-child { margin-bottom: 0; }
.ai-block h4 { font-size: 16px; color: var(--wood); margin-bottom: 4px; }
.ai-block p { font-size: 16px; color: var(--text-sub); }

/* ========== 最近使用 ========== */
.recent-section { margin-bottom: 20px; }

.recent-list { display: flex; flex-direction: column; gap: 8px; }

.recent-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid rgba(212, 197, 169, 0.2);
  font-size: 16px;
  color: var(--text);
}

.empty-hint {
  font-size: 16px;
  color: var(--text-sub);
  padding: 12px 0;
  text-align: center;
}

/* ========== 操作按钮 ========== */
.action-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.action-btn {
  flex: 1;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(212, 197, 169, 0.5);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.action-btn:active { background: rgba(139, 94, 60, 0.06); }

/* ========== 广告位 ========== */
.ad-slot {
  display: none;
  min-height: 60px;
  max-height: 60px;
  margin: 10px 0;
  color: #999;
  font-size: 14px;
  border-radius: 8px;
  border: 1px dashed #ccc;
  background: #fafafa;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-slot:not(:empty) {
  display: flex;
  flex: 0 0 60px;
}

/* ========== 分类页 ========== */
.search-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 14px;
  background: #fff;
}

.search-input:focus { border-color: var(--yellow); outline: none; }

.full-cat-group { margin-bottom: 18px; }
.full-cat-group h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }

.unit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-chip {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(212, 197, 169, 0.4);
  background: var(--bg-card);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transition: all 0.2s;
}

.unit-chip:active { 
  background: rgba(230, 180, 34, 0.15); 
  transform: scale(0.96); 
}

/* ========== 收藏页 ========== */
.fav-list { display: flex; flex-direction: column; gap: 8px; }

.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  border: 1px solid rgba(212, 197, 169, 0.3);
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  transition: transform 0.2s;
}
.fav-item:active {
  transform: scale(0.98);
}

.fav-del {
  color: var(--text-sub);
  font-size: 20px;
  padding: 0 4px;
}

/* ========== 历史浮层 ========== */
.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(62, 39, 35, 0.4);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.history-overlay[hidden] { display: none !important; }

.history-panel {
  width: 100%;
  max-width: 480px;
  max-height: 70dvh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding-bottom: var(--safe-bottom);
  display: flex;
  flex-direction: column;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(212, 197, 169, 0.4);
  font-size: 18px;
  font-weight: 600;
}

.history-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
}

.history-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(212, 197, 169, 0.25);
  font-size: 16px;
  color: var(--text);
  transition: background 0.2s;
  border-radius: 8px;
}
.history-row:active {
  background: rgba(139, 94, 60, 0.05);
}

/* ========== 正文阅读区（PC 展示） ========== */
.content-block {
  padding: 20px 0 12px;
  margin-top: 8px;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.content-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  padding: 24px;
  border: 1px solid rgba(212, 197, 169, 0.3);
  text-align: left;
}

.content-fold {
  overflow: hidden;
}

.content-fold summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.content-fold summary::-webkit-details-marker {
  display: none;
}

.content-fold summary::after {
  content: "";
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(212, 197, 169, 0.5);
  box-sizing: border-box;
  background:
    linear-gradient(var(--wood), var(--wood)) center / 10px 1.5px no-repeat,
    linear-gradient(var(--wood), var(--wood)) center / 1.5px 10px no-repeat;
}

.content-fold[open] summary::after {
  background:
    linear-gradient(var(--wood), var(--wood)) center / 10px 1.5px no-repeat;
}

.fold-body {
  padding-top: 18px;
}

.content-card h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}
.content-card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(212, 197, 169, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
}
.content-card p {
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 12px;
}

.intro-card p:last-of-type {
  margin-bottom: 0;
}

.benefit-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.benefit-item,
.example-card {
  background: #fdfaf5;
  border: 1px solid rgba(212, 197, 169, 0.25);
  border-radius: 14px;
  padding: 16px;
}

.benefit-item strong,
.example-card h3 {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 6px;
}

.benefit-item span {
  display: block;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.7;
}

.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.step-list li {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.7;
  padding-left: 20px;
  position: relative;
  background: #fdfaf5;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(212, 197, 169, 0.2);
}
.step-list li strong {
  color: var(--red);
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.query-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.query-list li {
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.7;
  padding-left: 16px;
  position: relative;
}

.query-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

.faq-section {
  /* Inherits from content-card */
}
.faq-item {
  margin: 0;
}
.faq-item h3 {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 8px;
  margin-top: 16px;
  position: relative;
  padding-left: 24px;
}
.faq-item h3::before {
  content: "Q";
  position: absolute;
  left: 0;
  color: var(--yellow);
  font-weight: bold;
}
.faq-item p {
  margin: 0 0 0 24px;
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.6;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(212, 197, 169, 0.2);
}
.faq-item:last-child p {
  border-bottom: none;
  padding-bottom: 0;
}

.site-footer {
  display: none;
  margin-top: auto; /* 将页脚推至底部 */
  padding: 24px var(--page-pad-x);
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.7); /* 深色背景配浅色文字 */
  line-height: 1.8;
  background: var(--wood); /* 使用深棕木色作为页脚背景 */
  width: 100%;
  box-sizing: border-box;
}

.site-footer p { margin-bottom: 6px; }
.site-footer p:last-child { margin-bottom: 0; }

.site-footer a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
}

.site-footer a:hover { color: #fff; text-decoration: underline; }

/* ========== 底部 TabBar ========== */
.tab-bar {
  order: 999;
  display: flex;
  flex-shrink: 0;
  align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid rgba(212, 197, 169, 0.45);
  box-shadow: 0 -2px 12px rgba(62, 39, 35, 0.04);
  z-index: 20;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-sub);
  font-size: 14px;
  padding-top: 4px;
}

.tab-btn.active { color: var(--wood); font-weight: 600; }

.tab-ico { width: 22px; height: 22px; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: rgba(62, 39, 35, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== 移动端：首屏功能区 + yanse 风格页脚 ========== */
@media (max-width: 767px) {
  .main-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    justify-content: flex-start;
  }

  .main-content {
    flex: 1 0 auto;
    min-height: auto;
  }

  body[data-tab="convert"] .convert-pane,
  body[data-tab="category"] .category-pane,
  body[data-tab="favorite"] .favorite-pane {
    flex: none;
    min-height: auto;
  }

  .convert-scroll,
  .pane-inner {
    flex: none;
    min-height: auto;
    overflow-y: visible;
  }

  .content-block {
    display: flex !important;
    padding-top: 4px;
    gap: 14px;
  }

  .content-fold {
    padding: 18px 16px;
    border-radius: 14px;
  }

  .content-fold .fold-body h1 {
    font-size: 22px;
    text-align: left;
  }

  .content-fold .fold-body h2 {
    font-size: 17px;
  }

  .benefit-list,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
  }

  .site-footer {
    display: block;
    flex-shrink: 0;
    margin-top: auto; /* 将页脚推至底部 */
    padding: 24px var(--page-pad-x);
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.7); /* 深色背景配浅色文字 */
    line-height: 1.8;
    background: var(--wood); /* 使用深棕木色作为页脚背景 */
    width: 100%;
    box-sizing: border-box;
    border-top: none;
  }

  .site-footer-inner {
    max-width: none;
    margin: 0;
  }

  .site-footer-inner p {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
  }

  .site-footer-inner p:last-child {
    margin-bottom: 0;
  }

  .site-footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
  }

  .site-footer a:hover {
    color: #fff;
    text-decoration: none;
  }
}

/* ========== 返回顶部按钮 ========== */
.back-to-top {
  position: fixed;
  bottom: 80px; /* 默认在移动端，位于 tabbar 上方 */
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: var(--wood);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  display: none;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--bg-page);
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0) scale(0.95);
}

/* ========== PC 适配（主体 950px，导航/页脚通栏） ========== */
@media (min-width: 768px) {
  html {
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-page);
  }

  body {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: auto;
    min-height: 100dvh;
    background:
      radial-gradient(ellipse 680px 680px at 88% 12%, rgba(212, 197, 169, 0.16), transparent),
      radial-gradient(ellipse 520px 520px at 8% 88%, rgba(141, 110, 99, 0.09), transparent),
      var(--bg-page);
  }

  .app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    width: 100%;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    margin: 0 auto;
    background: transparent;
    box-shadow: none;
  }

  .top-nav { display: none; }

  .pc-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-left: 0;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(212, 197, 169, 0.45);
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 0 100vmax rgba(255, 255, 255, 0.96);
    clip-path: inset(0 -100vmax);
  }

  .pc-nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-right: auto;
    text-decoration: none;
  }

  .pc-nav-brand:hover { text-decoration: none; opacity: 0.9; }

  .pc-nav-link {
    font-size: 16px;
    color: var(--text-sub);
    padding: 8px 14px;
    border-radius: 10px;
    transition: background 0.15s, color 0.15s;
  }

  .pc-nav-link.active {
    color: var(--wood);
    font-weight: 600;
  }

  .pc-nav-link:hover { background: rgba(139, 94, 60, 0.06); }

  .pc-nav-history { margin-left: 4px; }

  .main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
    max-width: var(--content-w);
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px 0;
    background: transparent;
  }

  .main-content {
    max-width: none;
    width: 100%;
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .convert-pane,
  .tab-pane {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .convert-scroll,
  .pane-inner {
    flex: none;
    min-height: auto;
    overflow-y: visible;
    padding-bottom: 8px;
  }

  .tab-bar { display: none; }

  .content-block {
    display: flex !important;
  }

  .content-fold {
    padding: 24px;
  }

  .content-fold summary {
    display: none;
  }

  .content-fold .fold-body {
    padding-top: 0;
  }

  .content-card h1 {
    font-size: 28px;
  }

  .content-card h2 {
    font-size: 20px;
  }

  .pair-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-table {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-converter {
    max-width: 720px;
    margin: 0 auto;
  }

  .site-footer {
    display: block;
    flex-shrink: 0;
    margin-top: auto;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 24px calc(50vw - 50% + 24px);
    box-sizing: border-box;
    background: var(--wood);
    box-shadow: none;
    clip-path: none;
  }

  .site-footer-inner {
    max-width: var(--content-w);
    margin: 0 auto;
  }

  .toast { bottom: 32px; }

  .back-to-top {
    display: flex;
    bottom: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 481px) {
  .convert-scroll,
  .pane-inner {
    padding-left: 20px;
    padding-right: 20px;
  }

  .pair-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .quick-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
}

@media (max-width: 1023px) {
  .benefit-list,
  .example-grid {
    grid-template-columns: 1fr;
  }
}
