:root {
  --brand: #1F6FD1;
  --bg: #F4FAFF;
  --bg-alt: #E6F3FF;
  --bg-soft: #E6F3FF;
  --surface: #FFFFFF;
  --border: #D3E5F6;
  --divider: #D3E5F6;
  --text-1: #0A284C;
  --text-2: #46607A;
  --text-3: #7790AA;
  --code-bg: #0F1B2D;
  --code-text: #D6E4F5;
  --tip-bg: #E6F3FF;
  --tip-border: #B9D6F2;
  --warning: #8A5A00;
  --warning-bg: #FFF7E0;
  --warning-border: #F0D58A;
  --danger: #B4232C;
  --danger-bg: #FFEDEF;
  --danger-border: #F5B5BD;
  --nav-h: 64px;
  --content-w: 760px;
  --radius: 10px;
  --font-size: 16px;
  --code-size: 13.5px;
  --accent-ring: rgba(31, 111, 209, 0.25);
  --sidebar-w: 272px;
  --aside-w: 224px;
  --shadow-sm: 0 1px 2px rgba(10, 40, 76, 0.06);
  --shadow-lg: 0 8px 24px rgba(10, 40, 76, 0.08);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --brand: #78B8FF;
  --bg: #0B1626;
  --bg-alt: #12233A;
  --bg-soft: #12233A;
  --surface: #0F1D31;
  --border: #1F3550;
  --divider: #1F3550;
  --text-1: #E3EEFA;
  --text-2: #9DB2CC;
  --text-3: #7790AA;
  --code-bg: #08111E;
  --code-text: #D6E4F5;
  --tip-bg: rgba(120, 184, 255, 0.1);
  --tip-border: rgba(120, 184, 255, 0.3);
  --warning: #E8C27A;
  --warning-bg: rgba(240, 213, 138, 0.1);
  --warning-border: rgba(240, 213, 138, 0.35);
  --danger: #F58A96;
  --danger-bg: rgba(245, 138, 150, 0.1);
  --danger-border: rgba(245, 138, 150, 0.35);
  --accent-ring: rgba(120, 184, 255, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: 1.7;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 90; background: var(--surface); padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; }

kbd {
  font-family: var(--font);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid #B9D6F2;
  border-radius: 4px;
  color: var(--text-2);
  background: var(--surface);
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.iconbtn:hover { background: var(--bg-alt); color: var(--text-1); }
.ic-sun { display: none; }
html[data-theme="dark"] .ic-sun { display: block; }
html[data-theme="dark"] .ic-moon { display: none; }

/* docs page layout */

.docs-page .site-header { flex-wrap: nowrap !important; height: var(--nav-h); }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-alt);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease;
}
.search-trigger:hover { border-color: var(--brand); color: var(--text-1); }
.search-trigger span { flex: 1; text-align: left; }

.docs-band {
  background: linear-gradient(180deg, #9FCBFF 0%, #D7ECFF 70%, var(--bg) 100%);
  padding: 56px 24px 40px;
}
.docs-band-title {
  max-width: 1392px;
  margin: 0 auto;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #0A284C;
}

.docs-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: var(--nav-h);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 20px 12px 48px;
}

.navgroup h4 {
  margin: 0 0 6px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
#navTree .navgroup { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--divider); }
#navTree .navgroup:first-child { margin-top: 8px; padding-top: 0; border-top: 0; }
.sitelinks { display: none; }

.navlink {
  display: block;
  margin-top: 2px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--text-2);
}
.navlink:hover { color: var(--text-1); background: var(--bg-alt); text-decoration: none; }
.navlink.active { color: var(--brand); background: var(--bg-alt); font-weight: 700; }

.navtoggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 2px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.navtoggle:hover { background: var(--bg-alt); }
.navrow { display: flex; align-items: center; margin-top: 2px; border-radius: 8px; }
.navrow .navtoggle.caretonly { width: auto; margin: 0; padding: 6px 0 6px 12px; }
.navrow .navtoggle.caretonly:hover { background: none; color: var(--brand); }
.navrow .navlink { flex: 1; margin: 0; padding-left: 6px; color: var(--text-1); font-weight: 700; }
.navrow .navlink.active { color: var(--brand); }
.navtoggle svg { flex: none; width: 10px; height: 10px; color: var(--text-2); transform: rotate(90deg); transition: transform 0.15s; }
.navsection.closed .navtoggle svg { transform: none; }
.navchildren { margin-left: 18px; padding-left: 8px; border-left: 1px solid var(--divider); }
.navsection.closed .navchildren { display: none; }

.docs-main {
  flex: 1 1 560px;
  min-width: 0;
  max-width: var(--content-w);
  margin: 20px 0 48px;
  padding: 32px 40px 40px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 14px; font-size: 13px; color: var(--text-2); }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--brand); }
.crumbs [aria-current] { color: var(--text-1); font-weight: 600; }
.crumbs .sep { color: var(--text-3); }

.aside {
  flex: 0 0 var(--aside-w);
  position: sticky;
  top: var(--nav-h);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 20px 0;
  font-size: 13px;
}
.aside-title { font-size: 13px; font-weight: 700; color: var(--text-1); margin: 0 0 8px; }
.aside a { display: block; padding: 4px 0; color: var(--text-2); line-height: 1.5; }
.aside a:hover { color: var(--text-1); text-decoration: none; }
.aside a.active { color: var(--brand); font-weight: 600; }
.aside a.lvl3 { padding-left: 14px; }

