:root {
  --color-bg: #f8f6f0;
  --color-surface: #ffffff;
  --color-text: #111111;
  --color-text-secondary: #4a4a4a;
  --color-accent: #25d366;
  --color-border: #e2e0d8;
  --color-code-bg: #ecebe5;
  --font-stack: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-hover: 0 6px 16px rgba(0,0,0,0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-stack);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
}

h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); }

p {
  margin-bottom: 1em;
  max-width: 72ch;
  color: var(--color-text-secondary);
}

strong { font-weight: 600; color: var(--color-text); }

a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

a:hover { color: var(--color-accent); }

/* Layout */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section {
  padding: var(--space-xl) 0;
  position: relative;
}

section.alt-bg {
  background-color: var(--color-surface);
}

section.dark-zone {
  background-color: var(--color-text);
  color: #f8f6f0;
}

section.dark-zone p, section.dark-zone h1, section.dark-zone h2, section.dark-zone h3 {
  color: #f8f6f0;
}

/* Header & Nav */
header {
  background-color: var(--color-text);
  color: #f8f6f0;
  padding: var(--space-sm) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 700;
  font-size: 1.1rem;
  color: inherit;
  text-decoration: none;
}

.brand img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

nav a {
  color: #f8f6f0;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.4em 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

nav a:hover, nav a[aria-current="page"] {
  border-bottom-color: var(--color-accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75em 1.8em;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
  border: 2px solid transparent;
}

.btn-primary {
  background-color: var(--color-text);
  color: #fff;
}

.btn-primary:hover {
  background-color: #333;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--color-text);
  color: var(--color-text);
}

.btn-outline:hover {
  background-color: var(--color-text);
  color: #fff;
}

.btn-light {
  background-color: var(--color-accent);
  color: #fff;
}

.btn-light:hover {
  background-color: #1fb856;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Cards & Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.section-alt-bg .card {
  background: var(--color-bg);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
  font-weight: 600;
  font-size: 1.1rem;
}

.card-body p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Lists & Markers */
ul.marked-list {
  list-style: none;
  padding-left: 0;
}

ul.marked-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

ul.marked-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.6em;
  height: 0.6em;
  background-color: var(--color-accent);
  border-radius: 2px;
}

ol.step-list {
  counter-reset: step-counter;
  list-style: none;
  padding-left: 0;
}

ol.step-list li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1rem;
}

ol.step-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.8rem;
  height: 1.8rem;
  background-color: var(--color-text);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: var(--space-md) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background-color: var(--color-code-bg);
  font-weight: 600;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--color-border);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  padding: 1rem 0;
  position: relative;
  padding-right: 2rem;
  font-size: 1.05rem;
  color: var(--color-text);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Latest & Related */
.update-card time {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: 0.4rem;
}

.related-list {
  list-style: none;
  padding-left: 0;
}

.related-list li {
  margin-bottom: 1rem;
  border-bottom: 1px dashed var(--color-border);
  padding-bottom: 1rem;
}

.related-list a {
  font-weight: 600;
  display: block;
  margin-bottom: 0.3rem;
}

.related-list p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* Footer */
footer {
  background-color: var(--color-text);
  color: #aaa;
  padding: var(--space-lg) 0;
  text-align: center;
  font-size: 0.9rem;
}

footer a { color: #ccc; }

/* SVG Animations */
@keyframes grid-pulse {
  0%, 100% { opacity: 0.15; r: 3; }
  50% { opacity: 1; r: 5; fill: var(--color-accent); }
}

.grid-node {
  animation: grid-pulse 8s infinite ease-in-out;
  animation-delay: calc(var(--node-index) * 0.25s);
}

@keyframes draw-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-flow 3s ease-out forwards;
  animation-fill-mode: forwards;
}

@keyframes fade-in-up {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.fade-block {
  animation: fade-in-up 1s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .flow-line, .grid-node { animation: none !important; }
}

/* Focus States */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  nav ul { flex-direction: column; gap: 0.5rem; }
  section { padding: var(--space-lg) 0; }
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.6rem; }
}
