/* ==================== 设计变量与基础重置 ==================== */
:root {
  --bg-dark: #19102D;
  --bg-paper: #F4F3F7;
  --text-main: #191523;
  --brand: #5214EB;
  --accent: #D66EED;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--text-main);
  --card-shadow: 4px 4px 0 var(--text-main);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-main);
  background: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0.02em; line-height: 1.25; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; margin-bottom: calc(var(--gap) * 0.75); }
p { margin-bottom: var(--gap); max-width: 38em; }
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--section-y); padding-bottom: var(--section-y); }

/* ==================== 表面修饰与取色逻辑 ==================== */
.surface-dark {
  background: var(--bg-dark);
  color: var(--bg-paper);
}
.surface-dark .hl, .surface-dark .meta-tag, .surface-dark a:not(.btn) { color: var(--accent); }
.surface-dark .hl { color: var(--accent); }
.surface-dark .meta-tag { color: var(--accent); }
.surface-dark .card {
  background: var(--bg-paper);
  color: var(--text-main);
  border-color: var(--text-main);
  box-shadow: var(--card-shadow);
}
.surface-dark .card .meta-tag { color: var(--brand); }
.surface-dark .card .hl { color: var(--brand); }
.surface-dark table th { background: rgba(0,0,0,0.06); }
.surface-dark table td, .surface-dark table th { border-color: var(--text-main); }

.meta-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: calc(var(--gap) * 0.5);
}
.hl { color: var(--brand); }

/* ==================== 组件样式 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.75em 1.5em;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border-radius: var(--radius-btn);
}
.btn-primary { background: var(--accent); color: var(--bg-dark); }
.btn-secondary { background: transparent; border: 2px solid var(--text-main); color: var(--text-main); }
.surface-dark .btn-secondary { border-color: var(--bg-paper); color: var(--bg-paper); }
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card {
  background: var(--bg-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border-radius: var(--radius-card);
}

.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; }

table { width: 100%; border-collapse: collapse; margin: var(--gap) 0; }
th, td { border: 1px solid var(--text-main); padding: var(--gap); text-align: left; vertical-align: top; }
th { font-weight: 700; background: rgba(0,0,0,0.05); }

details { border: var(--card-border); box-shadow: var(--card-shadow); margin-bottom: var(--gap); border-radius: var(--radius-card); }
summary {
  padding: var(--gap);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  position: relative;
  padding-left: 1.5em;
}
summary::before { content: "+"; position: absolute; left: 0; font-weight: 700; }
details[open] summary::before { content: "-"; }
details p { padding: 0 var(--gap) var(--gap); }

/* ==================== SVG 动效系统 ==================== */
.hero-svg, .panel-svg { width: 100%; height: auto; max-width: 100%; display: block; }
svg { overflow: visible; }

@keyframes drawFlow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatDot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.draw-path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawFlow 3s linear infinite;
}
.flow-dot {
  animation: floatDot 2.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.breathe {
  animation: breathe 3s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .draw-path, .flow-dot, .breathe { animation: none !important; }
}

/* ==================== 页头与页脚 ==================== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-paper);
  border-bottom: 2px solid var(--text-main);
  padding: 0.75em 0;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
nav a { margin-left: var(--gap); font-weight: 600; font-size: 0.95rem; }
nav a[aria-current="page"] { color: var(--brand); text-decoration: underline; }
.surface-dark nav a[aria-current="page"] { color: var(--accent); }

footer {
  border-top: 2px solid var(--text-main);
  padding: var(--section-y) 0;
  margin-top: var(--section-y);
  font-size: 0.9rem;
  opacity: 0.85;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--gap); }
.footer-links a { margin-right: var(--gap); }

/* ==================== 响应式调整 ==================== */
@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
  .flex-row { flex-direction: column; align-items: flex-start; }
  .header-inner { flex-direction: column; gap: var(--gap); }
  nav { margin-top: 0.5em; }
}

/* 兜底：裁掉横向溢出 */
div.container,
section.container.download-hero {
  overflow-x: clip;
}
