/* === 设计变量与基础重置 === */
:root {
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  --color-line: #E2E2E6;
  --color-surface-light: #F4F4F6;

  --radius-card: 0;
  --radius-btn: 0;
  --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-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --transition-base: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color var(--transition-base); }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }

/* === 布局容器 === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section--dark { background-color: var(--color-dark); color: var(--color-paper); }
.section--light { background-color: var(--color-surface-light); }
.section--paper { background-color: var(--color-paper); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); }

/* === 排版系统 === */
.kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.paper-theme .kicker { color: var(--color-brand); }
.dark-theme .kicker { color: var(--color-accent); }

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
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: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
strong { font-weight: 600; }
.hl { font-weight: 700; }
.paper-theme .hl { color: var(--color-brand); }
.dark-theme .hl { color: var(--color-accent); }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform var(--transition-base), opacity var(--transition-base);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }
.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn--primary:hover { background-color: #c25ad8; transform: translateY(-2px); }
.btn--secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.dark-theme .btn--secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn--secondary:hover { background-color: rgba(0,0,0,0.05); transform: translateY(-2px); }
.dark-theme .btn--secondary:hover { background-color: rgba(255,255,255,0.08); }

/* === 组件：卡片与面板 === */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
  position: relative;
}
.dark-theme .card { background-color: #2A2042; border-color: #4A3B6B; box-shadow: 4px 4px 0 #19102D; }
.panel {
  background-color: var(--color-dark);
  border: 2px solid var(--color-line);
  padding: 24px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.dark-theme .panel { border-color: #3A2D55; }

/* === 组件：表格 === */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-line);
  text-align: left;
}
th { font-weight: 600; background-color: rgba(0,0,0,0.03); }
td strong { font-weight: 600; }

/* === 组件：FAQ (Details) === */
.faq-item {
  border-bottom: 1px solid var(--color-line);
  padding: 16px 0;
}
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s;
}
.faq-item[open] summary::before { transform: rotate(45deg); }
.faq-item p { margin-top: 0.75rem; color: var(--color-text); opacity: 0.9; }

/* === 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 24px; align-items: center; }
.nav a { font-size: 0.95rem; font-weight: 500; position: relative; }
.nav a:hover { color: var(--color-brand); }
.nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background: var(--color-brand);
}
.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 48px 0;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}
.footer-col h4 { font-weight: 600; margin-bottom: 12px; color: var(--color-accent); }
.footer-col a { display: block; padding: 4px 0; opacity: 0.8; }
.footer-col a:hover { opacity: 1; text-decoration: underline; }
.footer-bottom { border-top: 1px solid #3A2D55; padding-top: 24px; text-align: center; opacity: 0.7; }

/* === SVG 动效系统 === */
.svg-anim { width: 100%; height: auto; }
.draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.float-y {
  animation: floatY 6s ease-in-out infinite alternate;
}
@keyframes floatY {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
.pulse-opacity {
  animation: pulseOp 5s ease-in-out infinite;
}
@keyframes pulseOp {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.flow-dot {
  animation: flowDot 8s linear infinite;
}
@keyframes flowDot {
  0% { offset-distance: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}
.bubble-pop {
  animation: bubblePop 7s ease-in-out infinite alternate;
}
@keyframes bubblePop {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}
.slide-in {
  animation: slideIn 5s ease-out infinite alternate;
}
@keyframes slideIn {
  0% { transform: translateX(-12px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

/* 变换中心点约束 */
.rotated, .scaled {
  transform-box: fill-box;
  transform-origin: center;
}

/* === 响应式与无障碍 === */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 12px 0; gap: 12px; }
  .nav { gap: 16px; flex-wrap: wrap; justify-content: center; }
  .hero-layout { flex-direction: column-reverse; }
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-name: none;
  }
  .draw, .float-y, .pulse-opacity, .flow-dot, .bubble-pop, .slide-in {
    animation: none;
  }
}