.pager { display: flex; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--divider); }
.pager:empty { display: none; }
.pager a {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  transition: border-color 200ms ease, background 200ms ease;
}
.pager a:hover { border-color: var(--brand); background: var(--bg-alt); text-decoration: none; }
.pager a span { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 2px; }
.pager a.next { text-align: right; }
.pager .spacer { flex: 1; }

.searchwrap {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 10vh 16px 16px;
  background: rgba(10, 40, 76, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.searchbox {
  max-width: 580px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(10, 40, 76, 0.2);
}
.searchfield { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--divider); color: var(--text-2); }
.searchfield input { flex: 1; border: 0; outline: none; background: none; font-family: inherit; font-size: 15px; color: var(--text-1); }
.searchresults { max-height: 60vh; overflow-y: auto; padding: 8px; }
.searchhint { margin: 0; padding: 12px; font-size: 13px; color: var(--text-2); }
.sresult { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text-1); }
.sresult:hover, .sresult.sel { background: var(--bg-alt); text-decoration: none; }
.sresult strong { display: block; font-size: 14px; font-weight: 700; }
.sresult span { font-size: 12.5px; color: var(--text-2); }
.sresult mark { background: none; color: var(--brand); font-weight: 700; }

.scrim { display: none; }

/* page content, shared with the editor */

.doc h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; margin: 0 0 20px; }
.doc h2 {
  margin: 40px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
  scroll-margin-top: 88px;
}
.doc h3 { margin: 32px 0 0; font-size: 18px; font-weight: 700; scroll-margin-top: 88px; }
.doc p { margin: 16px 0; }
.doc img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); }
.doc ul, .doc ol { margin: 16px 0; padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc strong { font-weight: 700; }
.doc hr { border: 0; border-top: 1px solid var(--divider); margin: 32px 0; }
.doc blockquote { margin: 16px 0; padding-left: 16px; border-left: 3px solid var(--border); color: var(--text-2); }

.doc :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-1);
}
.doc a > code { color: var(--brand); }

.codeblock { position: relative; margin: 16px 0; }
.codeblock .lang {
  position: absolute;
  top: 4px;
  right: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: #6F86A3;
  transition: opacity 0.2s;
}
.codeblock:hover .lang { opacity: 0; }
.doc pre { margin: 0; padding: 18px 20px; overflow-x: auto; background: var(--code-bg); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.doc pre code {
  display: block;
  font-family: var(--mono);
  font-size: var(--code-size);
  line-height: 1.7;
  color: var(--code-text);
  background: none;
  padding: 0;
}
.copybtn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #2A3D57;
  border-radius: 6px;
  background: var(--code-bg);
  color: #8A9BB0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.codeblock:hover .copybtn, .copybtn:focus { opacity: 1; }
.copybtn:hover { color: #fff; }
.copybtn.done { color: #4ac26b; border-color: #4ac26b; opacity: 1; }

.tok-key { color: #8CC4FF; }
.tok-str { color: #A3D78A; }
.tok-num { color: #E8B075; }
.tok-cmt { color: #8A9BB0; }
.tok-arg { color: #E6C07B; }
.tok-cmd { color: #FFFFFF; font-weight: 600; }

.custom-block {
  margin: 16px 0;
  padding: 16px 16px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
}
.custom-block p { margin: 8px 0; }
.custom-block-title { font-weight: 700; margin: 0 0 8px; }
.custom-block.tip { background: var(--tip-bg); border-color: var(--tip-border); }
.custom-block.tip .custom-block-title { color: var(--brand); }
.custom-block.warning { background: var(--warning-bg); border-color: var(--warning-border); }
.custom-block.warning .custom-block-title { color: var(--warning); }
.custom-block.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.custom-block.danger .custom-block-title { color: var(--danger); }

.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: 10px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--border); padding: 8px 14px; text-align: left; vertical-align: top; }
.doc tr > :first-child { border-left: 0; }
.doc tr > :last-child { border-right: 0; }
.doc thead tr:first-child > * { border-top: 0; }
.doc tbody tr:last-child > * { border-bottom: 0; }
.doc th { background: var(--bg-soft); font-weight: 700; white-space: nowrap; }
.doc tbody tr:nth-child(2n) td { background: var(--bg-soft); }

@media (max-width: 1200px) {
  .aside { display: none; }
}

@media (max-width: 1180px) {
  .docs-page .site-nav, .docs-page .site-discord { display: none !important; }
  .docs-page .site-menu-btn { display: grid; }
  .docs-page .site-header { gap: 12px !important; padding: 10px 16px !important; }
  .docs-layout { padding: 0 16px; }
  .sidebar {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    bottom: 0;
    z-index: 45;
    width: 300px;
    max-height: none;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }
  .sidebar.open { transform: none; }
  .sitelinks { display: block; margin-bottom: 20px; }
  .scrim.show { display: block; position: fixed; inset: var(--nav-h) 0 0; z-index: 40; background: rgba(10, 40, 76, 0.35); }
  .docs-main { flex-basis: 100%; max-width: none; }
}

@media (max-width: 640px) {
  .docs-band { padding: 32px 16px 24px; }
  .docs-main { margin: 12px 0 32px; padding: 24px 18px 28px; border-radius: 12px; }
  .doc h1 { font-size: 27px; }
  .doc h2 { font-size: 21px; margin-top: 36px; }
  .pager { flex-direction: column; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .docs-page .site-search { flex: 0 0 auto !important; min-width: 0 !important; }
  .search-trigger { width: 40px; height: 40px; padding: 0; justify-content: center; }
}

@media (max-width: 420px) {
  .docs-page .site-brand > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
