:root {
  --color-dark: #21163C;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --font-sans: "Inter", "Noto Sans SC", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

/* 表面上下文变量覆盖 */
.surface-dark {
  --bg: var(--color-dark);
  --text: var(--color-paper);
  --brand: var(--color-accent);
  --accent: var(--color-accent);
}
.surface-dark .hl { color: var(--color-accent); }
.surface-dark a:not(.btn) { color: var(--color-accent); }
.surface-dark .timeline-item { border-left-color: var(--color-accent); }
.surface-dark .timeline-time { background: var(--color-accent); color: var(--color-dark); }

.surface-paper {
  --bg: var(--color-paper);
  --text: var(--color-text);
  --brand: var(--color-brand);
  --accent: var(--color-accent);
}
.surface-paper .hl { color: var(--color-brand); }
.surface-paper a:not(.btn) { color: var(--color-brand); }

.card-light-on-dark {
  --bg: var(--color-paper);
  --text: var(--color-text);
  --brand: var(--color-brand);
  --accent: var(--color-accent);
}

/* 容器与排版 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 0; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; }
h3 { font-size: 1.35rem; line-height: 1.2; }
p { margin-bottom: 1em; max-width: 38em; }
ul, ol { padding-left: 1.2em; box-sizing: border-box; max-width: 100%; }
li { margin-bottom: 0.5em; box-sizing: border-box; max-width: 100%; overflow-wrap: break-word; }

/* 修复目录列表在窄屏下的横向溢出 */
.toc-nav ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 2rem; }
@media (max-width: 767px) { .toc-nav ul { columns: 1; } }
.toc-nav li { margin-bottom: 0.4rem; }

/* 区块与分割 */
section { padding: var(--section-y) 0; border-bottom: 1px solid rgba(25,21,35,0.1); }
section:last-of-type { border-bottom: none; }
.surface-dark section { border-bottom-color: rgba(244,243,247,0.1); }

.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 0.5em; text-transform: uppercase; }
.surface-dark .badge { color: var(--color-accent); }
.surface-paper .badge { color: var(--color-brand); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0 1.25em; height: 48px; min-height: 48px;
  border-radius: var(--radius-btn); font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  border: none; font-size: 1rem;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-secondary { background: transparent; border: 1px solid currentColor; color: inherit; }
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

/* 卡片与面板 */
.card {
  background: var(--bg, var(--color-paper));
  border: var(--card-border); border-radius: var(--radius-card);
  padding: 1.5rem; box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.svg-panel {
  background: var(--color-dark); border-radius: var(--radius-card);
  padding: 1.5rem; position: relative; overflow: hidden;
}
.surface-dark .svg-panel {
  background: rgba(244,243,247,0.05); border: 1px solid rgba(244,243,247,0.1);
}

/* 网格与布局 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.split-row { display: flex; align-items: center; gap: var(--gap); }
.split-row.reverse { flex-direction: row-reverse; }
.split-content { flex: 1; min-width: 0; }
.split-visual { flex: 1; min-width: 0; }
@media (max-width: 767px) {
  .split-row, .split-row.reverse { flex-direction: column; }
}

/* 表格 */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
th, td { padding: 0.75rem 1rem; border-bottom: 1px solid rgba(25,21,35,0.1); text-align: left; }
th { font-weight: 600; }
.surface-dark th, .surface-dark td { border-bottom-color: rgba(244,243,247,0.1); }

/* FAQ */
details { margin-bottom: 1rem; border: var(--card-border); border-radius: var(--radius-card); padding: 1rem; background: var(--bg, var(--color-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-top: 1rem; margin-bottom: 0; }

/* SVG 基础 */
svg { width: 100%; height: auto; max-width: 100%; display: block; }
svg circle, svg rect, svg path { vector-effect: non-scaling-stroke; }

/* 动效定义 */
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes float-gentle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes rotate-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse-opacity { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(12px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 4s ease forwards; }
.anim-float { animation: float-gentle 5s ease-in-out infinite; }
.anim-rotate { animation: rotate-slow 14s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: pulse-opacity 3.5s ease-in-out infinite; }
.anim-slide { animation: slide-in 0.8s ease forwards; animation-fill-mode: both; }

.anim-delay-1 { animation-delay: 0.6s; }
.anim-delay-2 { animation-delay: 1.2s; }
.anim-delay-3 { animation-delay: 1.8s; }

@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-float, .anim-rotate, .anim-pulse, .anim-slide { animation: none !important; }
  .anim-draw { stroke-dashoffset: 0; }
  .anim-slide { opacity: 1; transform: none; }
}

/* 导航与页脚 */
header { position: sticky; top: 0; z-index: 100; background: rgba(244,243,247,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(25,21,35,0.1); padding: 0.75rem 0; }
.surface-dark header { background: rgba(33,22,60,0.95); border-bottom-color: rgba(244,243,247,0.1); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; }
.logo img { height: 32px; width: auto; vertical-align: middle; }
nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
nav a { text-decoration: none; color: inherit; font-weight: 500; padding: 0.25rem 0; border-bottom: 2px solid transparent; transition: border-color 0.2s; }
nav a:hover, nav a[aria-current="page"] { border-bottom-color: var(--color-accent); }
.surface-dark nav a { color: var(--color-paper); }
.surface-dark nav a:hover, .surface-dark nav a[aria-current="page"] { border-bottom-color: var(--color-accent); }

footer { background: var(--color-dark); color: var(--color-paper); padding: 2rem 0; margin-top: var(--section-y); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; align-items: center; }
.footer-links a { color: var(--color-paper); text-decoration: none; margin-right: 1rem; }
.footer-links a:hover { text-decoration: underline; }
.copyright { font-size: 0.85rem; opacity: 0.8; }

/* 时间轴与步骤 */
.timeline-item { position: relative; padding-left: 2rem; border-left: 2px solid var(--color-brand); margin-bottom: 2rem; }
.timeline-time { position: absolute; left: -0.85rem; top: 0; background: var(--color-brand); color: #fff; padding: 0.2rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 700; }
.step-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--color-accent); color: var(--color-dark); font-weight: 700; border-radius: 8px; margin-right: 0.5rem; flex-shrink: 0; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.news-card article { height: 100%; display: flex; flex-direction: column; }
.news-card time { font-size: 0.8rem; color: var(--color-brand); margin-bottom: 0.5rem; display: block; }
.surface-dark .news-card time { color: var(--color-accent); }

/* 辅助类 */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.w-full { width: 100%; }

/* 兜底：裁掉横向溢出 */
ul {
  overflow-x: clip;
}
