:root {
  --bg: #f8fafc;
  --text: #111827;
  --muted: #4b5563;
  --line: #d1d5db;
  --link: #075985;
  --surface: #ffffff;
  --accent: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--link);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-title {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--accent);
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 980px);
  gap: 28px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.side-nav {
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
  position: sticky;
  top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.tree-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  line-height: 1.45;
}

.tree-nav details {
  border-left: 1px solid var(--line);
  margin-left: 4px;
  padding-left: 8px;
}

.tree-nav details details {
  margin-top: 4px;
}

.tree-nav summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  list-style-position: outside;
  padding: 5px 4px;
}

.tree-nav a {
  display: block;
  border-radius: 6px;
  color: var(--muted);
  padding: 4px 8px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tree-nav a:hover {
  background: #e5e7eb;
  color: var(--text);
}

.tree-nav a.is-active,
.tree-nav a.is-current-section {
  background: #ccfbf1;
  color: #134e4a;
}

.tree-home {
  font-weight: 700;
}

.tree-note {
  color: var(--muted);
  font-size: 13px;
  margin: 8px;
}

.content {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
}

.content h1 {
  margin-top: 0;
  line-height: 1.2;
}

.content h2,
.content h3 {
  margin-top: 32px;
  line-height: 1.3;
}

.content code {
  background: #e5e7eb;
  border-radius: 4px;
  padding: 2px 5px;
}

.content pre {
  overflow-x: auto;
  background: #111827;
  color: #f9fafb;
  border-radius: 8px;
  padding: 16px;
}

.content pre code {
  background: transparent;
  padding: 0;
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 20px;
  }

  .page-shell {
    display: block;
    padding: 24px 12px 48px;
  }

  .side-nav {
    max-height: none;
    margin-bottom: 16px;
    position: static;
  }

  .content {
    padding: 20px;
  }
}
