:root {
  --color-dark: #19102D;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  --color-white: #FFFFFF;
  --color-border-light: rgba(25, 21, 35, 0.12);

  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: calc(var(--gap) * 0.5);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-top: var(--section-y); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-top: calc(var(--gap) * 1.5); }
p { margin-bottom: calc(var(--gap) * 0.75); }
.small-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: calc(var(--gap) * 0.25);
  display: block;
}
.paper-theme .small-label, .paper-theme a { color: var(--color-brand); }
.dark-theme .small-label, .dark-theme a { color: var(--color-accent); }
.hl { font-weight: 800; }
.paper-theme .hl { color: var(--color-brand); }
.dark-theme .hl { color: var(--color-accent); }

/* Layout & Sections */
.section-divider {
  border-top: 1px solid var(--color-border-light);
  margin: var(--section-y) 0;
}
.grid-2 { 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; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.dark-theme .btn-secondary {
  border-color: var(--color-white);
  color: var(--color-white);
}
.btn-icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Cards & Panels */
.card {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  background: var(--color-paper);
  padding: var(--gap);
  position: relative;
}
.panel {
  background: var(--color-dark);
  border: 2px solid var(--color-brand);
  padding: calc(var(--gap) * 1.5);
  border-radius: var(--radius-card);
}
.card-on-dark {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  color: var(--color-text);
}
.card-on-dark .small-label, .card-on-dark a { color: var(--color-brand); }
.card-on-dark .hl { color: var(--color-brand); }

/* Header & Footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border-light);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-img { height: 32px; width: auto; }
.nav-links { display: flex; gap: calc(var(--gap) * 1.5); }
.nav-links a { font-weight: 600; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--color-brand); text-decoration: underline; text-underline-offset: 4px; }
.site-footer {
  background: var(--color-dark);
  color: var(--color-white);
  padding: var(--section-y) 0;
  margin-top: var(--section-y);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.footer-grid a { color: var(--color-white); opacity: 0.8; }
.footer-grid a:hover { opacity: 1; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; margin: var(--gap) 0; }
.data-table th, .data-table td {
  text-align: left;
  padding: calc(var(--gap) * 0.5);
  border-bottom: 1px solid var(--color-border-light);
}
.data-table th { font-weight: 700; }

/* FAQ */
details {
  border: var(--card-border);
  margin-bottom: var(--gap);
  background: var(--color-paper);
}
summary {
  padding: calc(var(--gap) * 0.75);
  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.2rem; font-weight: 400; }
details[open] summary::after { content: "-"; }
details[open] .faq-answer { padding: 0 calc(var(--gap) * 0.75) calc(var(--gap) * 0.75); }
.faq-answer { line-height: 1.6; }

/* SVG Container */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: hidden;
}

/* SVG Animations */
@keyframes node-light {
  0%, 100% { stroke-dashoffset: 1; opacity: 0.2; }
  50% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes flow-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.grid-node { animation: node-light 4s ease-in-out infinite; }
.grid-node:nth-child(odd) { animation-delay: 0.2s; }
.grid-node:nth-child(even) { animation-delay: 0.7s; }
.flow-path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: flow-line 3s linear infinite; }
.float-element { animation: float 5s ease-in-out infinite; }
.breathe-dot { animation: breathe 2.5s ease-in-out 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;
  }
  .grid-node, .flow-path, .float-element, .breathe-dot {
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
    transform: none !important;
  }
}
