/* === 基础重置与全局变量 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

:root {
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --line-height-body: 1.75;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* === 上下文颜色覆盖 === */
.dark-surface { background: var(--color-dark); color: var(--color-paper); }
.dark-surface .hl { color: var(--color-accent); }
.dark-surface a { color: var(--color-accent); }
.dark-surface .tag { color: var(--color-accent); }

.paper-surface { background: var(--color-paper); color: var(--color-text); }
.paper-surface .hl { color: var(--color-brand); }
.paper-surface a { color: var(--color-brand); }
.paper-surface .tag { color: var(--color-brand); }

.card-light {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
}
.card-light .hl { color: var(--color-brand); }
.card-light a { color: var(--color-brand); }

/* === 排版系统 === */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
section {
  padding-block: var(--section-y);
}
h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 0.8); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: calc(var(--gap) * 0.5); }
p { margin-bottom: 1rem; max-width: 38em; }
.tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}
.text-center { text-align: center; }
.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); }
.container { overflow-x: hidden; }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.dark-surface .btn-secondary { color: var(--color-paper); }
.paper-surface .btn-secondary { color: var(--color-text); }

/* === 组件：卡片与表格 === */
.card {
  padding: 24px;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  background: var(--bg, var(--color-paper));
  color: var(--fg, var(--color-text));
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
}
th { font-weight: 700; }
td:first-child { font-weight: 600; }

/* === 组件：FAQ === */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  background: var(--bg, var(--color-paper));
  color: var(--fg, var(--color-text));
}
summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 40px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}
details[open] summary::after { content: "-"; }
details > div { padding: 0 20px 16px; }

/* === SVG 基础与动效类 === */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.anim-flow {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-cycle 6s linear infinite;
}
.anim-float {
  animation: float-up 5s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
.anim-breathe {
  animation: breathe 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.anim-slide {
  animation: slide-in 7s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes dash-cycle {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
@keyframes float-up {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.5; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}
@keyframes slide-in {
  0% { transform: translateX(0); opacity: 1; }
  15% { transform: translateX(12px); opacity: 0.7; }
  85% { transform: translateX(12px); opacity: 0.7; }
  100% { transform: translateX(0); opacity: 1; }
}

/* === 响应式与无障碍 === */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  section { padding-block: calc(var(--section-y) * 0.7); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
  .anim-flow, .anim-float, .anim-breathe, .anim-slide {
    animation: none !important;
  }
}
