:root {
  --c-dark: #140E25;
  --c-paper: #F7F5F3;
  --c-body: #191523;
  --c-brand: #5214EB;
  --c-accent: #C8ED6E;
  --r-card: 8px;
  --r-btn: 6px;
  --shadow-card: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --sec-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --max-w: 1280px;
  --lh: 1.65;
}

/* 面域上下文变量 */
.paper-face {
  --bg: var(--c-paper);
  --text: var(--c-body);
  --text-sub: var(--c-body);
  --accent: var(--c-brand);
}
.dark-face {
  --bg: var(--c-dark);
  --text: var(--c-paper);
  --text-sub: rgba(247, 245, 243, 0.8);
  --accent: var(--c-accent);
}
/* 深色面上的浅色卡片恢复纸面取色 */
.dark-face .card {
  --bg: var(--c-paper);
  --text: var(--c-body);
  --text-sub: var(--c-body);
  --accent: var(--c-brand);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: var(--lh);
  overflow-x: hidden;
}

/* 排版 */
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: var(--gap); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; line-height: 1.25; margin: calc(var(--gap) * 1.5) 0 var(--gap); text-wrap: balance; }
h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.subtitle { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; display: block; }
.hl { color: var(--accent); }

/* 布局 */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--sec-y); padding-bottom: var(--sec-y); position: relative; background: var(--bg); }
section + section { border-top: 1px solid rgba(128,128,128,0.2); }
.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.5rem;
  height: 48px; padding: 0 24px; border-radius: var(--r-btn);
  font-weight: 600; text-decoration: none; cursor: pointer; transition: transform 0.2s ease, background-color 0.2s ease;
}
.btn-primary { background: var(--c-accent); color: #140E25; }
.btn-primary:hover { transform: translateY(-2px); background-color: rgba(200, 237, 110, 0.9); }
.btn-secondary { background: transparent; border: 1px solid var(--text); color: var(--text); }
.btn-secondary:hover { background: rgba(128,128,128,0.1); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card {
  background: var(--bg); border: 0;
  box-shadow: var(--shadow-card); border-radius: var(--r-card);
  padding: 1.5rem; transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.4); }

table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
td, th { padding: 0.75rem 1rem; border-bottom: 1px solid rgba(128,128,128,0.2); text-align: left; }
th { font-weight: 600; }

details { margin-bottom: 1rem; border-bottom: 1px solid rgba(128,128,128,0.2); padding-bottom: 1rem; }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; color: var(--accent); font-weight: 700; }
details[open] summary::before { content: "-"; }

/* 导航与页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid rgba(128,128,128,0.2); padding: 1rem 0; }
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.logo img { height: 32px; width: auto; vertical-align: middle; }
.logo span { margin-left: 0.5rem; font-weight: 700; font-size: 1.1rem; }
nav ul { display: flex; list-style: none; gap: 1.5rem; }
nav a { text-decoration: none; color: var(--text); font-weight: 500; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); }
footer { padding: 3rem 0; border-top: 1px solid rgba(128,128,128,0.2); margin-top: var(--sec-y); }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.footer-links a { color: var(--text-sub); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* SVG 基础 */
svg { width: 100%; height: auto; max-width: 100%; overflow: visible; }
.svg-panel { background: var(--bg); border-radius: var(--r-card); padding: 1rem; }

/* SVG 动效 Keyframes */
@keyframes nodeLight {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
.anim-node { animation: nodeLight 4s infinite ease-in-out; transform-box: fill-box; transform-origin: center; }
.anim-node:nth-child(1) { animation-delay: 0s; }
.anim-node:nth-child(2) { animation-delay: 0.5s; }
.anim-node:nth-child(3) { animation-delay: 1.0s; }
.anim-node:nth-child(4) { animation-delay: 1.5s; }
.anim-node:nth-child(5) { animation-delay: 2.0s; }
.anim-node:nth-child(6) { animation-delay: 2.5s; }

@keyframes floatUp {
  0%, 100% { transform: translateY(0); opacity: 0.9; }
  50% { transform: translateY(-6px); opacity: 1; }
}
.anim-bubble { animation: floatUp 5s infinite ease-in-out; }

@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.anim-dot { animation: breathe 2s infinite ease-in-out; }

@keyframes slideIn {
  0% { transform: translateX(24px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.anim-notify { animation: slideIn 3s infinite ease-in-out; animation-delay: 1.2s; }

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 2s infinite linear; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* 响应式 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  nav ul { gap: 1rem; }
  .hero-stack { flex-direction: column; }
}
