:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --primary: #1e5a2f;
  --primary-light: #e8f5e9;
  --primary-border: #a3d9a5;
  --accent: #2e7d32;
  --badge-bg: #ecfdf5;
  --badge-text: #065f46;
  --badge-border: #a7f3d0;
  --callout-bg: #f0fdf4;
  --callout-border: #bbf7d0;
  --code-bg: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --bg-card: #131b26;
    --bg-subtle: #1a2433;
    --border: #223044;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --primary: #4ade80;
    --primary-light: #064e3b33;
    --primary-border: #065f46;
    --accent: #4ade80;
    --badge-bg: #064e3b4d;
    --badge-text: #6ee7b7;
    --badge-border: #047857;
    --callout-bg: #064e3b26;
    --callout-border: #065f46;
    --code-bg: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-main);
  background-color: var(--bg);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.top-bar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.version-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  border-radius: 9999px;
}

.container {
  width: 100%;
  max-width: 1140px;
  min-width: 0;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  flex: 1;
}

.hero {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.hero p.lead {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 780px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.summary-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: start;
}

.layout > * {
  min-width: 0;
}

.toc-sidebar {
  position: sticky;
  top: 5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
}

.toc-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

.toc-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.35;
  transition: color 0.15s ease;
  display: block;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.toc-nav a:hover {
  color: var(--primary);
  background: var(--bg-subtle);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  min-width: 0;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
}

.section-card h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  scroll-margin-top: 5.5rem;
}

.section-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.35rem 0 0.5rem;
  color: var(--text-main);
}

.section-card p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.975rem;
}

.section-card p:last-child {
  margin-bottom: 0;
}

.section-card ul, .section-card ol {
  margin: 0.75rem 0 1.25rem 1.5rem;
  color: var(--text-muted);
}

.section-card li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.section-card strong {
  color: var(--text-main);
}

.table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  margin: 1.25rem 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

thead {
  background: var(--bg-subtle);
}

th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

tr:last-child td {
  border-bottom: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.15rem 0.35rem;
  background: var(--code-bg);
  border-radius: 4px;
  color: var(--text-main);
  overflow-wrap: anywhere;
  word-break: break-word;
}

td code, th code {
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}

.section-card a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.callout {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--callout-bg);
  border-radius: 0 8px 8px 0;
}

.callout-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--primary);
}

.callout p {
  font-size: 0.9rem;
  margin-bottom: 0;
  color: var(--text-muted);
}

.contact-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1rem;
}

.contact-box dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  font-size: 0.925rem;
}

.contact-box dt {
  font-weight: 600;
  color: var(--text-main);
}

.contact-box dd {
  color: var(--text-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.875rem;
}

footer p {
  margin-bottom: 0.5rem;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .toc-sidebar {
    display: none;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .section-card {
    padding: 1.35rem;
  }
}

@media (max-width: 600px) {
  .contact-box dl {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .contact-box dt {
    margin-top: 0.6rem;
  }

  .contact-box dt:first-child {
    margin-top: 0;
  }
}
