/* ===== 基础变量 ===== */
:root {
  --bg: #f5f7fb;
  --bg2: #eef2f9;
  --panel: #ffffff;
  --text: #121826;
  --muted: #5a6478;
  --line: #e5e9f2;
  --brand: #1a5cff;
  --brand2: #00b6a1;
  --danger: #e5484d;
  --warn: #f5a524;
  --ok: #12a150;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 30, 60, .08);
  --shadow-lg: 0 18px 48px rgba(20, 30, 60, .14);
  --maxw: 1240px;
}

[data-theme="dark"] {
  --bg: #0d1017;
  --bg2: #121724;
  --panel: #161c29;
  --text: #e9edf6;
  --muted: #97a1b5;
  --line: #232b3d;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.8 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand2); }

img { max-width: 100%; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 15px; cursor: pointer;
  transition: .2s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #4d8bff);
  border-color: transparent; color: #fff;
}
.btn-primary:hover { color: #fff; }
.btn-ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.btn-lg { padding: 14px 30px; font-size: 17px; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; background: var(--bg2); color: var(--muted); border: 1px solid var(--line);
}
.badge-new { background: rgba(26,92,255,.1); color: var(--brand); border-color: transparent; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 60;
  backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 66px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--text); letter-spacing: .3px; }
.logo:hover { color: var(--text); }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; font-weight: 900; font-size: 15px;
}
.logo span.sub { font-size: 12px; color: var(--muted); font-weight: 600; }

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  padding: 8px 12px; border-radius: 10px; font-size: 15px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--bg2); color: var(--text); }
.nav a.active { color: var(--brand); background: rgba(26,92,255,.09); }

.tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--bg2); }
.menu-btn { display: none; }

/* ===== Hero ===== */
.hero {
  position: relative; overflow: hidden; padding: 62px 0 54px;
  background:
    radial-gradient(1000px 420px at 12% -10%, rgba(26,92,255,.22), transparent 60%),
    radial-gradient(760px 380px at 88% 8%, rgba(0,182,161,.20), transparent 62%),
    var(--bg2);
  border-bottom: 1px solid var(--line);
}
.hero h1 { font-size: 40px; line-height: 1.25; margin: 0 0 16px; letter-spacing: -.5px; }
.hero .lead { font-size: 18px; color: var(--muted); max-width: 720px; margin: 0 0 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px; align-items: center; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }

