:root {
  color-scheme: light;
  --sidebar: #ffffff;
  --sidebar-2: #eef5ff;
  --sidebar-line: #dbe4ef;
  --sidebar-text: #172033;
  --sidebar-muted: #68758a;
  --accent: #286fd6;
  --accent-2: #0f9f7a;
  --accent-soft: #e8f2ff;
  --text: #172033;
  --muted: #667085;
  --line: #dce3ed;
  --page: #f2f5f8;
  --panel: #ffffff;
  --code: #f4f7fb;
  --shadow: 0 18px 45px rgba(20, 35, 62, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(180deg, #f8fbff 0%, var(--page) 320px),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-line);
  color: var(--sidebar-text);
  min-width: 0;
  overflow: auto;
}

.sidebar-header {
  border-bottom: 1px solid var(--sidebar-line);
  padding: 28px 22px 22px;
}

.sidebar-header p:not(.eyebrow) {
  color: var(--sidebar-muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 10px 0 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: var(--sidebar-muted);
}

.sidebar h1,
.content-toolbar h2 {
  margin: 0;
}

.sidebar h1 {
  font-size: 25px;
  line-height: 1.25;
}

.sidebar-section-title {
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  padding: 18px 18px 6px;
  text-transform: uppercase;
}

.tree {
  font-size: 14px;
  padding: 4px 10px 28px;
}

.tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-list .tree-list {
  display: none;
  padding-left: 18px;
  position: relative;
}

.tree-list .tree-list::before {
  background: var(--sidebar-line);
  bottom: 6px;
  content: "";
  left: 11px;
  position: absolute;
  top: 4px;
  width: 1px;
}

.tree-item.is-open > .tree-list {
  display: block;
}

.tree-row {
  align-items: center;
  background: transparent;
  color: inherit;
  display: grid;
  gap: 4px;
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 36px;
  width: 100%;
}

.tree-toggle,
.tree-main {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
}

.tree-toggle {
  border-radius: 6px;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 13px;
  height: 34px;
  padding: 0;
  text-align: center;
}

.tree-toggle:disabled {
  cursor: default;
}

.tree-main {
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  gap: 9px;
  min-height: 34px;
  padding: 6px 12px;
  text-align: left;
  width: 100%;
}

.tree-main:disabled {
  color: var(--sidebar-muted);
  cursor: default;
}

.tree-main:not(:disabled):hover,
.tree-main:focus-visible,
.tree-toggle:not(:disabled):hover,
.tree-toggle:focus-visible {
  background: var(--sidebar-2);
  outline: none;
}

.tree-main.is-active {
  background: var(--accent-soft);
  color: #0f3f82;
  font-weight: 750;
}

.tree-item.is-open > .tree-row .tree-toggle {
  transform: rotate(90deg);
}

.tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.content-toolbar {
  align-items: center;
  background: rgba(248, 251, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  min-height: 78px;
  padding: 15px 32px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.content-toolbar h2 {
  font-size: 22px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.icon-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  display: none;
  flex: 0 0 auto;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.icon-button span {
  background: var(--text);
  display: block;
  height: 2px;
  margin: 2px 0;
  width: 17px;
}

.markdown-body {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  line-height: 1.68;
  margin: 34px auto 56px;
  max-width: 1020px;
  padding: 44px 54px 58px;
  width: min(calc(100% - 64px), 1020px);
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  line-height: 1.25;
  margin: 28px 0 12px;
}

.markdown-body h1 {
  border-bottom: 1px solid var(--line);
  font-size: 34px;
  padding-bottom: 14px;
}

.markdown-body h2 {
  border-bottom: 1px solid var(--line);
  font-size: 24px;
  padding-bottom: 8px;
}

.markdown-body h3 {
  font-size: 19px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre,
.markdown-body blockquote,
.markdown-body table {
  margin: 0 0 16px;
}

.markdown-body a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body code {
  background: var(--code);
  border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  padding: 0.16em 0.34em;
}

.markdown-body pre {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  padding: 16px;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.markdown-body blockquote {
  background: #f7fbfa;
  border-left: 4px solid var(--accent-2);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  padding: 12px 14px;
}

.markdown-body img {
  max-width: 100%;
}

.markdown-body a[href*="github.com"] img[src*="shields.io"] {
  display: none;
}

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

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

.markdown-body th {
  background: #eef2f6;
  font-weight: 700;
}

.error {
  background: #fff1f1;
  border: 1px solid #f0c4c4;
  border-radius: 8px;
  color: #8a2222;
  padding: 16px;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  border-right: 0;
  overflow: hidden;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    bottom: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
    left: 0;
    max-width: 340px;
    position: fixed;
    top: 0;
    transform: translateX(-102%);
    transition: transform 180ms ease;
    width: 84vw;
    z-index: 20;
  }

  body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .icon-button {
    display: inline-flex;
    flex-direction: column;
  }

  .content-toolbar {
    padding: 12px 16px;
  }

  .markdown-body {
    border-left: 0;
    border-radius: 0;
    border-right: 0;
    margin: 0;
    min-height: calc(100vh - 66px);
    padding: 24px 18px 36px;
    width: 100%;
  }
}
