:root {
  /* 色板 */
  --color-bg-dark: #240F29;
  --color-bg-paper: #F6F3F7;
  --color-text: #201523;
  --color-brand: #A711CF;
  --color-accent: #ED6E73;
  --color-paper-light: #EDEAF0;

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --line-height: 1.65;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-bg-paper);
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-block: var(--section-y); }

/* 主题覆盖：深色面 */
.theme-dark {
  --text-color: var(--color-bg-paper);
  --accent-color: var(--color-accent);
  --brand-color: var(--color-accent);
  --button-text: var(--color-bg-dark);
}
.theme-dark { color: var(--text-color); }
.theme-dark .subtitle { color: var(--accent-color); }
.theme-dark .hl { color: var(--accent-color); }
.theme-dark .btn-primary { background: var(--accent-color); color: var(--button-text); }
.theme-dark .btn-secondary { border-color: var(--color-bg-paper); color: var(--color-bg-paper); }
.theme-dark .card {
  --card-border: 2px solid var(--color-bg-paper);
  --card-shadow: 4px 4px 0 var(--color-bg-paper);
  background: var(--color-bg-paper);
  color: var(--color-text);
}
.theme-dark .card h3, .theme-dark .card p { color: var(--color-text); }
.theme-dark table th { background: rgba(255,255,255,0.1); border-color: var(--color-bg-paper); color: var(--color-bg-paper); }
.theme-dark table td { border-color: var(--color-bg-paper); }
.theme-dark details {
  --card-border: 2px solid var(--color-bg-paper);
  --card-shadow: 4px 4px 0 var(--color-bg-paper);
  background: var(--color-bg-paper);
  color: var(--color-text);
}
.theme-dark details summary { color: var(--color-text); }
.theme-dark details p { color: var(--color-text); }

/* 浅色背景上的文字对比度修复 */
body p { color: #1a0f1e; }

/* 首页深色区正文与副文本对比度修复 */
.theme-dark .container.split-row p {
  color: #f6f3f7;
}

/* 排版 */
h1, h2, h3 { font-weight: 700; letter-spacing: 0.02em; line-height: 1.2; margin-top: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-bottom: 0.5em; }
p { margin-bottom: 1em; max-width: 38em; }
.subtitle {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 0.5em; color: var(--color-brand);
}
.hl { color: var(--color-brand); }

/* 按钮 */
.btn-group { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1.5em 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0 1.5rem; height: 52px; font-size: 1rem; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: transform 0.2s ease, background-color 0.2s ease;
  border-radius: var(--radius-btn); border: 2px solid transparent;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--color-accent); color: var(--color-bg-dark); }
.btn-secondary { background: transparent; border-color: var(--color-text); color: var(--color-text); }

/* 卡片 */
.card {
  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); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.split-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; }
@media (max-width: 768px) {
  .split-row { grid-template-columns: 1fr; }
}

/* 表格 */
table { width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1em 0; }
th, td { border: 1px solid var(--color-text); padding: 0.75em; text-align: left; }
th { background: var(--color-paper-light); font-weight: 700; }

/* FAQ Details */
details { border: var(--card-border); box-shadow: var(--card-shadow); padding: var(--gap); margin-bottom: 0.5em; border-radius: var(--radius-card); }
summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.5em; line-height: 1; }
details[open] summary::after { content: "-"; }
details p { margin-top: 0.5em; }

/* 页头页脚 */
header { position: sticky; top: 0; background: var(--color-bg-paper); z-index: 100; border-bottom: 1px solid var(--color-text); padding: 1rem 0; }
.theme-dark header { background: var(--color-bg-dark); border-color: rgba(255,255,255,0.2); }
nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
nav a { text-decoration: none; color: var(--color-text); font-weight: 500; }
.theme-dark nav a { color: var(--color-bg-paper); }
nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.theme-dark nav a[aria-current="page"] { color: var(--accent-color); }
footer { background: var(--color-bg-dark); color: var(--color-bg-paper); padding: var(--section-y) 0; margin-top: var(--section-y); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.footer-grid a { color: var(--color-bg-paper); text-decoration: none; display: block; margin-bottom: 0.5em; }

/* SVG 视觉容器 */
.svg-visual { width: 100%; height: auto; }

/* SVG 动效 Keyframes */
@keyframes drawLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes floatUp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes rotateMerge { 0% { transform: rotate(0deg) translateX(0); } 50% { transform: rotate(180deg) translateX(10px); } 100% { transform: rotate(360deg) translateX(0); } }

.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 4s ease-in-out infinite alternate; }
.anim-float { animation: floatUp 5s ease-in-out infinite; }
.anim-slide { animation: slideIn 6s ease-in-out infinite alternate; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-rotate { transform-box: fill-box; transform-origin: center; animation: rotateMerge 12s linear infinite; }

@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; }
}

/* 兜底：裁掉横向溢出 */
section.container {
  overflow-x: clip;
}
