:root {
  --docs-header-h: 60px;
  --sidebar-w: 272px;
  --toc-w: 224px;
  --prose: #d2d9d5;
  --accent: var(--green);
  --accent-hover: var(--green-hover);
  --accent-fill: var(--green-fill);
  --accent-line: var(--green-line);
}

html {
  scroll-padding-top: calc(var(--docs-header-h) + 24px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.docs-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--docs-header-h);
  color: #fff;
  background: linear-gradient(90deg, #08301f 0%, #0f6a3b 50%, #178048 100%);
  background-size: 200% 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  animation: docs-gradient 12s ease-in-out infinite alternate;
}

@keyframes docs-gradient {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}

.docs-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1440px;
  height: 100%;
  margin-inline: auto;
  padding-inline: 20px;
}

.docs-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: calc(var(--sidebar-w) - 20px);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.docs-brand .brand-logo {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  max-width: 460px;
  min-height: 40px;
  margin-inline: auto;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.85);
  font: 500 14.5px/1 var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.search-trigger:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.search-trigger kbd {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
}

.search-trigger svg,
.search-input-wrap svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.search-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

kbd {
  padding: 3px 6px;
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-2);
  font: 500 12px/1 var(--font-mono);
}

.docs-site-link {
  flex: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.9);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.docs-site-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.docs-menu-btn {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.docs-menu-btn svg {
  width: 20px;
  height: 20px;
}

.docs-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 0 48px;
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 20px;
}

.docs-sidebar {
  position: sticky;
  top: var(--docs-header-h);
  align-self: start;
  height: calc(100vh - var(--docs-header-h));
  padding: 24px 12px 48px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.docs-main {
  min-width: 0;
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
  padding: 40px 0 96px;
}

.docs-toc {
  position: sticky;
  top: calc(var(--docs-header-h) + 32px);
  align-self: start;
  max-height: calc(100vh - var(--docs-header-h) - 64px);
  padding-top: 40px;
  margin-top: -8px;
  overflow-y: auto;
}

.docs-sidebar ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-sidebar a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.docs-sidebar a:hover {
  color: var(--text);
  background: var(--surface);
}

.docs-sidebar a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-fill);
  font-weight: 600;
}

.nav-group {
  margin-top: 22px;
}

.nav-group-title {
  margin: 0 0 6px;
  padding-inline: 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
}

.nav-sub summary {
  position: relative;
  display: block;
  padding: 7px 12px 7px 30px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-sub summary::-webkit-details-marker {
  display: none;
}

.nav-sub summary::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(-45deg);
  transition: transform 0.15s ease;
}

.nav-sub details[open] > summary::before {
  transform: translateY(-70%) rotate(45deg);
}

.nav-sub summary:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-sub ul {
  margin: 2px 0 4px 17px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}
.toc-title {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
}

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

.toc a {
  display: block;
  padding: 4px 0 4px 14px;
  border-left: 1px solid var(--border);
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc a:hover {
  color: var(--text);
}

.toc a[aria-current="true"] {
  border-left-color: var(--accent);
  color: var(--accent);
}

.toc .toc-l3 a {
  padding-left: 28px;
}

.toc-mobile {
  display: none;
  margin: 0 0 28px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.toc-mobile summary {
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.toc-mobile ul {
  margin: 0;
  padding: 0 0 12px;
  list-style: none;
}

.toc-mobile a {
  display: block;
  padding: 6px 0;
  color: var(--text-2);
  font-size: 14.5px;
  text-decoration: none;
}

.toc-mobile .toc-l3 a {
  padding-left: 16px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 18px;
  padding: 0;
  color: var(--text-3);
  font-size: 14px;
  list-style: none;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--border-strong);
}

.breadcrumbs a {
  color: var(--text-2);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--text);
}

.breadcrumbs [aria-current="page"] {
  color: var(--text);
}

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 64px;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pager a:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}

.pager-next {
  grid-column: 2;
  text-align: right;
}

.pager-label {
  color: var(--text-3);
  font-size: 13px;
}

.pager-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.page-title {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.page-lede {
  max-width: 60ch;
  margin: 0 0 32px;
  color: var(--text-2);
  font-size: 18px;
}

.prose {
  font-size: 16.5px;
  line-height: 1.75;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.15em;
  color: var(--prose);
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li {
  margin-bottom: 0.4em;
}

.prose li::marker {
  color: var(--text-3);
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.prose h2 {
  margin: 2.5em 0 0.7em;
  font-size: 1.65rem;
  font-weight: 800;
}

.prose h3 {
  margin: 2em 0 0.55em;
  font-size: 1.25rem;
  font-weight: 700;
}

.prose h4 {
  margin: 1.8em 0 0.5em;
  font-size: 1.05rem;
  font-weight: 700;
}

.prose .anchor {
  margin-left: 0.45em;
  color: var(--text-3);
  font-weight: 500;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.prose :is(h2, h3, h4):hover .anchor,
.prose .anchor:focus-visible {
  opacity: 1;
}

.prose a:not(.anchor) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.prose a:not(.anchor):hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose :not(pre) > code {
  padding: 0.15em 0.4em;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #e8eeff;
  font: 500 0.88em var(--font-mono);
}

.prose blockquote {
  margin: 1.5em 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--border-strong);
}

.prose blockquote p {
  color: var(--text-2);
}

.prose hr {
  margin: 2.5em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.table-wrap {
  margin: 1.5em 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.prose th,
.prose td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.prose td {
  border-top: 1px solid var(--border);
  color: var(--prose);
}

.code-block {
  margin: 1.5em 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  --shiki-foreground: #d6dcd8;
  --shiki-background: transparent;
  --shiki-token-constant: #f0b36a;
  --shiki-token-string: #3ddc84;
  --shiki-token-comment: #7f8782;
  --shiki-token-keyword: #c792ea;
  --shiki-token-parameter: #d6dcd8;
  --shiki-token-function: #7fb4ff;
  --shiki-token-string-expression: #3ddc84;
  --shiki-token-punctuation: #a8afab;
  --shiki-token-link: #c792ea;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  background: var(--raised);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font: 500 13px/1 var(--font-mono);
}

.copy-btn {
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font: 600 12.5px/1 var(--font-sans);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-3);
}

.copy-btn[data-copied] {
  color: var(--accent);
  border-color: var(--accent-line);
}

.code-block pre.shiki {
  margin: 0;
  padding: 16px 0;
  overflow-x: auto;
  background: transparent !important;
  font: 400 14px/1.75 var(--font-mono);
  tab-size: 2;
}

.code-block pre.shiki code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 0 18px;
}

.callout {
  --c: #8fb4ff;
  margin: 1.5em 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--c);
  border-radius: var(--radius-md);
}

@supports (background: color-mix(in srgb, red 10%, blue)) {
  .callout {
    background: color-mix(in srgb, var(--c) 7%, var(--surface));
    border-color: color-mix(in srgb, var(--c) 35%, var(--border));
    border-left-color: var(--c);
  }
}

.callout-tip {
  --c: var(--accent);
}

.callout-warning {
  --c: #f5b544;
}

.callout-danger {
  --c: #ff6b6b;
}

.prose .callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--c);
  font-weight: 700;
}

