:root {
  /* 色板 */
  --color-dark-bg: #141838;
  --color-paper: #FCFCFD;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  --color-border: #E5E7EB;
  --color-muted: #6B7280;

  /* 设计 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-brand); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
a:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; border-radius: 2px; }

/* 布局容器 */
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-block: var(--section-y); position: relative; }
section:not(.bg-dark)::after { content: ""; display: block; width: 100%; height: 1px; background: var(--color-border); position: absolute; bottom: 0; left: 0; }
.bg-dark { background: var(--color-dark-bg); color: var(--color-paper); }
.bg-dark a { color: var(--color-accent); }
.bg-dark a:focus-visible { outline-color: var(--color-accent); }

/* 卡片与面板 */
.card-light { background: var(--color-paper); color: var(--color-text); border-radius: var(--radius-card); padding: var(--gap); }
.card-light a { color: var(--color-brand); }
.card { background: #F8F9FA; border-radius: var(--radius-card); padding: var(--gap); }
.bg-dark .card { background: #1A1F42; color: var(--color-paper); }

/* 排版 */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0.02em; line-height: 1.2; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.5em; }
h3 { font-size: 1.25rem; margin-bottom: 0.5em; }
.label { display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-brand); margin-bottom: 0.5em; }
.bg-dark .label { color: var(--color-accent); }
.hl { color: var(--color-brand); }
.bg-dark .hl { color: var(--color-accent); }
p { max-width: 38em; margin-bottom: 1em; }
ul, ol { padding-left: 1.5em; margin-bottom: 1em; }
li { margin-bottom: 0.5em; }

/* 组件 */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  height: 52px; padding: 0 1.5em; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; cursor: pointer; border: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark-bg); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary { background: transparent; color: var(--color-text); border: 1px solid var(--color-text); }
.bg-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

table { width: 100%; min-width: 0; border-collapse: collapse; margin: 1em 0; table-layout: fixed; }
th, td { padding: 0.75em 1em; text-align: left; border-bottom: 1px solid var(--color-border); min-width: 0; word-break: break-word; overflow-wrap: anywhere; }
th { font-weight: 600; white-space: nowrap; }

details { margin-bottom: 1em; border-bottom: 1px solid var(--color-border); padding-bottom: 1em; }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5em; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; display: inline-block; width: 1em; text-align: center; color: var(--color-brand); }
details[open] summary::before { content: "-"; }
details > div { margin-top: 0.5em; padding-left: 1.5em; }

/* 页头页脚 */
header { position: sticky; top: 0; z-index: 10; background: rgba(252,252,253,0.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--color-border); }
.nav-row { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.5em; font-weight: 800; font-size: 1.2rem; color: var(--color-text); }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: 1.5em; list-style: none; }
nav a { color: var(--color-text); font-weight: 500; }
nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
footer { border-top: 1px solid var(--color-border); padding: 2em 0; text-align: center; color: var(--color-muted); font-size: 0.9rem; }

/* SVG 动效基础 */
.svg-panel { width: 100%; height: auto; max-width: 600px; margin: 0 auto; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes drawLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes rotateSync { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.anim-float { animation: float 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 8s linear infinite alternate; }
.anim-slide { animation: slideIn 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-rotate { animation: rotateSync 20s linear infinite; transform-box: fill-box; transform-origin: center; }

@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; }
  .anim-float, .anim-breathe, .anim-draw, .anim-slide, .anim-rotate { animation: none !important; }
}

@media (max-width: 768px) {
  .nav-row ul { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
