:root {
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  --font-title-weight: 500;
  --line-height-title: 1.15;
  --line-height-body: 1.65;
  --h1-size: clamp(2.6rem, 6.4vw, 5rem);
  --btn-height: 52px;
  --focus-ring: 2px solid var(--color-accent);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--color-paper);
  color: var(--color-body);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: var(--font-title-weight);
  line-height: var(--line-height-title);
  text-wrap: balance;
}
h1 { font-size: var(--h1-size); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 2); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
p { max-width: 38em; margin-bottom: 1rem; }
strong { font-weight: 600; }

/* Utilities */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section-pad { padding-block: var(--section-y); }

.face-dark { background-color: var(--color-dark); color: var(--color-paper); }
.face-dark .brand-text, .face-dark .link, .face-dark .accent-text { color: var(--color-accent); }
.face-dark .hl { color: var(--color-accent); }
.face-light { background-color: var(--color-paper); color: var(--color-body); }
.face-light .brand-text, .face-light .link, .face-light .accent-text { color: var(--color-brand); }
.face-light .hl { color: var(--color-brand); }

.hl { font-weight: 700; }
.muted { opacity: 0.7; font-size: 0.9em; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.face-dark .badge { color: var(--color-accent); }
.face-light .badge { color: var(--color-brand); }

/* Layout: Chessboard */
.chess-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
.chess-row > div:nth-child(even) { order: -1; }
@media (max-width: 768px) {
  .chess-row { grid-template-columns: 1fr; }
  .chess-row > div:nth-child(even) { order: unset; }
}

/* Components */
.card {
  background-color: rgba(0,0,0,0.02);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: calc(var(--gap) * 1.5);
}
.face-dark .card { background-color: rgba(255,255,255,0.05); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: var(--btn-height);
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-btn);
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn-primary { background-color: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-body);
  color: var(--color-body);
}
.face-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn-secondary:hover { filter: brightness(0.9); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* Header & Footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 1rem 0;
}
.face-dark .site-header { background-color: rgba(25, 16, 45, 0.9); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { opacity: 0.8; }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.face-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding-block: 3rem;
  border-top: 1px solid rgba(0,0,0,0.08);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(0,0,0,0.6);
}
.face-dark .site-footer { border-top-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; margin-top: 1rem; overflow-wrap: anywhere; }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.1); overflow-wrap: anywhere; }
.face-dark .data-table th, .face-dark .data-table td { border-bottom-color: rgba(255,255,255,0.1); }
.data-table th { font-weight: 600; width: 40%; }

/* FAQ */
details { margin-bottom: 1rem; border: 1px solid rgba(0,0,0,0.1); border-radius: var(--radius-card); }
.face-dark details { border-color: rgba(255,255,255,0.1); }
summary { padding: 1rem; 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; font-weight: 400; }
details[open] summary::after { content: "−"; }
.details-content { padding: 0 1rem 1rem; line-height: 1.7; }

/* SVG & Animations */
.svg-container { width: 100%; height: auto; max-width: 100%; display: block; }
.svg-container svg { width: 100%; height: auto; display: block; }

@keyframes nodeLight {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
.node {
  animation: nodeLight 4s infinite ease-in-out;
  transform-box: fill-box;
  transform-origin: center;
}
.node:nth-child(1) { animation-delay: 0.0s; }
.node:nth-child(2) { animation-delay: 0.2s; }
.node:nth-child(3) { animation-delay: 0.4s; }
.node:nth-child(4) { animation-delay: 0.6s; }
.node:nth-child(5) { animation-delay: 0.8s; }
.node:nth-child(6) { animation-delay: 1.0s; }
.node:nth-child(7) { animation-delay: 1.2s; }
.node:nth-child(8) { animation-delay: 1.4s; }
.node:nth-child(9) { animation-delay: 1.6s; }
.node:nth-child(10) { animation-delay: 1.8s; }
.node:nth-child(11) { animation-delay: 2.0s; }
.node:nth-child(12) { animation-delay: 2.2s; }
.node:nth-child(13) { animation-delay: 2.4s; }
.node:nth-child(14) { animation-delay: 2.6s; }
.node:nth-child(15) { animation-delay: 2.8s; }
.node:nth-child(16) { animation-delay: 3.0s; }

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 6s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.float-layer {
  animation: float 5s infinite ease-in-out;
  transform-box: fill-box;
  transform-origin: center;
}

@media (prefers-reduced-motion: reduce) {
  .node, .draw-path, .float-layer { animation: none !important; }
  .btn { transition: none !important; }
}
