:root {
  --void: #06070b;
  --surface: #0c0e16;
  --surface-2: #12141f;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --text: #eef0f5;
  --text-dim: #c2cae0;
  --text-faint: #5c6178;
  --jade: #3ddc97;
  --violet: #a78bfa;
  --cyan: #6fe3ff;
  --amber: #f2b855;
  --rose: #ff8098;
  --header-h: 62px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--void);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--jade);
  color: #04120b;
}

.sidebar,
.toc,
.search-results {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.sidebar:hover,
.toc:hover,
.search-results:hover,
.sidebar:focus-within,
.toc:focus-within,
.search-results:focus-within {
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.sidebar::-webkit-scrollbar,
.toc::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-button,
.toc::-webkit-scrollbar-button,
.search-results::-webkit-scrollbar-button {
  display: none;
}

.sidebar::-webkit-scrollbar-track,
.toc::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.toc::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
  background: transparent;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 99px;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.toc:hover::-webkit-scrollbar-thumb,
.search-results:hover::-webkit-scrollbar-thumb,
.sidebar:focus-within::-webkit-scrollbar-thumb,
.toc:focus-within::-webkit-scrollbar-thumb,
.search-results:focus-within::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  background-clip: padding-box;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.toc::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
  background-clip: padding-box;
}

kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-faint);
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: rgba(6, 7, 11, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand svg,
.footer-brand svg {
  width: 20px;
  height: 20px;
  display: block;
}

.brand-sub {
  color: var(--text-faint);
  font-weight: 400;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
}

.sidebar-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

header nav.links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
}

header nav.links a {
  font-size: 13.5px;
  color: var(--text-dim);
  transition: color .2s;
  white-space: nowrap;
}

header nav.links a:hover {
  color: var(--text);
}

.btn-solid {
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: linear-gradient(135deg, var(--jade), var(--cyan));
  color: #04140d !important;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 260px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-faint);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.search-trigger:hover {
  border-color: rgba(61, 220, 151, 0.4);
  background: var(--surface-2);
}

.search-trigger svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.search-trigger span {
  flex: 1;
  text-align: left;
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(3, 4, 7, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 12vh 20px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.search-overlay[hidden] {
  display: none;
}

.search-panel {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.search-input-row svg {
  width: 17px;
  height: 17px;
  color: var(--text-faint);
  flex: none;
}

.search-input-row input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}

.search-input-row input::placeholder {
  color: var(--text-faint);
}

.search-results {
  max-height: 58vh;
  overflow-y: auto;
  padding: 8px;
}

.search-result {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.search-result.active,
.search-result:hover {
  background: var(--surface-2);
  border-color: rgba(61, 220, 151, 0.3);
}

.search-section {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--jade);
  margin-bottom: 5px;
}

.search-title {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.search-excerpt {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-faint);
}

.search-excerpt mark {
  background: rgba(61, 220, 151, 0.2);
  color: var(--jade);
  border-radius: 3px;
}

.search-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13.5px;
}

.docs-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 210px;
  gap: 52px;
  max-width: 1440px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 44px) 40px 110px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 34px);
  max-height: calc(100vh - var(--header-h) - 60px);
  overflow-y: auto;
  padding: 0 8px 0 12px;
  margin-left: -12px;
}

.sidebar-section {
  margin-bottom: 26px;
}

.sidebar-section h4 {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.sidebar-section a {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-dim);
  padding: 6px 12px;
  margin-left: -12px;
  border-radius: 7px;
  border-left: 2px solid transparent;
  transition: color .18s, background .18s, border-color .18s;
}

.sidebar-section a:hover {
  color: var(--text);
  background: var(--surface);
}

.sidebar-section a.active {
  color: var(--jade);
  background: rgba(61, 220, 151, 0.08);
  border-left-color: var(--jade);
  border-radius: 0 7px 7px 0;
}

.doc {
  min-width: 0;
}

.breadcrumb {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--jade);
  margin-bottom: 12px;
}

.doc-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-style: italic;
  font-size: clamp(34px, 4.4vw, 48px);
  line-height: 1.06;
  letter-spacing: -0.01em;
}

.doc-intro {
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-dim);
}

.doc .prose {
  margin-top: 34px;
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 34px);
  max-height: calc(100vh - var(--header-h) - 60px);
  overflow-y: auto;
  font-size: 13px;
}

.toc h4 {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.toc a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 1px solid var(--line);
  color: var(--text-faint);
  line-height: 1.45;
  transition: color .18s, border-color .18s;
}

.toc a:hover {
  color: var(--text-dim);
}

.toc a.active {
  color: var(--jade);
  border-left-color: var(--jade);
}

.toc .toc-h3 {
  padding-left: 26px;
}

.doc-nav {
  margin-top: 72px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.doc-nav a {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  transition: border-color .22s, background .22s;
}

.doc-nav a:hover {
  border-color: rgba(61, 220, 151, 0.4);
  background: var(--surface);
}

.doc-nav span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.doc-nav strong {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
}

.doc-nav .next {
  text-align: right;
}

.home-grid {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.home-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  background: var(--surface);
  transition: border-color .22s, background .22s, transform .22s;
}

.home-card:hover {
  border-color: rgba(61, 220, 151, 0.4);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.home-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 7px;
}

.home-card p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-faint);
}

.prose {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-dim);
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.prose h2 {
  font-size: 25px;
  font-weight: 600;
  margin-top: 2em;
  padding-top: 1.1em;
  border-top: 1px solid var(--line-soft);
}

.prose h3 {
  font-size: 19px;
  font-weight: 600;
  margin-top: 1.8em;
}

.prose h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 1.5em;
}

