.reference-prose {
  min-width: 0;
  overflow-wrap: break-word;
}

.reference-prose > :first-child {
  margin-top: 0;
}

.reference-prose h2,
.reference-prose h3,
.reference-prose h4,
.reference-prose h5,
.reference-prose h6 {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.reference-prose :where(h2, h3, h4, h5, h6):target {
  border-radius: 8px;
  outline: 2px solid rgb(179 197 255 / 0.7);
  outline-offset: 7px;
}

.reference-prose h2 {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  margin-top: 52px;
}

.reference-prose h2:first-child {
  padding-top: 0;
  border-top: 0;
  margin-top: 0;
}

.reference-prose h3 {
  margin-top: 36px;
  font-size: 1.18rem;
}

.reference-prose h4,
.reference-prose h5,
.reference-prose h6 {
  margin: 28px 0 10px;
  color: white;
  font-size: 0.96rem;
}

.reference-prose :where(ul, ol) {
  padding-inline-start: 1.45rem;
}

.reference-prose :where(p, li) code,
.reference-prose :where(td, th) code {
  border: 1px solid rgb(151 175 255 / 0.14);
  border-radius: 6px;
  background: rgb(117 135 255 / 0.08);
  color: rgb(225 232 255);
  padding: 0.08em 0.32em;
  overflow-wrap: normal;
  word-break: normal;
}

.reference-prose blockquote {
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--line-strong);
  margin: 24px 0;
  color: var(--muted);
}

.reference-prose hr {
  height: 1px;
  border: 0;
  margin: 48px 0;
  background: var(--line);
}

.reference-prose details {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 24px 0;
  background: rgb(7 15 34 / 0.7);
}

.reference-prose summary {
  color: white;
  cursor: pointer;
  font-weight: 750;
}

.reference-prose details[open] summary {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.reference-prose .table-wrap {
  max-width: 100%;
  margin: 24px 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.reference-prose .table-wrap table {
  width: max-content;
  min-width: max(100%, 680px);
  border-collapse: collapse;
}

.reference-prose .table-wrap[data-columns="4"] table {
  min-width: max(100%, 66rem);
}

.reference-prose .table-wrap[data-columns="5"] table {
  min-width: max(100%, 84rem);
}

.reference-prose .table-wrap :where(th, td) {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.reference-prose .table-wrap :where(th, td):first-child {
  min-width: 10rem;
}

.reference-prose .table-wrap :where(th, td) code {
  white-space: nowrap;
}

.reference-prose .table-wrap th {
  color: white;
  background: rgb(117 135 255 / 0.08);
}

.reference-code .code-bar {
  flex-wrap: wrap;
}

.reference-code .code-bar > span:first-child {
  color: rgb(220 229 255);
  font-weight: 760;
}

.reference-code [data-copy-status] {
  min-height: 1em;
  margin-left: auto;
  color: var(--muted);
}

.reference-sidebar {
  max-height: calc(100vh - var(--header-height) - 46px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.reference-sidebar section + section {
  margin-top: 22px;
}

.reference-sidebar h2 {
  margin: 0 0 8px;
  color: white;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.reference-sidebar nav {
  margin: 0;
}

.reference-toc nav {
  max-height: calc(100vh - var(--header-height) - 105px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.reference-toc .toc-more {
  margin: 10px 0 0 12px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.reference-toc-compact {
  display: none;
}

.reference-toc-compact nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 18px;
}

.reference-toc-compact .toc-more {
  margin-bottom: 0;
  color: var(--muted);
}

.reference-prose :where(a, summary, .table-wrap):focus-visible,
.reference-sidebar a:focus-visible {
  border-radius: 5px;
  outline: 3px solid rgb(179 197 255 / 0.9);
  outline-offset: 3px;
}

.reference-collection-list {
  display: grid;
  gap: 12px;
  padding: 0 !important;
  list-style: none;
}

.reference-collection-list li {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(7 15 34 / 0.58);
}

.reference-collection-list strong {
  display: block;
  margin-bottom: 4px;
  color: white;
}

.module-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.32fr) auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 24px 0;
  background: rgb(7 15 34 / 0.7);
}

.module-search label {
  display: grid;
  gap: 7px;
  color: white;
  font-size: 0.78rem;
  font-weight: 760;
}

.module-search :where(input, select, button) {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgb(3 9 23 / 0.95);
  color: white;
  font: inherit;
}

.module-search :where(input, select) {
  padding: 0 12px;
}

.module-search button {
  padding: 0 18px;
  cursor: pointer;
  font-weight: 760;
}

.module-search-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.runtime-module-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 !important;
  list-style: none;
}

.runtime-module-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(7 15 34 / 0.58);
}

.runtime-module-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.runtime-module-card p {
  margin: 8px 0;
}

.runtime-module-card dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 12px;
  margin: 12px 0;
  font-size: 0.82rem;
}

.runtime-module-card dt {
  color: white;
  font-weight: 760;
}

.runtime-module-card dd {
  margin: 0;
  color: var(--muted);
}

.runtime-module-card[hidden],
.module-search-empty[hidden] {
  display: none;
}

.module-contract-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 !important;
  list-style: none;
}

.module-contract-summary li {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgb(7 15 34 / 0.52);
}

@media (max-width: 1280px) {
  .docs-layout {
    grid-template-columns: minmax(150px, 180px) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 42px);
  }

  .reference-toc {
    display: none;
  }

  .reference-toc-compact {
    display: block;
    padding: 14px 16px;
    margin: 0 0 32px;
  }
}

@media (max-width: 980px) {
  .reference-sidebar {
    max-height: none;
    overflow-y: visible;
  }
}

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

@media (max-width: 760px) {
  .reference-prose h2 {
    margin-top: 42px;
  }

  .reference-prose .table-wrap table {
    min-width: 620px;
  }

  .reference-toc-compact nav {
    grid-template-columns: 1fr;
  }

  .module-search,
  .runtime-module-directory,
  .module-contract-summary {
    grid-template-columns: 1fr;
  }

  .module-search-status {
    grid-column: 1;
  }
}

@media (forced-colors: active) {
  .reference-prose details,
  .reference-collection-list li,
  .runtime-module-card,
  .module-contract-summary li,
  .module-search,
  .reference-prose :where(p, li, td, th) code {
    border-color: CanvasText;
  }
}
