:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-mid: #050810;
  --bg-midnight: #0a1220;
  --panel: #0a0a0a;
  --panel-2: #111111;
  --line: #2a2a2a;
  --text: #ececec;
  --muted: #8a8a8a;
  --accent: #9eb4d4;
  --accent-2: #b7c7de;
  --code: #07090d;
  --sidebar: 326px;
}

* {
  box-sizing: border-box;
  scrollbar-width: auto;
  scrollbar-color: #3c4c5e #10141a;
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: #10141a;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid #10141a;
  border-radius: 8px;
  background: #3c4c5e;
}

*::-webkit-scrollbar-thumb:hover {
  background: #6d8296;
}

*::-webkit-scrollbar-corner {
  background: #10141a;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--bg) 0%, var(--bg-mid) 55%, var(--bg-midnight) 100%);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.corner-mark {
  position: fixed;
  right: 15px;
  bottom: 15px;
  z-index: 40;
  display: block;
  line-height: 0;
  user-select: none;
}

.corner-mark img {
  width: 150px;
  height: auto;
  opacity: 0.9;
  display: block;
}

.corner-mark:hover img {
  opacity: 1;
}

@media print {
  .corner-mark {
    display: none;
  }
}

.topbar {
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  gap: 12px;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--bg-mid), var(--bg));
  box-shadow: 0 8px 30px rgba(0, 0, 0, .22);
}

.search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 42px;
  justify-self: stretch;
  overflow: hidden;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.search span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}

.search input {
  width: 100%;
  height: 40px;
  min-width: 0;
  overflow: hidden;
  padding: 0 0 0 13px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  line-height: 40px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search input::placeholder {
  overflow: hidden;
  text-overflow: ellipsis;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(158, 180, 212, .12);
}

.edition-label {
  display: block;
  width: 196px;
  min-width: 196px;
  max-width: 196px;
  overflow: hidden;
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-variant: small-caps;
  letter-spacing: .08em;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edition-label::before {
  margin-right: 8px;
  content: "●";
  color: var(--accent);
  font-size: 8px;
}

.workbench {
  display: grid;
  grid-template-columns: var(--sidebar) 6px minmax(0, 1fr);
  min-height: 0;
}

.sidebar {
  overflow: auto;
  background: var(--panel);
}

.sidebar-resize-handle {
  z-index: 3;
  width: 6px;
  height: 100%;
  border-left: 1px solid var(--line);
  outline: none;
  background: transparent;
  cursor: col-resize;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle:focus-visible,
body.sidebar-resizing .sidebar-resize-handle {
  border-left-color: var(--accent);
  background: rgba(158, 180, 212, .16);
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

.reference-tree,
.search-results {
  padding: 10px 8px 28px;
}

.toc-overview,
.toc-product-heading {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.toc-overview {
  margin-bottom: 2px;
  padding: 8px 10px;
  font-weight: 600;
}

.toc-brand {
  display: block;
  width: calc(100% - 20px);
  margin: 2px 10px 10px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.toc-brand img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78px;
  object-fit: contain;
  object-position: left center;
}

.toc-overview:hover,
.toc-overview.active {
  background: var(--panel-2);
  color: var(--accent);
}

.toc-product {
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
}

.toc-product-logo {
  display: block;
  width: calc(100% - 24px);
  max-height: 72px;
  margin: 5px 12px 9px;
  object-fit: contain;
  object-position: left center;
}

.toc-product-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
}

.toc-product-copy {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
}

.toc-product-heading:hover {
  background: var(--panel-2);
}

.toc-product-heading strong,
.toc-product-heading span {
  display: block;
}

.toc-product-heading strong {
  font-size: 15px;
}

.toc-product-heading span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.toc-product-body {
  display: none;
  margin-top: 3px;
}

.toc-product.open > .toc-product-body {
  display: block;
}

.namespace {
  margin: 1px 0;
}

.namespace > button,
.type-heading,
.group-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #c9d5e8;
  text-align: left;
  cursor: pointer;
}

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

.toc-caret {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.toc-caret::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
}

.namespace.open > button .toc-caret::before,
.toc-product.open > .toc-product-heading .toc-caret::before,
.type-node.open > .type-heading .toc-caret::before,
.member-group.open > .group-heading .toc-caret::before {
  transform: rotate(45deg);
}

.namespace > button:hover,
.type-heading:hover,
.group-heading:hover {
  background: var(--panel-2);
}

.namespace-types {
  display: none;
  margin: 0 0 5px 11px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.namespace.open .namespace-types {
  display: grid;
}

.type-body,
.group-members {
  display: none;
  margin: 0 0 4px 18px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.type-node.open > .type-body,
.member-group.open > .group-members {
  display: grid;
}

.type-heading.active,
.group-heading.active,
.member-link.active {
  background: var(--panel-2);
  color: var(--accent);
}

.member-link,
.search-hit {
  display: block;
  width: 100%;
  padding: 6px 9px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.member-link:hover,
.search-hit:hover {
  background: var(--panel-2);
  color: var(--text);
}

.search-results h3 {
  margin: 6px 8px 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.search-hit {
  margin-bottom: 3px;
  white-space: normal;
}

.search-hit strong,
.search-hit span {
  display: block;
}

.search-hit span {
  color: var(--muted);
  font-size: 11px;
}

.content {
  overflow: auto;
  padding: 42px clamp(28px, 6vw, 90px) 90px;
  scroll-behavior: smooth;
}

.article,
.loading-card,
.home-card {
  width: min(960px, 100%);
  margin: 0 auto;
}

.article h1 {
  margin: 0 0 24px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.12;
  letter-spacing: -.025em;
}

.article h2 {
  margin: 46px 0 14px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 24px;
}

.article h3 {
  margin: 30px 0 12px;
  color: #d8e6f8;
  font-size: 18px;
}

.article p,
.article li {
  max-width: 860px;
}

.article a,
.home-card a {
  color: var(--accent);
  text-decoration: none;
}

.article a:hover,
.home-card a:hover {
  text-decoration: underline;
}

.article pre {
  overflow: auto;
  margin: 18px 0 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--code);
  color: #d9e7f6;
  font: 13px/1.55 Consolas, "Cascadia Code", monospace;
  white-space: pre;
}

.article code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--code);
  color: #d5bcff;
  font-family: Consolas, "Cascadia Code", monospace;
}

.article pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.article ul {
  padding-left: 22px;
}

.home-card,
.loading-card {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
}

.home-card h1,
.loading-card h1 {
  margin-top: 0;
}

.manual-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.manual-stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .13);
}

.manual-stat strong,
.manual-stat span {
  display: block;
}

.manual-stat strong {
  font-size: 20px;
}

.manual-stat span {
  color: var(--muted);
  font-size: 12px;
}

.pdf-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pdf-links a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.fatal {
  padding: 22px;
  border: 1px solid #7c3541;
  border-radius: 9px;
  background: #2b151b;
  color: #ffbac4;
}

@media (max-width: 780px) {
  .topbar {
    gap: 10px;
    padding: 0 12px;
  }
}
