:root {
  --md-primary: #945bba;
  --md-on-primary: #ffffff;
  --md-surface: #1f2023;
  --md-on-surface: #e6e3ea;
  --md-surface-variant: #2a2b2f;
  --md-outline: #3d3f45;
  --md-shadow: rgba(8, 8, 10, 0.45);
  --header-height: 72px;
  --sidebar-width: 280px;
  --toc-width: 260px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-title: "Roboto", sans-serif;
  --font-body: "Roboto", sans-serif;
}

[data-theme="light"] {
  --md-surface: #f3f2f6;
  --md-on-surface: #1d1c21;
  --md-surface-variant: #e2dee8;
  --md-outline: #c3bfcc;
  --md-shadow: rgba(33, 33, 39, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--md-on-surface);
  background: var(--md-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0;
  overflow: hidden;
}

@keyframes qd-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes qd-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition-duration: 0s !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--md-primary);
}

header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  height: var(--header-height);
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  align-items: center;
  padding: 0 24px;
  background: var(--md-surface);
  border-bottom: 1px solid color-mix(in srgb, var(--md-outline) 40%, transparent);
  width: min(60vw, 1280px);
  margin: 0 auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.18);
  animation: qd-fade 0.45s ease;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: -0.02em;
}

header .brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  box-shadow: 0 6px 16px var(--md-shadow);
}

header .search {
  display: flex;
  justify-content: center;
}

.search-box {
  position: relative;
  width: min(520px, 80%);
}

.search input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--md-outline);
  background: var(--md-surface-variant);
  color: var(--md-on-surface);
  font-family: var(--font-body);
  transition: border 0.2s ease;
}

.search input:focus {
  outline: none;
  border-color: var(--md-primary);
}

header .actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.lang-toggle {
    position: relative;
    display: flex;
    align-items: center;
    height: 40px;
}

.lang-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--md-outline) 60%, transparent);
    background: transparent;
    padding: 0 14px;
    color: var(--md-on-surface);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.lang-toggle.open .lang-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.lang-icon {
  display: inline-flex;
  align-items: center;
  color: var(--md-on-surface);
}

.lang-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
}

.lang-button {
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-surface);
    cursor: pointer;
    transition: all 0.2s ease;
}


.lang-button.active {
  background: color-mix(in srgb, var(--md-primary) 24%, transparent);
  color: var(--md-primary);
}

.lang-button[data-supported="false"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.lang-current {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lang-caret {
  font-size: 18px;
}

.lang-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: auto;
    width: max-content;
    min-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--md-surface) 90%, var(--md-surface-variant) 10%);
    border: 1px solid color-mix(in srgb, var(--md-outline) 50%, transparent);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-8px);
    z-index: 100;
}


.lang-toggle.open .lang-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.theme-toggle {
  background: var(--md-primary);
  color: var(--md-on-primary);
  border: none;
}

[data-theme="light"] .theme-toggle {
  background: #1d1c21;
  color: #ffffff;
  border: 1px solid #1d1c21;
}

[data-theme="light"] .icon-button {
  border-color: rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.7);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px var(--md-shadow);
  appearance: none;
  backdrop-filter: blur(10px);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.icon-button,
