/* ==================== 设计变量 ==================== */
:root {
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  --header-h: 64px;
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ==================== 基础重置与排版 ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ==================== 主题层 ==================== */
.paper-face { background: var(--color-paper); color: var(--color-text); }
.dark-face { background: var(--color-dark); color: var(--color-paper); }
.paper-face .hl { color: var(--color-brand); }
.dark-face .hl { color: var(--color-accent); }
.theme-light-card {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
}
.theme-light-card .hl { color: var(--color-brand); }

/* ==================== 容器与网格 ==================== */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section-wrap {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.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); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.min-w-0 { min-width: 0; }

/* ==================== 标题与眉标 ==================== */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
}
.paper-face .badge { color: var(--color-brand); background: rgba(82, 20, 235, 0.1); }
.dark-face .badge { color: var(--color-accent); background: rgba(153, 119, 238, 0.15); }
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 1rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.8rem;
}
p { margin-bottom: 1rem; max-width: 38em; }

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 2px solid currentColor;
  color: inherit;
}
.paper-face .btn-secondary { border-color: var(--color-text); color: var(--color-text); }
.dark-face .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }

/* ==================== 卡片与面板 ==================== */
.card {
  padding: 1.5rem;
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  background: var(--color-paper);
  color: var(--color-text);
}
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.dark-panel .card { background: var(--color-paper); color: var(--color-text); border-color: var(--color-text); }

/* ==================== 表格与 FAQ ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid currentColor;
  text-align: left;
}
th { font-weight: 600; opacity: 0.8; }
details {
  border: var(--card-border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  background: var(--color-paper);
  color: var(--color-text);
  overflow: hidden;
}
summary {
  padding: 1rem;
  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.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details > div { padding: 0 1rem 1rem; }
.dark-face details { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); color: var(--color-paper); }
.dark-face details > div { color: var(--color-paper); }

/* ==================== SVG 动效基类 ==================== */
.svg-icon { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.5; }
svg[data-animated] path, svg[data-animated] rect, svg[data-animated] circle, svg[data-animated] line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.anim-draw { animation: draw-line 6s ease-in-out infinite alternate; }
.anim-float { animation: float 4s ease-in-out infinite alternate; }
.anim-breathe { animation: breathe 3s ease-in-out infinite alternate; }
.anim-slide { animation: slide-in 5s ease-in-out infinite alternate; }
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}
@keyframes breathe {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}
@keyframes slide-in {
  0% { transform: translateX(20px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}
.transform-box-center { transform-box: fill-box; transform-origin: center; }

/* ==================== 响应式与无障碍 ==================== */
@media (max-width: 768px) {
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
/* ==================== 页头页脚 ==================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.dark-face .site-header { background: var(--color-dark); }
.site-header.scrolled { border-bottom-color: rgba(128,128,128,0.2); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: 1.5rem; }
nav a { font-weight: 500; position: relative; }
nav a::after {
  content: ""; position: absolute; bottom: -4px; left: 0; width: 0; height: 2px;
  background: currentColor; transition: width 0.2s;
}
nav a:hover::after, nav a[aria-current="page"]::after { width: 100%; }
nav a[aria-current="page"] { font-weight: 700; }
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid currentColor;
  margin-top: 2rem;
  font-size: 0.9rem;
  opacity: 0.8;
}
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.footer-links a:hover { text-decoration: underline; }

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
