*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.75;
  font-size: 16px;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

ul, ol {
  list-style: none;
}

/* Design Tokens */
:root {
  --color-dark: #19102D;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
}

/* Layout Utilities */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.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);
}

/* Typography */
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-wrap: balance;
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin-bottom: 24px;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

p {
  margin-bottom: 16px;
  max-width: 38em;
}

.lead {
  font-size: 1.125rem;
  line-height: 1.7;
  max-width: 65ch;
  margin-bottom: 24px;
}

.section-subtitle {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 12px;
}

.dark-section .section-subtitle {
  color: var(--color-accent);
}

.hl {
  color: var(--color-brand);
}

.dark-section .hl {
  color: var(--color-accent);
}

/* Header & Nav */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

nav {
  display: flex;
  gap: 28px;
}

nav a {
  font-weight: 500;
  font-size: 0.95rem;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--color-brand);
}

@media (max-width: 768px) {
  nav { display: none; }
}

/* Footer */
footer {
  padding: 48px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(var(--color-text), 0.7);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links a:hover {
  color: var(--color-brand);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  height: 48px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #c255d8;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.03);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* Sections */
section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.dark-section {
  background: var(--color-dark);
  color: var(--color-paper);
}

.dark-section h2,
.dark-section h3,
.dark-section p,
.dark-section li,
.dark-section td,
.dark-section th {
  color: var(--color-paper);
}

.dark-section .lead {
  color: var(--color-paper);
}

.dark-section a {
  color: var(--color-accent);
}

.dark-section a:hover {
  color: #e89bf5;
}

/* Cards & Panels */
.card {
  background: var(--color-paper);
  border: var(--card-border) solid transparent;
  box-shadow: var(--card-shadow);
  padding: 24px;
  border-radius: var(--radius-card);
}

.dark-section .card {
  background: rgba(255, 255, 255, 0.05);
}

.panel {
  background: var(--color-paper);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 24px;
  border-radius: var(--radius-card);
}

.dark-section .panel {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

th {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.02);
}

.dark-section th,
.dark-section td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* FAQ */
details {
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 16px;
  border-radius: var(--radius-card);
}

summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

summary::marker,
summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "+";
  font-weight: bold;
  color: var(--color-brand);
}

details[open] summary::before {
  content: "-";
}

details p {
  margin-top: 12px;
  color: var(--color-text);
}

.dark-section details {
  border-color: rgba(255, 255, 255, 0.15);
}

.dark-section summary::before {
  color: var(--color-accent);
}

.dark-section details p {
  color: var(--color-paper);
}

/* News */
article {
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--color-paper);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.dark-section article {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

article time {
  font-size: 0.85rem;
  color: var(--color-brand);
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.dark-section article time {
  color: var(--color-accent);
}

article p {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0;
}

/* SVG Animations */
.hero-svg {
  width: 100%;
  height: auto;
  max-width: 640px;
  box-sizing: border-box;
}

.sync-svg, .shortcut-svg {
  width: 100%;
  height: auto;
  max-width: 480px;
}

.orbit {
  fill: none;
  stroke-width: 2;
}

.orbit-1 {
  stroke: var(--color-brand);
  opacity: 0.3;
}

.orbit-2 {
  stroke: var(--color-accent);
  opacity: 0.2;
}

.node {
  fill: var(--color-paper);
  stroke: var(--color-brand);
  stroke-width: 1.5;
}

.node-center {
  fill: var(--color-accent);
  stroke: none;
}

.link-path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.key-cap {
  fill: rgba(255, 255, 255, 0.1);
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 1;
}

.key-label {
  fill: var(--color-paper);
  font-size: 10px;
  font-family: monospace;
}

@keyframes breathe-1 {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.06); opacity: 0.5; }
}

@keyframes breathe-2 {
  0%, 100% { transform: scale(1); opacity: 0.2; }
  50% { transform: scale(1.08); opacity: 0.4; }
}

@keyframes float-in {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes node-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

@keyframes dash-flow {
  to { stroke-dashoffset: -16; }
}

@keyframes key-hover {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.orbit-1 {
  animation: breathe-1 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.orbit-2 {
  animation: breathe-2 8s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.notif-card {
  animation: float-in 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.sync-node {
  animation: node-pulse 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.sync-node:nth-child(odd) {
  animation-delay: 0.5s;
}

.dashed-link {
  animation: dash-flow 2s linear infinite;
}

.key-cap {
  animation: key-hover 3s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.key-cap:nth-child(even) {
  animation-delay: 1.5s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
}

/* 兜底：裁掉横向溢出 */
div.grid-2.grid-split {
  overflow-x: clip;
}
