:root {
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-base: 1.75;
  --line-height-tight: 1.1;
}

/* 上下文色彩覆盖 */
.dark-surface {
  --c-bg: var(--color-dark);
  --c-text: var(--color-paper);
  --c-brand: var(--color-accent);
  --c-accent: var(--color-accent);
}
.light-card {
  --c-bg: var(--color-paper);
  --c-text: var(--color-text);
  --c-brand: var(--color-brand);
  --c-accent: var(--color-accent);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: var(--line-height-base);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 排版 */
h1, h2, h3, h4 { line-height: var(--line-height-tight); letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-bottom: 0.75em; }
p { margin-bottom: 1em; max-width: 38em; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; height: auto; }

/* 眉标 */
.epigraph {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--c-brand);
}
.epigraph::before { content: ""; display: inline-block; width: 1.2em; height: 2px; background: currentColor; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-primary {
  background: var(--c-accent);
  color: var(--color-dark);
  border: 2px solid transparent;
}
.btn-secondary {
  background: transparent;
  color: var(--c-text);
  border: 2px solid var(--c-text);
}
.dark-surface .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

/* 卡片 */
.card {
  background: var(--c-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* 网格与布局 */
.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; }
.section { padding-block: var(--section-y); }
.section + .section { border-top: 1px solid var(--color-text); }
.dark-surface .section + .section { border-top-color: rgba(233, 232, 234, 0.2); }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 0.8em 1em; text-align: left; border-bottom: 1px solid var(--c-text); }
th { font-weight: 700; }
td:first-child { font-weight: 600; }

/* FAQ */
details {
  background: var(--c-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  padding: 1rem 1.5rem;
  transition: box-shadow 0.2s ease;
}
summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-left: 1.75em; }
summary::marker, summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1em;
  height: 1em;
  margin-top: -0.5em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.2s ease;
}
details[open] summary::before { transform: rotate(90deg); }
details p { margin-top: 0.75rem; color: var(--c-text); }

/* 列表 */
ul, ol { padding-left: 1.2em; margin-bottom: 1em; }
li { margin-bottom: 0.5em; }

/* 关键词高亮 */
.hl { color: var(--c-brand); }
.dark-surface .hl { color: var(--c-accent); }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
  backdrop-filter: blur(8px);
}
.dark-surface .site-header { background: var(--color-dark); border-bottom-color: rgba(233, 232, 234, 0.15); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6em; font-weight: 800; font-size: 1.1rem; }
.brand img { height: 28px; width: auto; }
nav { display: flex; gap: 1.5rem; align-items: center; }
nav a { font-weight: 500; transition: color 0.2s; }
nav a:hover, nav a[aria-current="page"] { color: var(--c-brand); }
.site-footer {
  padding: var(--gap) 0;
  border-top: 1px solid var(--color-text);
  font-size: 0.9rem;
}
.dark-surface .site-footer { border-top-color: rgba(233, 232, 234, 0.2); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }

/* SVG 基础 */
.svg-panel { width: 100%; height: auto; }
.svg-panel path, .svg-panel rect, .svg-panel circle, .svg-panel polygon {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 颜色继承 */
.svg-panel .st-dark { stroke: var(--color-text); }
.svg-panel .st-light { stroke: var(--color-paper); }
.svg-panel .st-brand { stroke: var(--color-brand); }
.svg-panel .st-accent { stroke: var(--color-accent); }
.svg-panel .fill-dark { fill: var(--color-dark); }
.svg-panel .fill-light { fill: var(--color-paper); }
.svg-panel .fill-brand { fill: var(--color-brand); }
.svg-panel .fill-accent { fill: var(--color-accent); }

/* SVG 动效 */
.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-path 4s ease-in-out infinite alternate;
}
@keyframes draw-path {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.float-slow {
  animation: float 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.breathe {
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.slide-in {
  animation: slide 5s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes slide {
  0% { transform: translateX(-8px); opacity: 0.8; }
  100% { transform: translateX(0); opacity: 1; }
}
.pulse-dot {
  animation: pulse 2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes pulse {
  0%, 100% { r: 3; opacity: 1; }
  50% { r: 5; opacity: 0.6; }
}

/* 响应式 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .flex-row { flex-direction: column; align-items: flex-start; }
  nav { gap: 1rem; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
}

/* 减少动态效果 */
@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;
  }
}
