:root {
  --c-deep: #2D1438;
  --c-paper: #F6F3F7;
  --c-text: #1F1523;
  --c-brand: #9E13DD;
  --c-accent: #6EEDA8;
  --r-card: 20px;
  --r-btn: 12px;
  --shadow-card: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --sec-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --max-w: 1280px;
  --fs-h1: clamp(2.6rem, 6.4vw, 5rem);
  --fs-h2: clamp(1.6rem, 3vw, 2.4rem);
  --fs-h3: clamp(1.2rem, 2vw, 1.5rem);
  --fs-body: 16px;
  --lh-body: 1.55;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  background: var(--c-paper);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* Theme Scoping */
.bg-dark { background: var(--c-deep); color: var(--c-paper); }
.bg-dark .hl { color: var(--c-accent); }
.bg-dark .subtle { color: rgba(246, 243, 247, 0.7); }
.bg-dark a:not(.btn) { color: var(--c-accent); }
.bg-paper { background: var(--c-paper); color: var(--c-text); }
.bg-paper .hl { color: var(--c-brand); }
.bg-paper .subtle { color: rgba(31, 21, 35, 0.65); }
.bg-paper a:not(.btn) { color: var(--c-brand); }

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gap); }
section { padding: var(--sec-y) 0; }
.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); }

/* Typography */
h1 { font-size: var(--fs-h1); font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); font-weight: 500; line-height: 1.25; margin-bottom: var(--gap); }
h3 { font-size: var(--fs-h3); font-weight: 500; line-height: 1.2; margin-bottom: calc(var(--gap) * 0.5); }
.badge {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  margin-bottom: calc(var(--gap) * 0.5); text-transform: uppercase;
}
.text-subtle { font-size: 0.9rem; line-height: 1.6; }

/* Components */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 24px; height: 52px; border-radius: var(--r-btn); font-weight: 600;
  cursor: pointer; border: none; transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: var(--c-accent); color: var(--c-deep);
  box-shadow: 0 4px 12px rgba(110, 237, 168, 0.2);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(110, 237, 168, 0.3); }
.btn-secondary {
  background: transparent; border: 1px solid currentColor; color: inherit;
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); }
.btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }

.card {
  background: var(--c-paper); border-radius: var(--r-card);
  box-shadow: var(--shadow-card); padding: calc(var(--gap) * 1.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.bg-dark .card { background: rgba(246, 243, 247, 0.08); border: 1px solid rgba(246, 243, 247, 0.1); }
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.35); }

.table-wrap { overflow-x: auto; border-radius: var(--r-card); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 320px; table-layout: fixed; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); word-wrap: break-word; overflow-wrap: break-word; }
th { font-weight: 600; }
.bg-paper th { border-color: rgba(31, 21, 35, 0.1); }
.bg-dark th { border-color: rgba(246, 243, 247, 0.1); }

/* FAQ */
details {
  margin-bottom: var(--gap); border-radius: var(--r-card);
  border: 1px solid rgba(128,128,128,0.2); overflow: hidden;
}
summary {
  padding: 16px 20px; cursor: pointer; font-weight: 600;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 20px 16px; line-height: 1.7; }

/* Header / Nav */
.header {
  position: sticky; top: 0; z-index: 100; background: var(--c-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08); backdrop-filter: blur(8px);
}
.bg-dark .header { background: rgba(45, 20, 56, 0.95); border-bottom-color: rgba(246, 243, 247, 0.08); }
.nav-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; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--c-brand); }
.bg-dark .nav-links a[aria-current="page"] { color: var(--c-accent); }
@media (max-width: 768px) { .nav-links { display: none; } }

/* Footer */
.footer { padding: 48px 0; text-align: center; border-top: 1px solid rgba(128,128,128,0.2); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }

/* SVG Utilities */
.svg-responsive { width: 100%; height: auto; }
.transform-center { transform-box: fill-box; transform-origin: center; }

/* SVG Animations */
@keyframes flowDash { to { stroke-dashoffset: -1; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulseDot { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes breathe { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.flow-path { stroke-dasharray: 1; stroke-dashoffset: 0; animation: flowDash 2s linear infinite; }
.float-layer { animation: floatY 4s ease-in-out infinite; }
.pulse-dot { animation: pulseDot 2.5s ease-in-out infinite; }
.slide-in { animation: slideInRight 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.breathe { animation: breathe 3s ease-in-out infinite; }

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
