:root {
  --c-dark: #10112D;
  --c-paper: #F5F0E5;
  --c-body: #151523;
  --c-brand: #1416EB;
  --c-accent: #89ED6E;
  --c-muted: rgba(21,21,35,0.55);
  --c-border-light: rgba(21,21,35,0.16);
  --c-border-dark: rgba(245,240,229,0.12);

  --r-card: 24px;
  --r-btn: 999px;
  --card-border: 1px solid var(--c-border-light);
  --card-shadow: none;
  --sec-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --max-w: 1120px;
  --header-h: 64px;

  --font-main: "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --lh-tight: 1.15;
  --lh-normal: 1.65;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--c-paper);
  color: var(--c-body);
  line-height: var(--lh-normal);
  -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; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gap); }
.section { padding-top: var(--sec-y); padding-bottom: var(--sec-y); }

/* Theme Overrides */
.theme-dark { background: var(--c-dark); color: var(--c-paper); }
.theme-dark .hl { color: var(--c-accent); }
.theme-dark .text-subtle { color: rgba(245,240,229,0.7); }
.theme-dark .card { background: var(--c-paper); color: var(--c-body); border: var(--card-border); }
.theme-dark .card .hl { color: var(--c-brand); }
.theme-dark .badge { background: var(--c-accent); color: var(--c-dark); }
.theme-dark .btn-outline { color: var(--c-paper); border-color: var(--c-paper); }
.theme-dark .btn-outline:hover { background: rgba(245,240,229,0.1); }

.bg-paper { background: var(--c-paper); color: var(--c-body); }
.bg-paper .hl { color: var(--c-brand); }
.bg-paper .card { background: transparent; border: var(--card-border); }
.bg-paper .badge { background: var(--c-brand); color: var(--c-paper); }

/* Typography */
h1, h2, h3, h4 { font-weight: 500; line-height: var(--lh-tight); letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.25rem; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.text-subtle { color: var(--c-muted); font-size: 0.95rem; }
.badge {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 0.35em 0.8em; border-radius: var(--r-card); margin-bottom: 1rem;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: rgba(245,240,229,0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border-light);
  transition: box-shadow 0.3s ease;
}
.site-header.scrolled { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.logo-wrap { display: flex; align-items: center; gap: 0.75rem; }
.logo-wrap img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { font-size: 0.95rem; font-weight: 500; position: relative; }
.nav-links a[aria-current="page"], .nav-links a:hover { color: var(--c-brand); }
.theme-dark .site-header { background: rgba(16,17,45,0.9); border-bottom-color: var(--c-border-dark); }
.theme-dark .nav-links a { color: var(--c-paper); }
.theme-dark .nav-links a[aria-current="page"], .theme-dark .nav-links a:hover { color: var(--c-accent); }

/* Buttons */
.btn-group { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0 1.5rem; height: 48px; border-radius: var(--r-btn); font-weight: 600;
  cursor: pointer; transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  border: none; font-size: 1rem; line-height: 1;
}
.btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--c-accent); color: var(--c-dark); }
.btn-primary:hover { background: #7de062; }
.btn-secondary { background: transparent; color: var(--c-body); border: 1.5px solid var(--c-body); }
.btn-secondary:hover { background: rgba(21,21,35,0.05); }
.theme-dark .btn-secondary { color: var(--c-paper); border-color: var(--c-paper); }
.theme-dark .btn-secondary:hover { background: rgba(245,240,229,0.1); }

/* Cards & Grid */
.card-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.card {
  background: var(--c-paper); border: var(--card-border); border-radius: var(--r-card);
  padding: 1.5rem; box-shadow: var(--card-shadow); transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.card-icon { width: 28px; height: 28px; margin-bottom: 1rem; stroke: currentColor; stroke-width: 1.8; fill: none; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.data-table th, .data-table td { text-align: left; padding: 0.75rem 0; border-bottom: 1px solid var(--c-border-light); }
.data-table th { font-weight: 600; width: 40%; }
.theme-dark .data-table th, .theme-dark .data-table td { border-bottom-color: var(--c-border-dark); }

/* FAQ */
.faq-list { display: grid; gap: 1rem; }
.faq-item { border: var(--card-border); border-radius: var(--r-card); overflow: hidden; }
.faq-item summary {
  padding: 1.25rem 1.5rem; cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.25rem; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 1.5rem 1.25rem; margin: 0; }

/* Footer */
.site-footer { padding: 3rem 0; border-top: 1px solid var(--c-border-light); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h4 { margin-bottom: 1rem; font-size: 1rem; }
.footer-col ul li { margin-bottom: 0.6rem; }
.footer-col a { color: var(--c-muted); transition: color 0.2s; }
.footer-col a:hover { color: var(--c-brand); }
.theme-dark .site-footer { border-top-color: var(--c-border-dark); }
.theme-dark .footer-col a { color: rgba(245,240,229,0.6); }
.theme-dark .footer-col a:hover { color: var(--c-accent); }
.copyright { text-align: center; margin-top: 2rem; font-size: 0.85rem; color: var(--c-muted); }

/* SVG Animations */
.svg-panel { width: 100%; height: auto; max-width: 480px; }
.anim-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-draw { animation: drawPath 5s ease-in-out infinite alternate; }
.anim-float { animation: floatUp 6s ease-in-out infinite alternate; }
.anim-pulse { animation: pulseDot 4s ease-in-out infinite alternate; }
.anim-slide { animation: slideIn 7s ease-in-out infinite alternate; }

@keyframes drawPath {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes floatUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
@keyframes pulseDot {
  0% { opacity: 0.4; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes slideIn {
  0% { transform: translateX(10px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

svg g.transformable { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-float, .anim-pulse, .anim-slide { animation: none !important; }
  .btn:hover, .card:hover { transform: none; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-grid { grid-template-columns: 1fr !important; }
  .split-grid { grid-template-columns: 1fr !important; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
}
