/* ===== 亲戚关系计算器 —— 样式 ===== */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-ink: #1d4ed8;
  --ok: #10b981;
  --ban: #d1d5db;
  --ban-ink: #9ca3af;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 18px; }

/* —— 页头 —— */
.site-header { padding: 28px 0 6px; text-align: center; }
.site-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: .5px;
}
.site-header .tagline { color: var(--ink-soft); font-size: 15px; margin: 0; }

/* —— 工具卡片 —— */
.tool-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  margin: 22px 0;
}

/* 分段控件（性别 / 方向） */
.seg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.seg-label {
  font-size: 13px;
  color: var(--ink-soft);
  min-width: 64px;
}
.seg-group {
  display: inline-flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active {
  background: var(--card);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
  font-weight: 600;
}

/* 关系链面包屑 */
.breadcrumb {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 48px;
  font-size: 15px;
}
.bc-self {
  font-weight: 700;
  color: var(--accent-ink);
}
.bc-arrow { color: var(--ink-soft); margin: 0 2px; }
.bc-node {
  border: 0;
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  padding: 3px 12px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: all .15s;
}
.bc-node:hover { border-color: var(--accent); color: var(--accent-ink); }

/* 当前结果 */
.result-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  background: #fbfcfe;
}
.result-label {
  font-size: 13px;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.result-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.result-tag {
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  padding: 4px 16px;
  border-radius: 8px;
}
.result-hint { color: var(--ink-soft); font-size: 14px; }
.result-empty { color: var(--ban-ink); font-size: 14px; }
.chain-depth {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

/* 原子关系按钮网格 */
.atom-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.atom-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.atom-btn:hover:not(.is-disabled) {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}
.atom-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.atom-btn.is-disabled {
  color: var(--ban-ink);
  background: #f9fafb;
  border-color: #f3f4f6;
  cursor: not-allowed;
  text-decoration: line-through;
  text-decoration-color: var(--ban);
}

/* 操作按钮 */
.actions { display: flex; gap: 10px; }
.act-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.act-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.act-btn:disabled { opacity: .5; cursor: not-allowed; }

/* —— 文档区 —— */
.docs { margin: 8px 0 40px; }
.docs section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.docs h2 {
  font-size: 20px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
}
.docs h3 { font-size: 16px; margin: 18px 0 8px; color: var(--ink); }
.docs p { margin: 10px 0; color: #374151; }
.docs ul, .docs ol { padding-left: 22px; margin: 10px 0; }
.docs li { margin: 6px 0; color: #374151; }
.docs .lead { color: var(--ink-soft); font-size: 15px; }
.docs b, .docs strong { color: var(--ink); }
.docs .kw { color: var(--accent-ink); font-weight: 600; }

/* —— FAQ 折叠（details/summary 原生实现） —— */
.faq { border-top: 1px solid var(--line); }
.faq-item {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}
.faq-item > .faq-q {
  margin: 0;
  padding: 14px 40px 14px 34px;
  font-weight: 700;
  color: var(--ink);
  position: relative;
  background: var(--accent-soft);
  font-size: 15px;
  line-height: 1.6;
  list-style: none;
  cursor: pointer;
  transition: background .15s;
}
.faq-item > .faq-q::-webkit-details-marker { display: none; }
.faq-item > .faq-q::after {
  content: "+";
  position: absolute;
  right: 14px;
  top: 12px;
  font-size: 18px;
  font-weight: 400;
  color: var(--accent-ink);
  line-height: 1;
}
.faq-item[open] > .faq-q::after { content: "−"; }
.faq-item > .faq-q:hover { background: #e3edfc; }
.faq-q::before {
  content: "Q";
  position: absolute;
  left: 10px;
  top: 13px;
  width: 20px;
  height: 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  text-align: center;
  font-size: 12px;
  line-height: 20px;
  font-weight: 700;
}
.faq-a {
  margin: 0;
  padding: 10px 14px 14px 34px;
  color: #374151;
  font-size: 14px;
  position: relative;
}
.faq-a::before {
  content: "A";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 20px;
  height: 20px;
  background: var(--ok);
  color: #fff;
  border-radius: 50%;
  text-align: center;
  font-size: 12px;
  line-height: 20px;
  font-weight: 700;
}

/* —— 热门查询标签 —— */
.hot-links {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.hot-links li { margin: 0; }
.hot-links a {
  color: var(--accent-ink);
  font-size: 14px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  display: inline-block;
  transition: all .15s;
}
.hot-links a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* —— 高频称呼速查表 —— */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 12px 0;
}
.lookup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}
.lookup-table th,
.lookup-table td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: #374151;
}
.lookup-table thead th {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  white-space: nowrap;
}
.lookup-table tbody tr:nth-child(even) { background: #f9fafb; }
.lookup-table tbody tr:hover { background: var(--accent-soft); }
.lookup-table tbody tr:last-child td { border-bottom: 0; }
.lookup-table td:nth-child(2) { font-weight: 600; color: var(--ink); white-space: nowrap; }
.lookup-table td:nth-child(3) { color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.lookup-table td a { color: var(--accent-ink); }

/* —— 名词定义 —— */
.defs { margin: 10px 0; }
.defs dt {
  font-weight: 700;
  color: var(--accent-ink);
  margin-top: 10px;
}
.defs dt::before { content: "▎"; color: var(--accent); }
.defs dd {
  margin: 2px 0 0 14px;
  color: #374151;
  font-size: 14.5px;
}

/* —— 来源/注释说明 —— */
.src-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: #f9fafb;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* —— 友情链接 —— */
.friend-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.friend-links li { margin: 0; }
.friend-links a {
  color: var(--accent-ink);
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  display: inline-block;
  transition: all .15s;
}
.friend-links a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* —— 404 专用样式 —— */
.notfound {
  text-align: center;
  padding: 60px 18px;
}
.notfound .code {
  font-size: 96px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 0;
  letter-spacing: -2px;
}
.notfound h2 {
  font-size: 22px;
  margin: 16px 0 8px;
}
.notfound p {
  color: var(--ink-soft);
  margin: 0 0 24px;
}
.notfound .btn-home {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 10px;
  text-decoration: none;
  transition: all .15s;
}
.notfound .btn-home:hover { background: var(--accent-ink); text-decoration: none; }

/* —— 页脚 —— */
.site-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--ban);
}
.site-footer a:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}

/* —— 响应式 —— */
@media (max-width: 600px) {
  .site-header h1 { font-size: 22px; }
  .atom-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .atom-btn { font-size: 15px; padding: 12px 0; }
  .seg-label { min-width: auto; }
  .tool-card { padding: 18px 14px; }
  .docs section { padding: 18px 16px; }
}
