/* === 设计变量与基础重置 === */
:root {
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  --color-dark-bg-alt: #1F163A;
  --color-paper-bg-alt: #F4F4F6;

  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;

  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-base: 1.65;
  --line-height-tight: 1.1;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* === 容器与排版工具类 === */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.text-block { max-width: 38em; }
.grid-2 { display: grid; gap: var(--gap); }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* === 主题表面层 === */
.surface-dark { background: var(--color-dark); color: var(--color-paper); }
.surface-dark h1, .surface-dark h2, .surface-dark h3, .surface-dark p { color: var(--color-paper); }
.surface-dark .badge, .surface-dark a.link-accent { color: var(--color-accent); }
.surface-dark .icon { color: var(--color-accent); }

.surface-paper { background: var(--color-paper); color: var(--color-text); }
.surface-paper h1, .surface-paper h2, .surface-paper h3, .surface-paper p { color: var(--color-text); }
.surface-paper .badge, .surface-paper a.link-accent { color: var(--color-brand); }
.surface-paper .icon { color: var(--color-brand); }

/* 浅色卡片在深色面上恢复纸面取色 */
.card-light {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border) solid transparent;
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}
.card-light h3, .card-light p { color: var(--color-text); }
.card-light .badge, .card-light a { color: var(--color-brand); }
.card-light .icon { color: var(--color-brand); }

/* === 眉标与标题 === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75em;
}
.badge::before { content: ""; display: inline-block; width: 16px; height: 2px; background: currentColor; }

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  margin-bottom: 0.5em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.6em;
}
h3 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.5em;
}
.hl { color: var(--color-brand); }
.surface-dark .hl { color: var(--color-accent); }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); background: #C55DE0; }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { transform: translateY(-2px); opacity: 0.85; }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; }

/* === 组件：卡片与网格 === */
.card {
  background: var(--color-paper-bg-alt);
  padding: var(--gap);
  border: var(--card-border) solid transparent;
  box-shadow: var(--card-shadow);
}
.surface-dark .card { background: var(--color-dark-bg-alt); }
.card-grid { display: grid; gap: var(--gap); }
@media (min-width: 768px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* === 组件：表格 === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 0; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 700; }
td { word-break: break-all; }

/* === 组件：FAQ === */
details {
  border-bottom: 1px solid rgba(128,128,128,0.2);
  padding: 16px 0;
}
summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6em;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
details[open] summary::before { transform: rotate(45deg); }
details p { margin-top: 0.5em; line-height: var(--line-height-base); }

/* === 列表标记 === */
.list-icon { display: flex; gap: 0.75em; align-items: flex-start; margin-bottom: 1em; }
.list-icon .icon { flex-shrink: 0; margin-top: 0.2em; }
.list-icon svg { width: 20px; height: 20px; }

/* === 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252,252,253,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 16px 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; }
nav ul { display: flex; gap: 24px; }
nav a { font-weight: 600; font-size: 0.95rem; padding: 4px 0; border-bottom: 2px solid transparent; transition: border-color 0.2s; }
nav a:hover, nav a[aria-current="page"] { border-bottom-color: var(--color-brand); }
.surface-dark nav { background: var(--color-dark); padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.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); }

.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(128,128,128,0.2);
  margin-top: 0;
}
.footer-inner { display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 768px) { .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; } }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { font-size: 0.9rem; opacity: 0.8; }
.footer-links a:hover { opacity: 1; }

/* === SVG 动效体系 === */
.svg-panel { width: 100%; height: auto; max-width: 640px; }
.star { fill: currentColor; opacity: 0.3; }
.star.twinkle { animation: star-flicker 5s ease-in-out infinite; }
.line { stroke: currentColor; stroke-width: 2; fill: none; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.line.flow { animation: line-draw 4s linear infinite; }
.bubble { fill: currentColor; opacity: 0.8; }
.bubble.float { animation: bubble-rise 6s ease-in-out infinite; }
.input-dot { fill: currentColor; }
.input-dot.breathe { animation: dot-breathe 2.4s ease-in-out infinite; }
@keyframes star-flicker { 0%, 100% { opacity: 0.2; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes line-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes bubble-rise { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes dot-breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* 旋转缩放中心修正 */
.rot-center { transform-box: fill-box; transform-origin: center; }

/* === 无障碍与减少动态 === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
/* 焦点可见性 */
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.surface-dark :focus-visible { outline-color: var(--color-paper); }

/* 兜底：裁掉横向溢出 */
li {
  overflow-x: clip;
}
