:root {
  --bg: #F7F6F0;
  --surface: #FFFFFF;
  --text-main: #0A0A0A;
  --text-muted: #5A5A5A;
  --border: #E2DFD5;
  --accent: #111111;
  --radius-sm: 8px;
  --radius-md: 16px;
  --max-w: 1200px;
  --space-unit: clamp(1rem, 2vw, 1.5rem);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 1rem;
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }

p {
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  max-width: 70ch;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-unit);
}

section {
  padding: clamp(4rem, 8vw, 8rem) 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--text-main);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--text-main);
  color: var(--bg);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  transform: translateY(-4px);
}

/* Grid System */
.grid-2 { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #F0EFE8;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

/* FAQ */
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
}

summary {
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
}

summary::-webkit-details-marker { display: none; }

summary::after {
  content: "+";
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  transition: transform 0.2s;
}

details[open] summary::after {
  content: "−";
  transform: translateY(-50%) rotate(90deg);
}

details > div {
  padding: 0 1.5rem 1.5rem;
  color: var(--text-muted);
}

/* Header & Footer */
header, footer {
  padding: 1.5rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  margin-top: 4rem;
}

nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}

nav a {
  font-weight: 500;
  position: relative;
  padding: 0.25rem 0;
}

nav a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--text-main);
  transition: width 0.3s;
}

nav a:hover::after,
nav a[aria-current="page"]::after {
  width: 100%;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-wrap img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* SVG Animations */
@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

@keyframes slowRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.svg-anim-draw {
  animation: drawStroke 5s ease-in-out infinite;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.svg-anim-rotate {
  animation: slowRotate 12s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .svg-anim-draw, .svg-anim-rotate {
    animation: none !important;
  }
}

/* Utilities */
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
code {
  background: #F0EFE8;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}
ol { padding-left: 1.5rem; }
ol li { margin-bottom: 0.75rem; color: var(--text-muted); }
ul.related-list { list-style: none; }
ul.related-list li a {
  display: block;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  transition: color 0.2s, padding-left 0.2s;
}
ul.related-list li a:hover {
  color: var(--accent);
  padding-left: 0.5rem;
}
@media (max-width: 768px) {
  nav ul { gap: 1rem; font-size: 0.9rem; }
  h1 { font-size: clamp(2rem, 8vw, 3.5rem); }
}
