:root {
  --bg-dark: #141838;
  --bg-paper: #FCFCFD;
  --text-main: #151723;
  --brand: #142CEB;
  --accent: #6EAFED;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--text-main);
  --card-shadow: 4px 4px 0 var(--text-main);
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  
  --content-max: 960px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg-paper);
  line-height: 1.55;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* 面与取色覆盖 */
.bg-dark {
  background: var(--bg-dark);
  color: var(--bg-paper);
}
.bg-dark .badge, .bg-dark a, .bg-dark .hl { color: var(--accent); }
.bg-dark .btn-secondary { border-color: var(--bg-paper); color: var(--bg-paper); }
.bg-dark .btn-secondary:hover { background: rgba(255,255,255,0.1); }
.bg-dark .card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.2); box-shadow: none; }
.bg-dark table th, .bg-dark table td { border-color: rgba(255,255,255,0.2); }
.bg-dark details { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.2); }

/* 排版 */
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 700; letter-spacing: 0.02em; line-height: 1.15; margin: 0 0 var(--gap) 0; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; letter-spacing: 0.02em; line-height: 1.25; margin: 0 0 var(--gap) 0; }
h3 { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5em 0; }
p { max-width: 38em; margin: 0 0 1em 0; }
.text-center { text-align: center; }
.w-full { width: 100%; }

.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand); margin-bottom: 0.5em; }
.hl { font-weight: 700; color: var(--brand); }
.bg-dark .hl { color: var(--accent); }

/* 布局容器 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding: var(--section-y) 0; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

/* 组件：按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; padding: 0.75em 1.5em; border-radius: var(--radius-btn); font-weight: 600; text-decoration: none; transition: transform 0.2s ease, background 0.2s ease; cursor: pointer; border: none; min-height: 48px; }
.btn-primary { background: var(--accent); color: #0f234a; }
.btn-secondary { background: transparent; border: 2px solid var(--text-main); color: var(--text-main); }
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 组件：卡片 */
.card { border: var(--card-border); border-radius: var(--radius-card); box-shadow: var(--card-shadow); padding: var(--gap); background: var(--bg-paper); }

/* 组件：表格 */
table { width: 100%; border-collapse: collapse; margin-bottom: 1em; table-layout: fixed; }
th, td { padding: 0.75em; border-bottom: 1px solid var(--text-main); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th { font-weight: 700; }

/* 组件：FAQ */
details { border: var(--card-border); border-radius: var(--radius-card); padding: var(--gap); margin-bottom: var(--gap); background: var(--bg-paper); }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2em; }
details[open] summary::after { content: "-"; }
details p { margin: 0.5em 0 0 0; }

/* 页头页脚 */
header { position: sticky; top: 0; background: rgba(252,252,253,0.92); backdrop-filter: blur(8px); z-index: 100; border-bottom: 1px solid rgba(0,0,0,0.1); }
.bg-dark header { background: rgba(20,24,56,0.92); border-bottom: 1px solid rgba(255,255,255,0.1); }
.nav { display: flex; justify-content: space-between; align-items: center; padding: 1em var(--gap); max-width: var(--content-max); margin: 0 auto; }
.logo img { height: 32px; width: auto; vertical-align: middle; }
nav ul { list-style: none; display: flex; gap: 1.5em; margin: 0; padding: 0; }
nav a { text-decoration: none; color: inherit; font-weight: 500; }
nav a:hover, nav a[aria-current="page"] { color: var(--brand); }
.bg-dark nav a:hover, .bg-dark nav a[aria-current="page"] { color: var(--accent); }

footer { padding: var(--section-y) 0; border-top: 1px solid rgba(0,0,0,0.1); margin-top: var(--section-y); }
.bg-dark footer { border-color: rgba(255,255,255,0.1); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--gap); }

/* SVG 动效 */
.flow-line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawPath 5s linear infinite; }
@keyframes drawPath { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }

.flow-dot { animation: driftDot 6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes driftDot { 0% { transform: translate(0, 0); opacity: 0.3; } 100% { transform: translate(18px, -12px); opacity: 1; } }

.bubble { animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, floatBubble 4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; opacity: 0; }
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes floatBubble { from { transform: translateY(0); } to { transform: translateY(-6px); } }

.step-line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawStep 3s ease-out forwards; }
@keyframes drawStep { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .flow-line, .flow-dot, .bubble, .step-line { animation: none !important; }
}

/* 兜底：裁掉横向溢出 */
ul.toc {
  overflow-x: clip;
}