.mock-phone {
  position: relative; width: 268px; height: 400px; margin-left: auto; border-radius: 34px;
  background: linear-gradient(160deg, #12213f, #1a5cff 55%, #00b6a1);
  box-shadow: var(--shadow-lg); padding: 22px 18px; color: #fff; overflow: hidden;
}
.mock-phone::after {
  content: ""; position: absolute; inset: auto -30% -45% -30%; height: 240px;
  background: radial-gradient(circle at 50% 0, rgba(255,255,255,.35), transparent 70%);
}
.mock-phone .t { font-size: 13px; opacity: .85; }
.mock-phone .n { font-size: 26px; font-weight: 800; margin: 6px 0 16px; }
.mock-phone .row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px;
}
.mock-phone .up { color: #7dffb2; font-weight: 700; }
.mock-phone .down { color: #ff9db1; font-weight: 700; }
.mock-phone .dl {
  position: absolute; left: 18px; right: 18px; bottom: 20px; text-align: center;
  background: #fff; color: #12213f; border-radius: 999px; padding: 11px; font-weight: 700; font-size: 14px;
}

/* ===== 区块 ===== */
.section { padding: 54px 0; }
.section.alt { background: var(--bg2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 27px; letter-spacing: -.3px; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.more { font-size: 14px; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: .22s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.card .ico {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(26,92,255,.14), rgba(0,182,161,.16)); font-size: 20px;
}
.card .meta { margin-top: 14px; font-size: 13px; color: var(--muted); display: flex; gap: 12px; }

.card-list { display: grid; gap: 14px; }
.post {
  display: flex; gap: 16px; padding: 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); transition: .2s;
}
.post:hover { border-color: var(--brand); transform: translateY(-2px); }
.post .idx {
  flex: 0 0 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--bg2); color: var(--brand); font-weight: 800; font-size: 15px;
}
.post h4 { margin: 0 0 6px; font-size: 16.5px; }
.post h4 a { color: var(--text); }
.post h4 a:hover { color: var(--brand); }
.post p { margin: 0; color: var(--muted); font-size: 14px; }

/* ===== 目录树 ===== */
.dir-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.dir {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.dir h3 { margin: 0 0 4px; font-size: 17px; }
.dir .cnt { font-size: 12.5px; color: var(--muted); }
.dir ul { list-style: none; margin: 12px 0 0; padding: 0; }
.dir li { border-top: 1px dashed var(--line); }
.dir li:first-child { border-top: 0; }
.dir li a {
  display: block; padding: 7px 0; font-size: 14.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dir li a:hover { color: var(--brand); }

/* ===== 正文页布局 ===== */
.crumb { padding: 14px 0; font-size: 13.5px; color: var(--muted); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }
.crumb span { margin: 0 6px; opacity: .6; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 28px; padding-bottom: 60px; align-items: start; }

.side { position: sticky; top: 86px; }
.side-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.side-box h4 { margin: 0 0 10px; font-size: 14px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.side-box ul { list-style: none; margin: 0; padding: 0; }
.side-box li a {
  display: block; padding: 8px 10px; border-radius: 9px; font-size: 14.5px; color: var(--text);
}
.side-box li a:hover { background: var(--bg2); color: var(--brand); }
.side-box li a.cur { background: rgba(26,92,255,.1); color: var(--brand); font-weight: 600; }
.side-box .cnt-badge { float: right; font-size: 12px; color: var(--muted); }

.article {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 34px 38px; box-shadow: var(--shadow);
}
.article > header { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 8px; }
.article h1 { font-size: 31px; line-height: 1.35; margin: 0 0 12px; letter-spacing: -.4px; }
.article .meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; color: var(--muted); }

.prose { font-size: 16.2px; }
.prose h2 {
  font-size: 22px; margin: 40px 0 14px; padding-left: 12px; border-left: 4px solid var(--brand); line-height: 1.4;
}
.prose h3 { font-size: 18.5px; margin: 28px 0 10px; }
.prose h4 { font-size: 16.5px; margin: 22px 0 8px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 24px; }
.prose li { margin-bottom: 7px; }
.prose li > strong { color: var(--text); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14.8px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.prose th { background: var(--bg2); font-weight: 700; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg2) 55%, transparent); }
.prose code {
  background: var(--bg2); padding: 2px 6px; border-radius: 6px; font-size: 14px;
  font-family: "SFMono-Regular", Consolas, monospace; word-break: break-all;
}
.prose blockquote {
  margin: 0 0 18px; padding: 14px 18px; border-left: 4px solid var(--brand2);
  background: color-mix(in srgb, var(--brand2) 8%, transparent); border-radius: 0 10px 10px 0; color: var(--text);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose .step-note { font-size: 14px; color: var(--muted); }

.toc { position: sticky; top: 86px; font-size: 14px; }
.toc-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.toc h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 6px 0 6px 12px; color: var(--muted); margin-left: -2px; border-left: 2px solid transparent; }
.toc li a:hover, .toc li a.on { color: var(--brand); border-left-color: var(--brand); }
.toc li.lv3 a { padding-left: 26px; font-size: 13.5px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; }
.pager a {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; font-size: 14.5px; color: var(--text);
}
.pager a:hover { border-color: var(--brand); }
.pager .lbl { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.pager .next { text-align: right; }

.rel { margin-top: 34px; }
.rel .grid { grid-template-columns: repeat(3, 1fr); }

.alert {
  border-radius: 12px; padding: 14px 16px; margin: 22px 0; font-size: 14.6px;
  background: rgba(245,165,36,.12); border: 1px solid rgba(245,165,36,.35);
}

/* ===== FAQ 折叠 ===== */
.faq-item { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 10px; overflow: hidden; }
.faq-item summary {
  cursor: pointer; padding: 15px 18px; font-weight: 600; font-size: 16px; list-style: none;
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--brand); font-size: 20px; font-weight: 700; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item .faq-body { padding: 0 18px 16px; color: var(--muted); font-size: 15px; }
.faq-item .faq-body p:last-child { margin-bottom: 0; }

/* ===== 搜索 ===== */
.search-mask {
  position: fixed; inset: 0; background: rgba(9, 14, 26, .55); backdrop-filter: blur(3px);
  z-index: 90; display: none; padding: 12vh 20px 20px;
}
.search-mask.on { display: block; }
.search-box { max-width: 640px; margin: 0 auto; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.search-box input {
  width: 100%; border: 0; background: transparent; color: var(--text);
  padding: 18px 20px; font-size: 17px; outline: none;
}
.search-res { max-height: 52vh; overflow: auto; border-top: 1px solid var(--line); }
.search-res a { display: block; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--text); }
.search-res a:hover, .search-res a.on { background: var(--bg2); }
.search-res b { font-size: 15.5px; display: block; }
.search-res small { color: var(--muted); font-size: 13px; }
.search-res .empty { padding: 26px; text-align: center; color: var(--muted); }

/* ===== 下载卡 ===== */
.dl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dl-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-align: center; box-shadow: var(--shadow);
}
.dl-card .p { font-size: 30px; margin-bottom: 8px; }
.dl-card h4 { margin: 0 0 6px; font-size: 16.5px; }
.dl-card p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.dl-card .btn { width: 100%; }

/* ===== Footer ===== */
.footer { background: var(--bg2); border-top: 1px solid var(--line); padding: 44px 0 24px; margin-top: 20px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 26px; }
.foot-grid h5 { margin: 0 0 12px; font-size: 14.5px; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-grid li { margin-bottom: 7px; }
.foot-grid li a { color: var(--muted); font-size: 14px; }
.foot-grid li a:hover { color: var(--brand); }
.disclaimer {
  margin-top: 26px; padding-top: 18px; border-top: 1px dashed var(--line);
  font-size: 13px; color: var(--muted); line-height: 1.7;
}
.copyright { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* ===== 404 ===== */
.err-wrap { min-height: 66vh; display: grid; place-items: center; text-align: center; padding: 60px 20px; }
.err-code {
  font-size: 130px; font-weight: 900; line-height: 1; letter-spacing: -6px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.err-wrap p { color: var(--muted); font-size: 17px; max-width: 560px; }
.err-actions { display: flex; gap: 12px; justify-content: center; margin: 24px 0 30px; flex-wrap: wrap; }

/* ===== 回到顶部 ===== */
#top {
  position: fixed; right: 22px; bottom: 22px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; opacity: 0; pointer-events: none; transition: .25s; z-index: 70;
}
#top.on { opacity: 1; pointer-events: auto; }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .mock-phone { margin: 0 auto; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .dl-grid { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 860px) {
  .nav { display: none; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px; gap: 2px; box-shadow: var(--shadow); }
  .nav.on { display: flex; }
  .menu-btn { display: grid; }
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .hero h1 { font-size: 30px; }
  .g2, .g3, .dir-grid { grid-template-columns: 1fr; }
  .article { padding: 24px 20px; }
  .article h1 { font-size: 25px; }
  .pager { grid-template-columns: 1fr; }
  .rel .grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .dl-grid, .g4, .foot-grid { grid-template-columns: 1fr; }
  .err-code { font-size: 96px; }
  .mock-phone { width: 232px; height: 356px; }
}
