:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-grouped: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #8e8e93;
  --separator: rgba(60, 60, 67, 0.12);
  --separator-strong: rgba(60, 60, 67, 0.29);
  --accent: #007aff;
  --accent-pressed: #0066cc;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --max-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-grouped: #2c2c2e;
    --text: #f5f5f7;
    --text-secondary: #aeaeb2;
    --text-tertiary: #8e8e93;
    --separator: rgba(84, 84, 88, 0.36);
    --separator-strong: rgba(84, 84, 88, 0.65);
    --accent: #0a84ff;
    --accent-pressed: #409cff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}
@media (prefers-color-scheme: dark) {
  .header { background: rgba(0, 0, 0, 0.72); }
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.header-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}
.header-nav a {
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 980px;
  color: var(--text-secondary);
}
.header-nav a:hover {
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
}
.header-nav a.current {
  color: var(--accent);
}
.last-updated {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Main ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.panel-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.panel-lead {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0 0 28px;
}

/* ---------- Section card ---------- */
.section {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--separator);
}
.section h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.section h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 18px 0 8px;
  color: var(--text);
}
.section p, .section li {
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 10px;
}
.section p:last-child,
.section ul:last-child,
.section ol:last-child,
.section li:last-child { margin-bottom: 0; }
.section ul, .section ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}
.section li { margin-bottom: 6px; }
.section strong { font-weight: 600; color: var(--text); }

.note {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px solid var(--separator);
  margin: 12px 0;
}
@media (prefers-color-scheme: dark) {
  .note { background: var(--bg-grouped); }
}

/* ---------- Data table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 8px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--separator);
}
.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--separator);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  width: 32%;
}
@media (prefers-color-scheme: dark) {
  .data-table th { background: var(--bg-grouped); }
}
@media (max-width: 520px) {
  .data-table th { width: 38%; }
  .data-table th, .data-table td { padding: 10px 12px; font-size: 13.5px; }
}

/* ---------- TOC ---------- */
.toc {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--separator);
}
.toc ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text-secondary);
  font-size: 14.5px;
}
.toc a { color: var(--accent); }
.toc li { margin-bottom: 6px; }

.meta-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--separator);
}

.anchor-target { scroll-margin-top: 84px; }

/* ---------- Landing ---------- */
.landing {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 20px 80px;
}
.landing-title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}
.landing-lead {
  color: var(--text-secondary);
  font-size: 17px;
  margin: 0 0 32px;
}
.doc-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.doc-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.doc-card-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(0, 122, 255, 0.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.doc-card-icon svg { width: 22px; height: 22px; }
.doc-card-body { flex: 1; min-width: 0; }
.doc-card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
}
.doc-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
}
.doc-card-arrow {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
}
.doc-card-arrow svg { width: 100%; height: 100%; }
.landing-contact {
  margin-top: 40px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ---------- Print ---------- */
@media print {
  .header { position: static; background: transparent; backdrop-filter: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  a { color: #000; }
  .header-nav, .last-updated { display: none; }
}
