:root {
  --fg: #1a1d21;
  --muted: #5f6b76;
  --line: #e3e8ee;
  --accent: #0b5fff;
  --bg-soft: #f6f8fa;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: #fff;
}

/* ===================== Header ===================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

/* PC 端：不显示汉堡按钮 */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.nav-toggle:hover { border-color: #c3ccd6; }

/* 汉堡图标：三横 */
.hamburger {
  position: relative;
  display: block;
  width: 20px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: background-color .15s ease;
}
.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform .18s ease;
}
.hamburger::before { top: -6px; }
.hamburger::after  { top:  6px; }

/* 展开时三横变 X */
.nav-toggle[aria-expanded="true"] .hamburger { background: transparent; }
.nav-toggle[aria-expanded="true"] .hamburger::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .hamburger::after  { transform: translateY(-6px) rotate(-45deg); }

/* PC 端导航：横排，间隔拉大 */
.nav-panel {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-panel a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
  padding: 4px 0;
}
.nav-panel a:hover { color: var(--accent); }

/* PC 端只显示主要项（Calculators / About / Privacy / Contact），
   工具链接走首页索引、页脚和页面底部的 Related 模块。
   注意：这里只是 CSS 隐藏，链接仍在 HTML 里，Google 照常抓得到。 */
.nav-extra { display: none; }

/* ===================== 移动端：收成汉堡 ===================== */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .nav-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 200px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 32px rgba(16, 24, 40, .13);
  }
  .nav-panel.is-open { display: flex; }

  /* 移动端展开后放出完整索引，超出屏幕可滚动 */
  .nav-extra { display: block; }
  .nav-panel.is-open { max-height: calc(100vh - 90px); overflow-y: auto; }

  .nav-panel a {
    padding: 12px 13px;
    font-size: 15px;
    color: var(--fg);
    border-radius: 7px;
  }
  .nav-panel a:hover {
    background: var(--bg-soft);
    color: var(--accent);
  }
}

/* ===================== 主体 ===================== */
main { max-width: 760px; margin: 0 auto; padding: 28px 20px 48px; }

h1 { font-size: 28px; line-height: 1.3; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 32px 0 10px; }
.intro { color: var(--muted); margin: 0 0 24px; }

.calc {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.calc form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.field label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.field-label { font-weight: 600; }
.field input,
.field select {
  font: inherit;
  padding: 9px 10px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
.field input:focus,
.field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.unit { color: var(--muted); font-size: 12px; }
.help { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

output[data-output] { display: block; margin-top: 18px; }
.result {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.result dt { color: var(--muted); font-size: 14px; }
.result dd { margin: 0; font-weight: 600; text-align: right; }
.note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.error { color: #b3261e; font-size: 14px; }

code {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 14px;
}

details {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
details summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 8px 0 0; font-size: 15px; }

.related { margin-top: 36px; }
.related ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.related a { color: var(--accent); text-decoration: none; }
.related a:hover { text-decoration: underline; }

.tool-list { list-style: none; padding: 0; display: grid; gap: 18px; }
.tool-list li { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tool-list a { font-weight: 600; color: var(--accent); text-decoration: none; font-size: 17px; }
.tool-list p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* ===================== Footer ===================== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 30px 20px;
  text-align: center;
}
/* 底部链接：flex + 大 gap，取代原来挤在一起的 "·" 分隔 */
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 26px;
  margin-bottom: 16px;
}
.footer-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
.footer-nav a:hover { text-decoration: underline; }
.footer-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 480px) {
  h1 { font-size: 23px; }
  .result { grid-template-columns: 1fr; }
  .result dd { text-align: left; }
  .footer-nav { gap: 12px 20px; }
}