.prose .anchor {
  opacity: 0;
  margin-left: 9px;
  color: var(--jade);
  font-size: 0.72em;
  font-weight: 400;
  transition: opacity .2s;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose h4:hover .anchor {
  opacity: 1;
}

.prose a {
  color: var(--jade);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(61, 220, 151, 0.4);
  transition: text-decoration-color .2s;
}

.prose a:hover {
  text-decoration-color: var(--jade);
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li::marker {
  color: var(--text-faint);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.6em 0;
}

.prose code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--cyan);
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-dim);
}

.table-scroll {
  overflow-x: auto;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
}

.prose th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.prose figure {
  margin: 0;
}

.prose img,
.prose video {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
  background: var(--surface);
}

.prose video {
  width: 100%;
}

.prose iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.prose figcaption {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-faint);
  text-align: center;
}

.prose .card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.prose .card-grid > *,
.prose details.game > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.prose .card-grid > * {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.prose .card-grid > * > span:first-of-type,
.prose details.game > summary > span:first-of-type {
  flex: 1;
}

.prose .card-grid img,
.prose details.game > summary img {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.prose .tag {
  display: inline-block;
  flex: none;
  padding: 3px 8px;
  border: 1px solid rgba(242, 184, 85, 0.3);
  border-radius: 999px;
  background: rgba(242, 184, 85, 0.1);
  color: var(--amber);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

.prose td .tag {
  margin: 1px 2px 1px 0;
}

.prose td:has(> .tag) {
  white-space: nowrap;
}

.prose details.game td:first-child {
  white-space: nowrap;
}

.prose details.game th:last-child,
.prose details.game td:last-child {
  min-width: 260px;
}

.prose td .warn {
  display: block;
  margin-top: 7px;
  padding-left: 9px;
  border-left: 2px solid rgba(242, 184, 85, 0.4);
  color: var(--amber);
  font-size: 13px;
  line-height: 1.5;
}

.prose details.game tbody tr:has(> td:first-child > strong):has(> td:nth-child(2):empty) > td {
  background: var(--surface-2);
  border-right-color: transparent;
  padding-top: 14px;
  padding-bottom: 8px;
}

.prose details.game tbody tr:has(> td:first-child > strong):has(> td:nth-child(2):empty) > td:last-child {
  border-right-color: var(--line);
}

.prose details.game tbody tr:has(> td:first-child > strong):has(> td:nth-child(2):empty) > td > strong {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.prose .tag-jade {
  border-color: rgba(61, 220, 151, 0.3);
  background: rgba(61, 220, 151, 0.1);
  color: var(--jade);
}

.prose .tag-violet {
  border-color: rgba(167, 139, 250, 0.3);
  background: rgba(167, 139, 250, 0.1);
  color: var(--violet);
}

.prose .tag-cyan {
  border-color: rgba(111, 227, 255, 0.3);
  background: rgba(111, 227, 255, 0.1);
  color: var(--cyan);
}

.prose .tag-rose {
  border-color: rgba(255, 128, 152, 0.3);
  background: rgba(255, 128, 152, 0.1);
  color: var(--rose);
}

.prose .tag-grey {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.prose details.game {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.prose details.game > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.prose details.game > summary::-webkit-details-marker {
  display: none;
}

.prose details.game > summary:hover {
  background: var(--surface-2);
}

.prose details.game > summary::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s ease;
}

.prose details.game[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.prose details.game[open] > summary {
  border-bottom: 1px solid var(--line);
}

.prose details.game > :not(summary) {
  margin: 14px;
}

.prose li:has(> input[type="checkbox"]) {
  list-style: none;
  margin-left: -1.4em;
}

.prose input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 0 9px 0 0;
  vertical-align: -3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  opacity: 1;
}

.prose input[type="checkbox"]:checked {
  background: var(--jade);
  border-color: var(--jade);
}

.prose input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #04140d;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.prose blockquote {
  border-left: 2px solid var(--line);
  padding: 4px 0 4px 20px;
  color: var(--text-dim);
}

.prose blockquote.callout {
  border-left-width: 3px;
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  background: var(--surface);
}

.prose blockquote.callout > * + * {
  margin-top: 0.8em;
}

.callout-note {
  border-left-color: var(--cyan);
}

.callout-note strong:first-child {
  color: var(--cyan);
}

.callout-tip {
  border-left-color: var(--jade);
}

.callout-tip strong:first-child {
  color: var(--jade);
}

.callout-warning {
  border-left-color: var(--amber);
}

.callout-warning strong:first-child {
  color: var(--amber);
}

.callout-important {
  border-left-color: var(--rose);
}

.callout-important strong:first-child {
  color: var(--rose);
}

footer {
  border-top: 1px solid var(--line-soft);
  padding: 40px 40px 50px;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
}

.footer-inner nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-inner nav a {
  font-size: 13.5px;
  color: var(--text-dim);
}

.footer-inner nav a:hover {
  color: var(--text);
}

.footer-inner .copyright {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-faint);
}

@media(max-width: 1200px) {
  .docs-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 40px;
  }

  .toc {
    display: none;
  }

  .search-trigger {
    width: 200px;
  }
}

@media(max-width: 900px) {
  .sidebar-toggle {
    display: block;
  }

  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: calc(var(--header-h) + 32px) 22px 80px;
  }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 270px;
    max-height: none;
    z-index: 90;
    margin-left: 0;
    padding: 26px 20px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  header nav.links a:not(.btn-solid) {
    display: none;
  }

  .search-trigger {
    width: auto;
    flex: 1;
    max-width: 340px;
  }

  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  .doc-nav {
    grid-template-columns: 1fr;
  }

  .prose .card-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner .copyright {
    margin-left: 0;
  }
}
