/* 设计变量与基础重置 */
:root {
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --color-text-light: #DBD4ED;
  --color-accent-on-dark: #9977EE;
  --color-surface-dark-inner: #251C3D;
  --color-surface-paper-inner: #EAE6F5;
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --line-height-base: 1.75;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-brand); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--color-accent); }
button, .btn { cursor: pointer; font-family: inherit; }

.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 表面层配色控制 */
.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-text-light);
}
.surface-dark a { color: var(--color-accent-on-dark); }
.surface-dark .hl { color: var(--color-accent-on-dark); }
.surface-dark .btn-primary { background: var(--color-accent); color: var(--color-dark); }
.surface-dark .btn-secondary { border-color: var(--color-text-light); color: var(--color-text-light); }
.surface-dark .btn-secondary:hover { background: rgba(153, 119, 238, 0.15); }

.surface-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.surface-paper .hl { color: var(--color-brand); }
.surface-paper .btn-primary { background: var(--color-brand); color: #FFFFFF; }
.surface-paper .btn-secondary { border-color: var(--color-text); color: var(--color-text); }

/* 排版 */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: 0; line-height: 1.25; margin-top: 0; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.6em; }
h3 { font-size: 1.25rem; margin-bottom: 0.5em; }
p { margin: 0 0 1em; max-width: 38em; }
strong { font-weight: 600; }

.text-center { text-align: center; }
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75em;
}
.surface-paper .section-label { color: var(--color-brand); }
.surface-dark .section-label { color: var(--color-accent-on-dark); }
.section-label::before { content: ""; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }

/* 头部与导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(219, 212, 237, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.surface-dark .site-header { background: rgba(27, 18, 49, 0.9); }
.site-header.scrolled { border-bottom-color: rgba(0,0,0,0.08); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: inherit; text-decoration: none; }
.logo img { width: 28px; height: 28px; object-fit: contain; }
.nav-list { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; }
.nav-link { color: inherit; font-weight: 500; padding: 8px 0; border-bottom: 2px solid transparent; transition: border-color 0.2s; }
.nav-link:hover, .nav-link[aria-current="page"] { border-bottom-color: currentColor; }
@media (max-width: 640px) {
  .nav-list { display: none; }
}

/* 按钮 */
.btn-group { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 1.5em; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 4px; }
.btn-primary { min-width: 140px; }
.btn svg { width: 20px; height: 20px; stroke-width: 2; }

/* 卡片与面板 */
.card {
  background: var(--color-surface-paper-inner);
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
}
.surface-dark .card { background: var(--color-surface-dark-inner); }
.visual-panel {
  aspect-ratio: 4 / 3;
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.surface-paper .visual-panel { background: var(--color-dark); }
.surface-dark .visual-panel { background: #0F0A1E; }

/* 网格布局 */
.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; align-items: center; gap: var(--gap); }
.flex-row > * { flex: 1 1 0; min-width: 0; }
@media (max-width: 768px) {
  .flex-row > * { flex: 1 1 100%; }
}

/* 选项卡 (纯 CSS 实现，无 JS 降级为堆叠) */
.tab-nav { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.tab-radio { display: none; }
.tab-label {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  background: rgba(0,0,0,0.05);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.tab-content { display: none; }
.tab-radio:checked + .tab-label { background: var(--color-brand); color: #fff; }
.tab-radio:nth-of-type(1):checked ~ .tab-content:nth-of-type(1),
.tab-radio:nth-of-type(2):checked ~ .tab-content:nth-of-type(2),
.tab-radio:nth-of-type(3):checked ~ .tab-content:nth-of-type(3),
.tab-radio:nth-of-type(4):checked ~ .tab-content:nth-of-type(4) {
  display: block;
  animation: fadeIn 0.3s ease;
}
.tab-panel-inner { background: var(--color-surface-paper-inner); border-radius: var(--radius-card); padding: 24px; }
.surface-dark .tab-panel-inner { background: var(--color-surface-dark-inner); }
@media (hover: none) and (pointer: coarse) {
  .tab-content { display: block !important; }
  .tab-nav { display: none; }
}

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); }
.surface-dark .data-table th, .surface-dark .data-table td { border-bottom-color: rgba(255,255,255,0.1); }
.data-table th { font-weight: 600; width: 40%; }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ */
details { margin-bottom: 16px; border-radius: var(--radius-card); background: var(--color-surface-paper-inner); overflow: hidden; }
.surface-dark details { background: var(--color-surface-dark-inner); }
summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2em; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
.details-content { padding: 0 20px 20px; line-height: 1.7; }

/* 步骤徽标 */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  border-radius: 8px;
  margin-right: 12px;
  flex-shrink: 0;
}
.step-item { display: flex; align-items: flex-start; margin-bottom: 24px; }

/* SVG 基础与动效 */
svg.interface-svg { width: 100%; height: auto; max-width: 100%; }
svg.interface-svg [class*="anim-"] { transform-box: fill-box; transform-origin: center; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 3s ease-in-out infinite alternate; }
.anim-breathe { animation: breathe 3s ease-in-out infinite alternate; }
.anim-float { animation: float 4s ease-in-out infinite alternate; }
.anim-slide { animation: slideIn 2.5s cubic-bezier(0.2, 0.8, 0.2, 1) infinite alternate; }
.anim-delay-1 { animation-delay: 0.5s; }
.anim-delay-2 { animation-delay: 1.2s; }
.anim-delay-3 { animation-delay: 1.8s; }

@keyframes drawLine { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes breathe { 0% { opacity: 0.6; transform: scale(0.95); } 100% { opacity: 1; transform: scale(1.02); } }
@keyframes float { 0% { transform: translateY(0); } 100% { transform: translateY(-6px); } }
@keyframes slideIn { 0% { transform: translateX(10px); opacity: 0.7; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .anim-draw, .anim-breathe, .anim-float, .anim-slide { animation: none !important; }
}

/* 区块间距 */
section { padding-block: var(--section-y); }
section + section { border-top: 1px solid rgba(0,0,0,0.06); }
.surface-dark + .surface-paper, .surface-paper + .surface-dark { border-top: none; }
.surface-dark section { border-top-color: rgba(255,255,255,0.08); }

/* 页脚 */
.site-footer { background: var(--color-dark); color: var(--color-text-light); padding: 48px 0; }
.footer-inner { display: flex; flex-direction: column; gap: 24px; align-items: center; text-align: center; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--color-text-light); opacity: 0.8; }
.footer-links a:hover { opacity: 1; }
.copyright { font-size: 0.85rem; opacity: 0.6; margin-top: 16px; }

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