.lang-button,
.qd-404-button,
.search-item,
.nav-link {
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.icon-button:hover,
.qd-404-button:hover,
.search-item:hover {
  transform: translateY(-1px);
}

.lang-button:hover {
    background: color-mix(in srgb, var(--md-on-surface) 5%, transparent);
}

.lang-button.active {
    background: color-mix(in srgb, var(--md-primary) 20%, transparent);
    color: var(--md-primary);
    font-weight: 600;
}
.icon-button:active,
.qd-404-button:active {
  transform: translateY(0);
}
.icon-button.theme-toggle {
  background: var(--md-primary);
  color: var(--md-on-primary);
}

[data-theme="light"] .icon-button.theme-toggle {
  background: #1d1c21;
  color: #ffffff;
  border: 1px solid #1d1c21;
}

.icon-button:active {
  transform: none;
}

.icon-button .material-symbols-rounded {
  font-size: 20px;
}

.icon-button:hover {
  border-color: color-mix(in srgb, var(--md-primary) 65%, rgba(255, 255, 255, 0.2));
  color: var(--md-primary);
}

.header-link {
  box-shadow: none;
  background: transparent;
  border: none;
  width: 48px;
  height: 36px;
  color: var(--md-on-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  box-shadow: none;
  backdrop-filter: none;
}

.header-link svg {
  width: 20px;
  height: 20px;
}

.icon-mask {
  width: 22px;
  height: 22px;
  display: inline-block;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
}

.icon-discord {
  mask-image: url("/assets/discord.svg");
  -webkit-mask-image: url("/assets/discord.svg");
}

.icon-github {
  mask-image: url("/assets/github-mark.svg");
  -webkit-mask-image: url("/assets/github-mark.svg");
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--toc-width);
  gap: 24px;
  padding: 12px 24px 24px;
  width: min(60vw, 1280px);
  margin: var(--header-height) auto 0;
  align-items: start;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  animation: qd-fade-up 0.55s ease;
}

.sidebar {
  position: relative;
  top: 0;
  align-self: start;
  height: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  background: transparent;
  border: none;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 16px;
}

.nav-title {
  font-weight: 600;
  font-family: var(--font-title);
  margin: 12px 0 6px;
}

.nav-link {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin: 2px 0;
}

.nav-link.active {
  background: color-mix(in srgb, var(--md-primary) 28%, transparent);
  color: var(--md-primary);
  font-weight: 600;
}

.content {
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: none;
  animation: qd-fade-up 0.5s ease;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 120px;
}

.content > * {
  animation: qd-fade-up 0.5s ease;
  animation-fill-mode: both;
}

.content > *:nth-child(2) { animation-delay: 0.03s; }
.content > *:nth-child(3) { animation-delay: 0.06s; }
.content > *:nth-child(4) { animation-delay: 0.09s; }
.content > *:nth-child(5) { animation-delay: 0.12s; }
.content > *:nth-child(6) { animation-delay: 0.15s; }
.content > *:nth-child(7) { animation-delay: 0.18s; }
.content > *:nth-child(8) { animation-delay: 0.21s; }
.content > *:nth-child(9) { animation-delay: 0.24s; }

.page-404 .layout {
  grid-template-columns: 1fr;
}

.page-404 .sidebar,
.page-404 .toc {
  display: none;
}

.page-404 .content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.qd-404 {
  width: 100%;
  display: flex;
  justify-content: center;
}

.qd-404-card {
  width: min(360px, 80vw);
  aspect-ratio: 1 / 1;
  border: 1px solid color-mix(in srgb, var(--md-outline) 70%, transparent);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  animation: qd-fade-up 0.6s ease;
}

.qd-404-card img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}

.qd-404-graphic {
  width: 200px;
  height: 200px;
  color: var(--md-on-surface);
}

.footer {
  width: min(60vw, 1280px);
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  background: transparent;
  z-index: 30;
}

.footer-badge {
  width: 10%;
  min-width: 160px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--md-outline) 60%, transparent);
  background: color-mix(in srgb, var(--md-surface-variant) 40%, transparent);
  font-size: 12px;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.footer-badge img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.footer-badge:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--md-primary) 55%, transparent);
  background: color-mix(in srgb, var(--md-surface-variant) 55%, transparent);
}

.footer-badge:active {
  transform: translateY(0);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  transform: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--md-outline) 60%, transparent);
  background: color-mix(in srgb, var(--md-surface-variant) 80%, transparent);
  display: none;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  z-index: 40;
  max-width: min(360px, 90vw);
}

.toast.show {
  display: inline-flex;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--md-surface-variant) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--md-outline) 50%, transparent);
  border-radius: 12px;
  padding: 6px;
  display: none;
  max-height: 280px;
  overflow-y: auto;
  z-index: 30;
}

.search-results.open {
  display: block;
}

.search-item {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
}

.search-item:hover {
  background: color-mix(in srgb, var(--md-primary) 18%, transparent);
}

.search-item-title {
  font-weight: 600;
}

.search-item-desc {
  font-size: 12px;
  color: color-mix(in srgb, var(--md-on-surface) 70%, transparent);
}

.qd-404-button {
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--md-outline) 70%, transparent);
  background: color-mix(in srgb, var(--md-surface-variant) 60%, transparent);
  color: var(--md-on-surface);
  font-weight: 600;
}

.qd-404-button:hover {
  color: var(--md-primary);
  border-color: color-mix(in srgb, var(--md-primary) 60%, transparent);
}

[data-theme="light"] .qd-404-card {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.65);
}

.content h1, .content h2, .content h3, .content h4 {
  font-family: var(--font-title);
  letter-spacing: 0.02em;
}

.content h1 {
  font-size: 32px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.content h2 {
  font-size: 22px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.content h3 {
  font-size: 18px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.content img,
.qd-image {
  max-width: min(100%, 520px);
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 24px var(--md-shadow);
}

.qd-image-left {
  display: block;
  margin-right: auto;
}

.qd-image-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.qd-image-right {
  display: block;
  margin-left: auto;
}

.content pre {
  background: #1b1a20;
  color: #f5f0ff;
  padding: 42px 18px 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.content code {
  color: inherit;
}

.content :not(pre) > code {
  background: color-mix(in srgb, var(--md-surface-variant) 75%, transparent);
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--md-outline) 65%, transparent);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}

.content th,
.content td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--md-outline) 60%, transparent);
}

