:root {
  /* 色板 */
  --color-bg-dark: #271334;
  --color-bg-paper: #E9E8EA;
  --color-text-body: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;

  /* 上下文变量（默认纸面） */
  --text-color: var(--color-text-body);
  --link-color: var(--color-brand);
  --btn-accent: var(--color-accent);
  --btn-text: var(--color-bg-dark);

  /* 设计 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--text-color);
  --card-shadow: 4px 4px 0 var(--text-color);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  --fw-head: 600;
  --lh-head: 1.25;
  --lh-body: 1.65;
}

/* 深色面上下文 */
.bg-dark {
  --text-color: var(--color-bg-paper);
  --link-color: var(--color-accent);
  --btn-accent: var(--color-accent);
  --btn-text: var(--color-bg-dark);
}

/* 深色面内的浅色卡片上下文 */
.bg-card-light {
  --text-color: var(--color-text-body);
  --link-color: var(--color-brand);
  --btn-accent: var(--color-accent);
  --btn-text: var(--color-bg-dark);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--text-color);
  background-color: var(--color-bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-weight: var(--fw-head); line-height: var(--lh-head); letter-spacing: 0; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-bottom: 0.5em; }
p { margin-bottom: 1em; max-width: 38em; }
a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
img, svg { display: block; max-width: 100%; height: auto; }
ul, ol { padding-left: 1.5em; }
li { margin-bottom: 0.5em; }
strong { font-weight: 600; }

/* 布局容器 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: 1fr 1fr; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }
.flex-row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* 页头与页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--color-bg-paper); border-bottom: 1px solid rgba(0,0,0,0.08); padding: 0.75rem 0; backdrop-filter: blur(8px); }
.bg-dark header { background: var(--color-bg-dark); border-bottom-color: rgba(255,255,255,0.1); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; }
.brand-img { height: 32px; width: auto; display: block; }
.nav-links { display: flex; gap: 1.5rem; list-style: none; }
.nav-links a { color: var(--text-color); font-weight: 500; padding: 0.5rem 0; }
.nav-links a[aria-current="page"] { color: var(--link-color); font-weight: 700; border-bottom: 2px solid var(--link-color); }
@media (max-width: 600px) { .nav-links { display: none; } }

footer { background: var(--color-bg-dark); color: var(--color-bg-paper); padding: 3rem 0; margin-top: var(--section-y); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-links { list-style: none; display: flex; gap: 1.5rem; }
.footer-links a { color: var(--color-bg-paper); opacity: 0.8; }
.footer-links a:hover { opacity: 1; }

/* 按钮 */
.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; cursor: pointer; transition: transform 0.2s ease, filter 0.2s;
  border: none; font-size: 1rem; min-height: 48px; white-space: nowrap;
}
.btn-primary { background: var(--btn-accent); color: var(--btn-text); }
.btn-secondary { background: transparent; border: 2px solid var(--text-color); color: var(--text-color); }
.btn:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn:focus-visible { outline: 3px solid var(--link-color); outline-offset: 2px; }

/* 卡片 */
.card {
  background: var(--color-bg-paper); border: var(--card-border);
  border-radius: var(--radius-card); box-shadow: var(--card-shadow);
  padding: 1.5rem; position: relative;
}
.bg-dark .card { background: var(--color-bg-paper); color: var(--color-text-body); border-color: var(--color-text-body); box-shadow: 4px 4px 0 var(--color-text-body); }

/* 表格 */
.table-wrapper { overflow-x: auto; margin-bottom: 1em; }
table { width: 100%; border-collapse: collapse; min-width: 100%; }
th, td { text-align: left; padding: 0.75em 1em; border-bottom: 1px solid rgba(0,0,0,0.1); }
th { font-weight: 600; background: rgba(0,0,0,0.03); }
td { vertical-align: top; }
.bg-dark table th, .bg-dark table td { border-bottom-color: rgba(255,255,255,0.1); }
.bg-dark table th { background: rgba(255,255,255,0.05); }

/* FAQ */
details { margin-bottom: 1em; border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; background: var(--color-bg-paper); }
summary { padding: 1rem; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; font-size: 1.5rem; font-weight: 300; flex-shrink: 0; margin-left: 1em; }
details[open] summary::after { content: '-'; }
details > div { padding: 0 1rem 1rem; line-height: var(--lh-body); }

/* 眉标与高亮 */
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 0.5em; color: var(--link-color); }
.bg-dark .badge { color: #9EED6E; }
.hl { color: var(--link-color); }
.bg-dark .hl { color: #9EED6E; }

/* SVG 通用样式 */
.svg-viewbox { width: 100%; height: auto; max-width: 600px; }
.svg-panel { background: var(--color-bg-paper); border: var(--card-border); border-radius: var(--radius-card); box-shadow: var(--card-shadow); padding: 1.5rem; }
.bg-dark .svg-panel { background: var(--color-bg-paper); border-color: var(--color-text-body); box-shadow: 4px 4px 0 var(--color-text-body); }

/* SVG 动效关键帧 */
@keyframes flowPath { 0%, 100% { stroke-dashoffset: 1; } 50% { stroke-dashoffset: 0; } }
@keyframes floatUp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes slideIn { 0%, 100% { transform: translateX(0); opacity: 0.8; } 50% { transform: translateX(4px); opacity: 1; } }
@keyframes toggleSwitch { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(24px); } }
@keyframes listItemFade { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

.anim-flow { animation: flowPath 3s ease-in-out infinite; }
.anim-float { animation: floatUp 4s ease-in-out infinite; }
.anim-breathe { animation: breathe 2.5s ease-in-out infinite; }
.anim-slide { animation: slideIn 3.5s ease-in-out infinite; }
.anim-toggle { animation: toggleSwitch 4s ease-in-out infinite; }
.anim-list { animation: listItemFade 5s ease-in-out infinite; }

/* 统一变换原点与盒模型 */
.anim-flow, .anim-float, .anim-breathe, .anim-slide, .anim-toggle, .anim-list {
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  .anim-flow, .anim-float, .anim-breathe, .anim-slide, .anim-toggle, .anim-list { animation: none !important; }
  html { scroll-behavior: auto; }
}
