:root {
  --color-dark: #121531;
  --color-paper: #E8E9EA;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #ED7D6E;
  --color-dark-bg: #121531;
  --color-paper-bg: #E8E9EA;
  --color-card-dark: #1a1d3a;
  --color-card-light: #dcdde0;
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

html { box-sizing: border-box; scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--color-paper-bg);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* 表面上下文变量覆盖 */
.surface-dark { background: var(--color-dark-bg); color: var(--color-paper); }
.surface-dark h1, .surface-dark h2, .surface-dark h3, .surface-dark p, .surface-dark li, .surface-dark dt, .surface-dark dd { color: var(--color-paper); }
.surface-dark a { color: var(--color-accent); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .badge { background: rgba(255,255,255,0.1); color: var(--color-accent); }
.surface-dark .card-light { background: var(--color-card-dark); }
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

.surface-light { background: var(--color-paper-bg); color: var(--color-text); }
.surface-light h1, .surface-light h2, .surface-light h3, .surface-light p, .surface-light li, .surface-light dt, .surface-light dd { color: var(--color-text); }
.surface-light a { color: var(--color-brand); }
.surface-light .hl { color: var(--color-brand); }
.surface-light .badge { color: var(--color-brand); }
.surface-light .card-light { background: var(--color-card-light); }

/* 排版 */
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1.5em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 1em;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 1.5em 0 0.5em;
}
p, ul, ol {
  max-width: 38em;
  margin: 0 0 1em;
}
.badge {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75em;
  display: inline-block;
  padding: 0.25em 0.6em;
  border-radius: 6px;
}
.hl { 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); position: relative; }
section:not(:last-child)::after {
  content: ""; display: block; height: 1px; background: currentColor; opacity: 0.12; margin: 0 calc(var(--gap) * -1);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 组件 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  height: 52px; padding: 0 1.5em; border-radius: var(--radius-btn);
  font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background-color 0.2s ease;
  border: none; white-space: nowrap;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary { background: transparent; border: 1px solid currentColor; color: currentColor; }
.btn-secondary:hover { background: rgba(0,0,0,0.06); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.card {
  border-radius: var(--radius-card); padding: 1.5em;
  border: var(--card-border); box-shadow: var(--card-shadow);
}

table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.95rem; }
th, td { padding: 0.75em 1em; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); vertical-align: top; }
.surface-dark th, .surface-dark td { border-bottom-color: rgba(255,255,255,0.1); }
th { font-weight: 600; }

details { margin-bottom: 1em; border-radius: 12px; }
summary {
  padding: 1em; 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; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details > div { padding: 0 1em 1em; line-height: 1.6; }

/* 导航与页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper-bg); border-bottom: 1px solid rgba(0,0,0,0.08); padding: 1em 0; transition: background 0.3s; }
header.scrolled { background: rgba(232,233,234,0.95); backdrop-filter: blur(8px); }
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 0.75em; text-decoration: none; color: inherit; }
.brand img { height: 32px; width: auto; display: block; }
nav { display: flex; align-items: center; gap: 1.5em; }
nav a { text-decoration: none; font-weight: 500; color: var(--color-text); transition: color 0.2s; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }
footer { padding: 3em 0; border-top: 1px solid rgba(0,0,0,0.1); margin-top: var(--section-y); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2em; }
.footer-links a { display: block; margin-bottom: 0.5em; text-decoration: none; color: var(--color-text); font-size: 0.95rem; }
.copyright { font-size: 0.85rem; opacity: 0.7; margin-top: 1em; }

/* SVG 基础与动效 */
svg { width: 100%; height: auto; max-width: 100%; display: block; }
svg:not([width]):not([height]) { width: 24px; height: 24px; }
.svg-layer { transform-box: fill-box; transform-origin: center; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float-alt { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes breathe { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-15px); } to { opacity: 1; transform: translateX(0); } }

.anim-float { animation: float 5s ease-in-out infinite; }
.anim-float-alt { animation: float-alt 6s ease-in-out infinite 1s; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 4s ease forwards; }
.anim-breathe { animation: breathe 2.5s ease-in-out infinite; }
.anim-slide { animation: slide-in 1.2s ease forwards; }

@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; }
  h1 { font-size: clamp(2rem, 8vw, 3.5rem); }
  nav { gap: 1em; }
  .btn { height: 48px; padding: 0 1.25em; font-size: 0.95rem; }
}

/* 兜底：裁掉横向溢出 */
main, section, #overview, div.container {
  overflow-x: clip;
}
