:root {
  --bg-dark: #1B1231;
  --bg-paper: #F4F3F7;
  --text-main: #191523;
  --brand: #5214EB;
  --accent: #9977EE;
  --border: rgba(25, 21, 35, 0.12);
  --radius-card: 24px;
  --radius-btn: 999px;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
}

.surface-dark {
  --bg: var(--bg-dark);
  --text: var(--bg-paper);
  --accent: var(--accent);
  --brand: var(--accent);
  background: var(--bg);
  color: var(--text);
}

.surface-paper {
  --bg: var(--bg-paper);
  --text: var(--text-main);
  --accent: var(--brand);
  --brand: var(--brand);
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  line-height: 1.65;
  font-size: 16px;
  background: var(--bg-paper);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding-block: var(--section-y);
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 var(--gap);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
p { max-width: 38em; margin: 0 0 var(--gap); }

.hl { color: var(--brand); }
.surface-dark .hl { color: var(--accent); }

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5em;
  text-transform: uppercase;
}
.surface-dark .eyebrow { color: var(--accent); }
.surface-paper .eyebrow { color: var(--brand); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
  border: 2px solid var(--accent);
}
.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--text-main);
}
.surface-dark .btn-secondary {
  color: var(--bg-paper);
  border-color: var(--bg-paper);
}

/* Cards */
.card {
  background: var(--bg-paper);
  border: var(--card-border) var(--text-main);
  box-shadow: 4px 4px 0 var(--text-main);
  border-radius: var(--radius-card);
  padding: 24px;
}
.surface-dark .card {
  background: var(--bg-paper);
  color: var(--text-main);
  border-color: var(--text-main);
  box-shadow: 4px 4px 0 var(--text-main);
}

/* Grid & Flex */
.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; gap: var(--gap); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* Table */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
th { font-weight: 700; white-space: nowrap; }
td { white-space: normal; word-break: break-word; }

/* FAQ */
details {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-paper);
}
.surface-dark details { background: rgba(244, 243, 247, 0.08); border-color: rgba(244, 243, 247, 0.2); }
summary {
  padding: 16px;
  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.2em; font-weight: 400; }
details[open] summary::after { content: "-"; }
details > div { padding: 0 16px 16px; line-height: 1.7; }

/* Header & Footer */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-paper);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; font-weight: 800; font-size: 1.2rem; }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; }
nav a { text-decoration: none; color: inherit; font-weight: 500; padding: 8px 0; border-bottom: 2px solid transparent; transition: border-color 0.2s; }
nav a:hover, nav a[aria-current="page"] { border-bottom-color: var(--brand); }
.surface-dark nav a { color: var(--bg-paper); }
.surface-dark nav a:hover, .surface-dark nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 48px; padding-top: 32px; }
.footer-grid a { color: inherit; text-decoration: none; display: block; margin-bottom: 8px; }
.footer-grid a:hover { text-decoration: underline; }
.footer-bottom { margin-top: 48px; padding-top: 24px; border-top: 1px solid rgba(244, 243, 247, 0.15); font-size: 0.9rem; opacity: 0.8; }

/* SVG & Animations */
.svg-container { width: 100%; height: auto; max-width: 100%; }
svg { display: block; }
.node-pulse { animation: nodePulse 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.bubble-float { animation: bubbleFloat 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.dot-breathe { animation: dotBreathe 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.line-flow { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawFlow 6s linear infinite; }

@keyframes nodePulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes dotBreathe {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes drawFlow {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .node-pulse, .bubble-float, .dot-breathe, .line-flow {
    animation: none !important;
  }
}

@media (max-width: 768px) {
  h1 { font-size: 2.2rem; }
  .flex-row { flex-direction: column; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  nav ul { gap: 16px; font-size: 0.9rem; }
}
