/* ================= 基础重置与排版 ================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  color: var(--c-text, #151823);
  background: var(--c-bg, #FCFCFD);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--c-link, #1441EB); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
a:focus-visible { outline: 2px solid var(--c-link, #1441EB); outline-offset: 2px; border-radius: 2px; }
ul, ol { list-style: none; }
h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.1; font-weight: 800; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 1.5); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: var(--gap); }
p { margin-bottom: var(--gap); max-width: 38em; }
mark, .hl { color: inherit; font-weight: inherit; }

/* ================= 设计变量与上下文 ================= */
:root {
  --base-dark: #17203F;
  --base-paper: #FCFCFD;
  --base-text: #151823;
  --base-brand: #1441EB;
  --base-accent: #6EEDBD;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(21, 24, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
}
.ctx-dark {
  --c-bg: var(--base-dark);
  --c-text: var(--base-paper);
  --c-sub: rgba(252, 252, 253, 0.85);
  --c-brand: var(--base-accent);
  --c-link: var(--base-accent);
  --c-card-bg: rgba(252, 252, 253, 0.06);
  --c-border: rgba(252, 252, 253, 0.15);
}
.ctx-paper {
  --c-bg: var(--base-paper);
  --c-text: var(--base-text);
  --c-sub: var(--base-text);
  --c-brand: var(--base-brand);
  --c-link: var(--base-brand);
  --c-card-bg: #ffffff;
  --c-border: rgba(21, 24, 35, 0.12);
}
.section-wrapper {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  background: var(--c-bg);
  position: relative;
}
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* ================= 布局与辅助 ================= */
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.flex-row { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--c-brand);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.chapter-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
  padding-bottom: var(--gap);
  border-bottom: 1px solid var(--c-border);
}
.chapter-nav a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-sub);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
.chapter-nav a:hover { color: var(--c-brand); background: rgba(128,128,128,0.05); }
.content-area { display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 900px) {
  .content-area { grid-template-columns: 1.2fr 1fr; }
}

/* ================= 组件：按钮 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--c-link); outline-offset: 2px; }
.btn-primary {
  background: var(--base-accent);
  color: var(--base-dark);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  color: var(--c-text);
  border-color: var(--c-text);
}
.btn-secondary:hover { background: rgba(128,128,128,0.08); transform: translateY(-2px); }
.btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ================= 组件：卡片 ================= */
.card {
  background: var(--c-card-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.card-header { font-weight: 700; margin-bottom: 0.5rem; color: var(--c-brand); display: flex; align-items: center; gap: 0.5rem; }
.card-body p { font-size: 0.95rem; color: var(--c-sub); margin-bottom: 0.75rem; }
.step-list { counter-reset: step; }
.step-list li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--c-sub);
}
.step-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--base-accent);
  color: var(--base-dark);
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  border-radius: 4px;
}

/* ================= 组件：表格 ================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: var(--gap);
  table-layout: auto;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  word-break: break-word;
}
.data-table th { font-weight: 700; color: var(--c-brand); }
.data-table tr:last-child td { border-bottom: none; }

/* ================= 组件：FAQ ================= */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.faq-item summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--c-text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 1rem 1rem; color: var(--c-sub); line-height: 1.7; }

/* ================= 页头与页脚 ================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(8px);
  padding: 0.75rem 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 600; font-size: 0.95rem; color: var(--c-text); }
.nav-links a[aria-current="page"] { color: var(--c-brand); }
.site-footer {
  background: var(--base-dark);
  color: var(--base-paper);
  padding: var(--section-y) 0;
  margin-top: var(--section-y);
}
.footer-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.footer-col h4 { color: var(--base-accent); margin-bottom: 0.75rem; font-size: 1rem; }
.footer-col a { display: block; color: rgba(252,252,253,0.8); margin-bottom: 0.5rem; font-size: 0.9rem; }
.footer-col a:hover { color: var(--base-accent); }
.footer-copy { text-align: center; margin-top: var(--gap); color: rgba(252,252,253,0.6); font-size: 0.85rem; }

/* ================= SVG 动效关键帧 ================= */
@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes breatheOpacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes slideInRight {
  0%, 100% { transform: translateX(0); opacity: 0.9; }
  50% { transform: translateX(6px); opacity: 1; }
}
@keyframes flowDash {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
.anim-draw { animation: drawLine 6s ease-in-out infinite; }
.anim-breathe { animation: breatheOpacity 4s ease-in-out infinite; }
.anim-float { animation: floatY 8s ease-in-out infinite; }
.anim-slide { animation: slideInRight 7s ease-in-out infinite; }
.anim-flow { animation: flowDash 10s linear infinite; }
svg { width: 100%; height: auto; }
svg .panel { fill: var(--c-card-bg); stroke: var(--c-border); }
svg .line { stroke: var(--c-brand); stroke-width: 1.5; fill: none; pathLength: 1; }
svg .bubble { fill: var(--c-brand); opacity: 0.85; }
svg .dot { fill: var(--c-brand); }
svg .text-bar { fill: var(--c-sub); opacity: 0.6; }
svg .icon-shape { stroke: var(--c-brand); stroke-width: 1.5; fill: none; }

/* ================= 减少动态效果 ================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  html { scroll-behavior: auto; }
}