.content th {
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 12px;
  color: color-mix(in srgb, var(--md-on-surface) 70%, transparent);
}

.content pre code {
  background: none;
  border: none;
  padding: 0;
}

.toc {
  position: relative;
  top: 0;
  align-self: start;
  padding: 8px 12px;
  height: 100%;
  border-radius: var(--radius-lg);
  border: none;
  background: transparent;
  overflow-y: auto;
}

.toc a {
  display: block;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.toc a.depth-2 { padding-left: 12px; }
.toc a.depth-3 { padding-left: 22px; }
.toc a.depth-4 { padding-left: 32px; }

.qd-warning {
  border: 1px solid color-mix(in srgb, #f4b779 70%, transparent);
  background: color-mix(in srgb, #f4b779 18%, transparent);
  color: var(--md-on-surface);
}


.qd-callout {
  padding: 14px 16px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
  border: 1px solid color-mix(in srgb, var(--md-outline) 60%, transparent);
  margin: 12px 0;
}

.qd-callout:first-child {
  margin-top: 0;
}

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

.qd-callout-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.qd-info {
  background: color-mix(in srgb, #5da8ff 18%, transparent);
}

.qd-tip {
  background: color-mix(in srgb, #60d394 18%, transparent);
}

.qd-danger {
  background: color-mix(in srgb, #ff6b6b 18%, transparent);
}

.qd-note {
  background: color-mix(in srgb, #b5b9ff 18%, transparent);
}

.qd-tabs {
  border: 1px solid var(--md-outline);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: transparent;
}

.qd-tab-list {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--md-surface-variant) 75%, transparent);
}

.qd-tab-button {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--md-on-surface);
  font-size: 13px;
}

.qd-tab-button.active {
  background: var(--md-primary);
  color: var(--md-on-primary);
}

.qd-tab-panel {
  display: none;
  padding: 16px;
  color: var(--md-on-surface);
  background: transparent;
}

.qd-tab-panel.active {
  display: block;
}

.qd-code {
  position: relative;
}

.qd-code .icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  background: color-mix(in srgb, var(--md-primary) 85%, transparent);
  color: var(--md-on-primary);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.qd-dropdown summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--md-outline);
  background: color-mix(in srgb, var(--md-surface-variant) 75%, transparent);
  font-weight: 600;
  font-family: var(--font-title);
  cursor: pointer;
  margin-bottom: 10px;
}

.qd-dropdown-body {
  margin-top: 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--md-surface-variant) 45%, transparent);
  border: 1px solid color-mix(in srgb, var(--md-outline) 50%, transparent);
  display: block;
}

.qd-dropdown summary::marker,
.qd-dropdown summary::-webkit-details-marker {
  display: none;
}

.qd-dropdown summary::after {
  content: "expand_more";
  font-family: "Material Symbols Rounded";
  font-size: 20px;
}

.qd-dropdown[open] summary::after {
  content: "expand_less";
}

.qd-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--md-outline);
  background: color-mix(in srgb, var(--md-surface-variant) 75%, transparent);
  color: var(--md-on-surface);
  font-weight: 600;
  font-family: var(--font-title);
  text-decoration: none;
}

.qd-button:hover {
  color: var(--md-primary);
  border-color: color-mix(in srgb, var(--md-primary) 60%, transparent);
}

.qd-button-left {
  display: flex;
  width: fit-content;
  margin-right: auto;
}

.qd-button-center {
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.qd-button-right {
  display: flex;
  width: fit-content;
  margin-left: auto;
}

.mobile-toggle {
  display: none;
  border-radius: 999px;
}

.theme-toggle:active,
.mobile-toggle:active {
  transform: none;
}

@keyframes rise {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }
  header {
    grid-template-columns: 1fr;
    gap: 12px;
    height: auto;
    padding: 16px 24px;
    width: min(100%, 840px);
    border-radius: var(--radius-lg);
    position: fixed;
  }

  header .search {
    order: 3;
  }

  .layout {
    grid-template-columns: 1fr;
    width: min(100%, 840px);
    height: auto;
    overflow: visible;
    margin-top: 140px;
  }

  .footer {
    position: static;
    transform: none;
    margin: 16px auto 24px;
    width: min(100%, 720px);
  }

  .lang-toggle {
    order: 4;
  }

  .search-box {
    width: min(100%, 520px);
  }

  .toc {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: -320px;
    top: 0;
    height: 100vh;
    z-index: 30;
    width: var(--sidebar-width);
    transition: left 0.25s ease;
  }

  .sidebar.open {
    left: 12px;
  }

  .mobile-toggle {
    display: inline-flex;
  }
}
.icon-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  display: block;
}
