:root {
  --bg: #ffffff;
  --panel: #fafafa;
  --text: #25272b;
  --muted: #6b7280;
  --line: #e6e7eb;
  --accent: #7c3aed;
  --accent2: #a855f7;
  --soft: #f5f3ff;
  --header: rgba(255, 255, 255, 0.92);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #111218;
  --panel: #17181f;
  --text: #f2f2f5;
  --muted: #a1a1aa;
  --line: #292b35;
  --soft: #231d33;
  --header: rgba(17, 18, 24, 0.92);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
article:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  height: 72px;
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--header);
  backdrop-filter: blur(14px);
  padding: 0 28px;
}

.brand {
  width: 268px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand b {
  font-size: 18px;
  letter-spacing: 3px;
}

.brand small {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-top: 6px;
}

.vortex-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font: 900 21px Georgia, serif;
  background: linear-gradient(145deg, var(--accent2), #4c1d95);
  box-shadow: 0 8px 20px #7c3aed40;
}

.top-search {
  position: relative;
  max-width: 500px;
  flex: 1;
}

.top-search > span {
  position: absolute;
  left: 14px;
  top: 7px;
  font-size: 24px;
  color: var(--muted);
  pointer-events: none;
}

input {
  outline: none;
}

.top-search input,
.aside-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  padding: 11px 80px 11px 42px;
  font-size: 14px;
}

.top-search input:focus,
.aside-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #7c3aed1a;
}

.top-search kbd {
  position: absolute;
  right: 9px;
  top: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 9px;
}

.results {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  max-height: min(480px, calc(100vh - 100px));
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px;
  box-shadow: 0 18px 50px #0002;
}

.results[hidden] {
  display: none;
}

.results a {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.results a:hover,
.results a:focus-visible {
  background: var(--soft);
}

.results small {
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

.results p {
  padding: 8px 12px;
  color: var(--muted);
  margin: 0;
}

.top-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding-left: 24px;
}

.top-links a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.top-links a:hover {
  color: var(--accent);
}

.top-links button,
.mobile-menu {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.mobile-menu {
  display: none;
  margin-right: 10px;
}

#sidebar {
  position: fixed;
  z-index: 30;
  top: 72px;
  bottom: 0;
  left: 0;
  width: 286px;
  padding: 24px 20px 50px 28px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  overflow: auto;
}

.aside-search {
  display: none;
}

#guide-navigation section {
  margin-bottom: 26px;
}

#guide-navigation h2 {
  margin: 0 0 8px;
  padding-left: 10px;
  font-size: 10px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 1.5px;
}

#guide-navigation a {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
  padding: 8px 10px;
  text-decoration: none;
}

#guide-navigation a:hover {
  background: var(--panel);
  color: var(--text);
}

#guide-navigation a.active {
  background: var(--soft);
  color: var(--accent);
  font-weight: 650;
}

#guide-navigation em {
  font-style: normal;
  font-size: 9px;
  border-radius: 20px;
  padding: 3px 7px;
  background: var(--accent);
  color: #fff;
}

#sidebar footer {
  border-top: 1px solid var(--line);
  padding: 22px 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

#main-content {
  margin-left: 286px;
  padding-top: 72px;
  display: grid;
  grid-template-columns: minmax(0, 760px) 190px;
  gap: 66px;
  justify-content: center;
}

#article {
  padding: 62px 32px 80px;
  min-width: 0;
  outline: none;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 1.1px;
  color: var(--accent);
  font-weight: 700;
}

.breadcrumbs span:nth-child(2) {
  color: var(--muted);
}

h1 {
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: -1.6px;
  margin: 18px 0 14px;
}

.lead {
  font-size: 18px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
  max-width: 720px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 34px 0;
}

.notice {
  border-radius: 9px;
  padding: 18px 20px;
  margin: 0 0 32px;
  font-size: 14px;
  line-height: 1.7;
}

.notice.success {
  border: 1px solid #22c55e45;
  background: #22c55e12;
}

.notice.info {
  border: 1px solid #8b5cf645;
  background: #8b5cf612;
}

.notice b {
  font-size: 14px;
}

#page-content h2 {
  font-size: 25px;
  letter-spacing: -0.5px;
  margin: 38px 0 14px;
  scroll-margin-top: 92px;
}

#page-content p,
#page-content li {
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--muted);
}

#page-content ul {
  padding-left: 21px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  margin: 22px 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 440px;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

tr:last-child th,
tr:last-child td {
  border-bottom: 0;
}

th {
  width: 34%;
  background: var(--panel);
}

td {
  color: var(--muted);
}

.drop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drop {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 13px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.drop span {
  display: grid;
  place-items: center;
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: bold;
}

.page-nav {
  border-top: 1px solid var(--line);
  margin-top: 52px;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.page-nav a {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 12px 15px;
  text-align: left;
  text-decoration: none;
  max-width: 47%;
  font-weight: 600;
}

.page-nav a:hover {
  border-color: var(--accent);
}

.page-nav .next {
  text-align: right;
  margin-left: auto;
}

.page-nav small {
  display: block;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.updated {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  margin-top: 32px;
}

.toc {
  position: sticky;
  top: 118px;
  height: max-content;
  margin-top: 62px;
  padding-left: 20px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.toc b {
  display: block;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--text);
  margin-bottom: 13px;
}

.toc nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toc a {
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent);
}

.toc-help {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  line-height: 1.7;
}

.toc-help a {
  color: var(--accent);
}

.backdrop {
  display: none;
}

.mobile-results {
  margin-top: 10px;
}

.mobile-results a,
.mobile-results p {
  display: block;
  color: var(--muted);
  padding: 8px 4px;
  margin: 0;
  font-size: 13px;
  text-decoration: none;
}

.noscript {
  position: fixed;
  z-index: 100;
  inset: auto 20px 20px;
  max-width: 680px;
  margin: auto;
  padding: 14px 18px;
  border-radius: 10px;
  background: #7c3aed;
  color: #fff;
  text-align: center;
}

@media (max-width: 1050px) {
  #main-content {
    grid-template-columns: minmax(0, 760px);
  }

  .toc {
    display: none;
  }

  .top-links a {
    display: none;
  }
}

@media (max-width: 760px) {
  .site-header {
    height: 62px;
    padding: 0 14px;
  }

  .mobile-menu {
    display: block;
  }

  .brand {
    width: auto;
  }

  .brand small {
    display: none;
  }

  .brand b {
    font-size: 15px;
  }

  .vortex-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .top-search {
    display: none;
  }

  .top-links {
    padding-left: 0;
  }

  .top-links a {
    display: none;
  }

  #sidebar {
    top: 62px;
    width: min(285px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: 20px 0 50px #0003;
    padding-top: 16px;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .aside-search {
    display: block;
    margin-bottom: 22px;
  }

  .aside-search input {
    padding: 11px;
  }

  #main-content {
    margin-left: 0;
    padding-top: 62px;
    display: block;
  }

  .backdrop:not([hidden]) {
    display: block;
    position: fixed;
    z-index: 20;
    inset: 62px 0 0;
    background: #0007;
  }

  #article {
    padding: 40px 22px 60px;
  }

  h1 {
    font-size: 34px;
  }

  .lead {
    font-size: 16px;
  }

  .drop-grid {
    grid-template-columns: 1fr;
  }

  .page-nav a {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #sidebar {
    transition: none;
  }
}
