:root {
  --dark-bg: #121531;
  --paper: #E8E9EA;
  --text-body: #151723;
  --brand: #142CEB;
  --accent: #ED7D6E;
  --text-on-dark: var(--paper);
  --text-on-paper: var(--text-body);
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  --line-h: 1.65;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: var(--line-h);
  color: var(--text-on-paper);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* Surface Overrides */
.surface-dark {
  background: var(--dark-bg);
  color: var(--text-on-dark);
}
.surface-dark .hl { color: var(--accent); }
.surface-dark a { color: var(--accent); }
.surface-dark .eyebrow { color: var(--accent); }

.surface-paper {
  background: var(--paper);
  color: var(--text-on-paper);
}
.surface-paper .hl { color: var(--brand); }
.surface-paper a { color: var(--brand); }
.surface-paper .eyebrow { color: var(--brand); }

/* Typography */
h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); text-wrap: balance; margin-bottom: var(--gap); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); text-wrap: balance; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: calc(var(--gap) * 0.5); }
p { margin-bottom: var(--gap); max-width: 38em; }
strong { font-weight: 700; }

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: calc(var(--gap) * 0.25);
  text-transform: uppercase;
}

.hl { font-weight: 800; }

/* Layout Sections */
section {
  padding-block: var(--section-y);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding-inline: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  border: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--dark-bg);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
}
.surface-paper .btn-secondary { color: var(--text-body); border-color: var(--text-body); }
.surface-dark .btn-secondary { color: var(--text-on-dark); border-color: var(--text-on-dark); }

.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Cards & Panels */
.card {
  background: rgba(255, 255, 255, 0.05);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
}
.surface-paper .card { background: rgba(0, 0, 0, 0.03); }
.surface-dark .card { background: rgba(255, 255, 255, 0.06); }

.grid-2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  text-align: left;
}
th, td { padding: 0.75rem 0.5rem; border-bottom: 1px solid rgba(128,128,128,0.2); vertical-align: top; }
th { font-weight: 700; white-space: nowrap; }
td a { text-decoration: underline; text-underline-offset: 3px; }

/* FAQ */
details {
  background: rgba(0,0,0,0.03);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  padding: var(--gap);
  transition: background 0.2s;
}
.surface-dark details { background: rgba(255,255,255,0.05); }
details[open] { background: rgba(0,0,0,0.05); }
.surface-dark details[open] { background: rgba(255,255,255,0.08); }
summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  background: currentColor;
  color: var(--paper);
  font-size: 0.8em;
  flex-shrink: 0;
}
details[open] summary::before { content: "−"; }
details p { margin-top: var(--gap); max-width: 100%; }

/* Header & Footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232, 233, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding-block: 0.75rem;
}
.surface-dark .site-header { background: rgba(18, 21, 49, 0.85); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: inherit; font-weight: 800; font-size: 1.1rem; }
.logo img { height: 28px; width: auto; }
nav { display: flex; gap: 1.5rem; align-items: center; }
nav a { text-decoration: none; font-weight: 500; opacity: 0.8; transition: opacity 0.2s; }
nav a:hover, nav a[aria-current="page"] { opacity: 1; }
.nav-actions { display: flex; gap: 0.75rem; align-items: center; }

.site-footer {
  padding-block: var(--section-y);
  border-top: 1px solid rgba(128,128,128,0.2);
  margin-top: var(--section-y);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--gap); }
.footer-grid a { text-decoration: none; opacity: 0.8; display: block; margin-bottom: 0.5rem; }
.footer-grid a:hover { opacity: 1; }
.copyright { margin-top: var(--gap); opacity: 0.7; font-size: 0.9rem; }

/* SVG Containers & Animations */
.svg-panel {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
  overflow: hidden;
}
.svg-panel svg { width: 100%; height: auto; }

/* Draw & Breathe */
.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-breathe 6s ease-in-out infinite;
}
@keyframes draw-breathe {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}

.float-slow {
  animation: float-slow 7s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.slide-in {
  animation: slide-in 8s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes slide-in {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

.pulse-dot {
  animation: pulse-dot 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Reduced Motion */
@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;
  }
}

/* Responsive */
@media (max-width: 768px) {
  nav { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column; }
}
@media (min-width: 769px) {
  nav { display: flex; }
}