.callout-title svg {
  flex: none;
  width: 18px;
  height: 18px;
}

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

.callout-body p,
.callout-body li {
  font-size: 15.5px;
}

.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 1.5em 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.embed-video {
  margin: 1.5em 0;
}

.embed-video video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.search-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 96px));
  margin: 72px auto auto;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  color: var(--text);
}

.search-dialog[open] {
  display: flex;
  flex-direction: column;
}

.search-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.search-input-wrap:focus-within {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.search-input-wrap input {
  flex: 1;
  min-width: 0;
  height: 58px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: 500 17px/1 var(--font-sans);
}

.search-input-wrap input::placeholder {
  color: var(--text-3);
}

.search-input-wrap input::-webkit-search-cancel-button {
  display: none;
}

.search-close {
  flex: none;
  min-height: 28px;
  padding: 0 8px;
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-2);
  font: 500 12px/1 var(--font-mono);
  cursor: pointer;
}

.search-status {
  margin: 0;
  padding: 20px 20px 24px;
  color: var(--text-2);
  font-size: 15px;
}

.search-status:empty {
  display: none;
}

.search-results {
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
}

.search-results:empty {
  display: none;
}

.search-results a {
  display: block;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
}

.search-results a[aria-selected="true"] {
  background: var(--raised);
  border-color: var(--accent-line);
}

.sr-title {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.sr-section {
  color: var(--text-2);
  font-weight: 500;
}

.sr-snippet {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.5;
}

.search-results mark {
  padding: 0 2px;
  background: var(--accent-fill);
  border-radius: 3px;
  color: var(--accent);
}

@media (max-width: 1100px) {
  .docs-shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }

  .toc-mobile {
    display: block;
  }
}

@media (max-width: 860px) {
  .docs-shell {
    display: block;
    padding-inline: 20px;
  }

  .docs-menu-btn {
    display: inline-flex;
  }

  .docs-brand {
    min-width: 0;
  }

  .docs-site-link {
    display: none;
  }

  .search-trigger {
    max-width: none;
  }

  .search-trigger kbd {
    display: none;
  }

  .docs-sidebar {
    position: fixed;
    top: var(--docs-header-h);
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(320px, 86vw);
    height: auto;
    align-self: stretch;
    padding: 12px 16px 48px 16px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.2s ease, visibility 0.2s;
  }

  body[data-nav-open] .docs-sidebar {
    visibility: visible;
    transform: none;
  }

  .docs-overlay {
    position: fixed;
    inset: var(--docs-header-h) 0 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body[data-nav-open] .docs-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body[data-nav-open] {
    overflow: hidden;
  }

  .docs-main {
    padding-top: 28px;
  }
}

@media (max-width: 480px) {
  .search-trigger {
    flex: none;
    justify-content: center;
    width: 40px;
    margin: 0 0 0 auto;
    padding: 0;
  }

  .search-trigger-label {
    display: none;
  }
}

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

  .pager-next {
    grid-column: 1;
  }

  .search-dialog {
    margin-top: 16px;
    max-height: calc(100vh - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .docs-sidebar,
  .docs-overlay {
    transition: none;
  }
}

.prose details:not(.toc-mobile) {
  margin: 10px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}

.prose details:not(.toc-mobile)[open] {
  border-color: var(--accent-line);
}

.prose details:not(.toc-mobile) > summary {
  position: relative;
  padding: 16px 52px 16px 18px;
  color: var(--text);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.prose details:not(.toc-mobile) > summary::-webkit-details-marker {
  display: none;
}

.prose details:not(.toc-mobile) > summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  color: var(--accent);
  font: 400 22px/1 var(--font-mono);
  transform: translateY(-50%);
  transition: transform 0.25s ease;
}

.prose details:not(.toc-mobile)[open] > summary::after {
  transform: translateY(-50%) rotate(45deg);
}

.prose details:not(.toc-mobile) > summary:hover {
  color: var(--accent);
}

.prose details:not(.toc-mobile) > :not(summary) {
  margin-inline: 18px;
}

.prose details:not(.toc-mobile) > :last-child {
  margin-bottom: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .docs-header { animation: none; }
}
