:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --link: #2563eb;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand .title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}

.brand .subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.control {
  display: grid;
  gap: 6px;
}

.label {
  font-size: 12px;
  color: var(--muted);
}

select {
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
}

.link {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--link);
  background: var(--panel);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.toc {
  position: sticky;
  top: 70px;
  align-self: start;
  max-height: calc(100vh - 90px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.toc .toc-title {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 6px 10px 6px;
}

.toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.toc a:hover {
  background: #f1f5f9;
}

.toc a.depth-2 {
  padding-left: 18px;
}
.toc a.depth-3 {
  padding-left: 28px;
}
.toc a.depth-4 {
  padding-left: 38px;
}

.main {
  min-width: 0;
}

.status {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 2px 10px 2px;
}

.content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  scroll-margin-top: 90px;
}

.markdown-body a {
  color: var(--link);
}

.markdown-body pre {
  background: #0b1220;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 12px;
  overflow: auto;
}

.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  overflow: auto;
  display: block;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .toc {
    position: static;
    max-height: none;
  }
}

