/* ============================================================
   百家姓暗号 · 全站公共样式（方案 A：极简工具）
   - 颜色全部走 CSS 变量；<html data-theme="dark|light"> 切换
   - 首页工具区的专用样式在 assets/index.css
   ============================================================ */
:root,
[data-theme="dark"] {
  --bg: #0b0b0f; --bg2: #111117; --card: #15151c; --card2: #1b1b24;
  --line: #26262f; --line2: #32323d;
  --text: #ececf1; --sub: #a3a3b0; --muted: #737380;
  --accent: #7c7cff; --accent2: #5b5bf0; --accent-ink: #ffffff;
  --accent-soft: rgba(124, 124, 255, .14); --accent-text: #a5a5ff;
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14);
  --danger: #f87171; --danger-soft: rgba(248, 113, 113, .12);
  --info: #7cb4ff; --info-soft: rgba(124, 180, 255, .14);
  --shadow: 0 20px 60px rgba(0, 0, 0, .35);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .25);
  --nav-bg: rgba(11, 11, 15, .82);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f6f9; --bg2: #f0f0f5; --card: #ffffff; --card2: #f7f7fb;
  --line: #e6e6ee; --line2: #d9d9e3;
  --text: #16161d; --sub: #50505e; --muted: #808090;
  --accent: #5b5bf0; --accent2: #4646d8; --accent-ink: #ffffff;
  --accent-soft: rgba(91, 91, 240, .10); --accent-text: #4a4ad6;
  --ok: #059669; --ok-soft: rgba(5, 150, 105, .10);
  --warn: #b45309; --warn-soft: rgba(217, 119, 6, .10);
  --danger: #dc2626; --danger-soft: rgba(220, 38, 38, .08);
  --info: #2563eb; --info-soft: rgba(37, 99, 235, .09);
  --shadow: 0 18px 50px rgba(30, 30, 60, .10);
  --shadow-sm: 0 4px 14px rgba(30, 30, 60, .08);
  --nav-bg: rgba(246, 246, 249, .85);
  color-scheme: light;
}
:root {
  --radius: 14px; --radius-lg: 18px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --page-max: 1160px; --page-pad: 28px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.65 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.nav-in { display: flex; align-items: center; height: 60px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { width: 34px; height: 34px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.brand-txt b { font-size: 16px; font-weight: 700; letter-spacing: .02em; color: var(--text); }
.brand-txt small { font-size: 11px; color: var(--muted); }
.links { display: flex; gap: 2px; margin-left: auto; }
.links a { padding: 7px 12px; border-radius: 8px; color: var(--sub); font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.links a:hover { color: var(--text); background: var(--card2); }
.links a.on { color: var(--text); background: var(--card2); box-shadow: inset 0 0 0 1px var(--line); }
.theme {
  border: 1px solid var(--line2); background: none; border-radius: 999px;
  padding: 5px 12px; color: var(--sub); font-size: 12px; white-space: nowrap; transition: color .15s, border-color .15s;
}
.theme:hover { color: var(--text); border-color: var(--muted); }
#theme-label { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.burger {
  display: none; margin-left: auto; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line2); background: none; color: var(--sub); font-size: 17px; line-height: 1;
}

/* ---------- 页脚 ---------- */
.foot { margin-top: auto; border-top: 1px solid var(--line); padding: 26px 0 34px; color: var(--muted); font-size: 12px; }
.foot-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.foot-brand { display: flex; align-items: center; gap: 8px; }
.foot-brand img { width: 22px; height: 22px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.foot-links a:hover { color: var(--text); }

/* ---------- 通用按钮 ---------- */
.btn-primary {
  border: 0; border-radius: 11px; color: var(--accent-ink); font-weight: 700; font-size: 14px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 18px rgba(92, 92, 240, .32); padding: 11px 18px; transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.98); }
.btn-sec {
  border: 1px solid var(--line2); background: var(--card); color: var(--text);
  font-weight: 600; font-size: 13px; border-radius: 11px; padding: 0 14px; transition: border-color .15s, background .15s;
}
.btn-sec:hover { border-color: var(--muted); background: var(--card2); }
.ghost {
  border: 1px solid var(--line2); background: none; color: var(--sub);
  font-size: 12px; font-weight: 500; padding: 7px 12px; border-radius: 9px;
  display: inline-flex; gap: 6px; align-items: center; justify-content: center; transition: color .15s, border-color .15s;
}
.ghost:hover { color: var(--text); border-color: var(--muted); }

/* ---------- 内容页（教程 / 问答 / 关于 / 隐私 / 条款 / 联系） ---------- */
.page-container { width: 100%; max-width: 860px; margin: 0 auto; padding: 40px var(--page-pad) 64px; }
.page-container h1 { font-size: 28px; line-height: 1.3; font-weight: 800; letter-spacing: -.01em; margin-bottom: 10px; }
.page-container h2 {
  font-size: 19px; font-weight: 700; margin: 36px 0 14px; padding-top: 4px;
  display: flex; align-items: center; gap: 10px;
}
.page-container h2::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--accent); flex-shrink: 0; }
.page-container h3 { font-size: 15.5px; font-weight: 700; margin: 22px 0 8px; }
.page-container p { color: var(--sub); line-height: 1.9; margin-bottom: 12px; }
.page-container ul, .page-container ol { color: var(--sub); line-height: 1.9; padding-left: 22px; margin-bottom: 12px; }
.page-container li { margin-bottom: 4px; }
.page-container li::marker { color: var(--muted); }
.page-container strong { color: var(--text); }
.page-container a { color: var(--accent-text); font-weight: 500; }
.page-container a:hover { text-decoration: underline; }
.page-container code {
  font-family: var(--mono); font-size: 12.5px; background: var(--card2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px; color: var(--text); word-break: break-all;
}
.page-container pre {
  font-family: var(--mono); background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.7; margin: 12px 0; color: var(--text);
}
.page-container pre code { border: 0; background: none; padding: 0; }
.update-date { font-size: 12px; color: var(--muted); margin-bottom: 24px; }
.tip-box, .highlight-box, .response-box {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 14px 18px; margin: 16px 0; color: var(--sub); font-size: 13.5px; line-height: 1.8;
}
.highlight-box p, .response-box p { margin: 0; color: var(--sub); font-weight: 500; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 22px 0; }
.toc-title { font-weight: 700; margin-bottom: 10px; }
.toc ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 28px; }
.toc li { margin-bottom: 4px; break-inside: avoid; }
.toc a { font-size: 13.5px; }
.article-divider { height: 1px; background: var(--line); margin: 40px 0; }
.contact-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 22px; margin: 20px 0; }
.contact-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.contact-item:last-child { border-bottom: 0; }
.contact-icon { font-size: 22px; flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; background: var(--card2); display: grid; place-items: center; }
.contact-label { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.contact-value { font-size: 14px; color: var(--sub); line-height: 1.6; }
.contact-value a { color: var(--accent-text); }

/* FAQ（问答页与首页共用） */
.faq-group { margin: 26px 0; }
.faq-group-title { font-size: 13px; font-weight: 700; color: var(--accent-text); margin-bottom: 10px; letter-spacing: .02em; }
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; transition: border-color .15s; }
.faq-item:hover { border-color: var(--line2); }
.faq-q {
  font-weight: 600; padding: 14px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  justify-content: space-between; user-select: none;
}
.faq-q::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; transition: transform .2s; flex-shrink: 0; }
.faq-item.open .faq-q::after { transform: rotate(45deg); color: var(--accent-text); }
.faq-a { color: var(--sub); line-height: 1.85; padding: 0 16px 14px; display: none; }
.faq-item.open .faq-a { display: block; }

/* ---------- 无障碍 ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 手机 ---------- */
@media (max-width: 760px) {
  :root { --page-pad: 14px; }
  html { scroll-padding-top: 66px; }
  .nav-in { height: 54px; gap: 10px; }
  .brand-logo { width: 32px; height: 32px; }
  .burger { display: grid; place-items: center; margin-left: 0; }
  .theme { margin-left: auto; width: 38px; height: 38px; padding: 0; border-radius: 10px; font-size: 15px; }
  .theme .tt { display: none; }
  .links {
    display: none; position: absolute; top: 54px; left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 2px; padding: 8px 12px 12px;
    background: var(--card); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm);
  }
  .links.open { display: flex; }
  .links a { padding: 12px 12px; font-size: 15px; }
  .page-container { padding-top: 24px; }
  .page-container h1 { font-size: 23px; }
  .page-container h2 { font-size: 17px; margin-top: 30px; }
  .toc ul { columns: 1; }
  .foot-in { flex-direction: column; align-items: flex-start; }
}
