:root {
  color-scheme: light;
  --bg: #f5f8fc;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --text: #172033;
  --heading: #0f172a;
  --muted: #64748b;
  --muted-2: #7a879b;
  --soft: #f2f7ff;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.14);
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, 0.09);
  --orange: #ff7a1a;
  --shadow: 0 26px 72px rgba(15, 23, 42, 0.10);
  --radius: 28px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Sometype Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 7%, rgba(37, 99, 235, 0.10), transparent 34%),
    radial-gradient(circle at 92% 12%, rgba(255, 122, 26, 0.075), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
  font-family: var(--font-sans);
}

::selection {
  color: #0f172a;
  background: rgba(37, 99, 235, 0.16);
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 650;
  text-decoration: none;
}

.skip-link:focus { transform: translateY(0); }

.wiki-header {
  position: sticky;
  top: 16px;
  z-index: 20;
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.wiki-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.wiki-brand span {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 15px;
  background: linear-gradient(135deg, #173f9e, #2563eb);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.20);
}

.wiki-brand img { width: 100%; height: 100%; object-fit: cover; }

.wiki-brand strong {
  display: grid;
  gap: 2px;
  color: var(--heading);
  font-size: 0.97rem;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.wiki-brand small {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

.wiki-header nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiki-header nav a,
.doc-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #334155;
  background: rgba(255, 255, 255, 0.68);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 610;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.wiki-header nav a:hover,
.doc-actions a:hover {
  transform: translateY(-2px);
  color: var(--heading);
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.10);
}

.wiki-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 76px;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.wiki-sidebar {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.07);
  backdrop-filter: blur(18px);
}

.sidebar-kicker {
  margin: 2px 4px 8px;
  color: var(--muted-2);
  font-size: 0.73rem;
  font-weight: 760;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.wiki-sidebar a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: #334155;
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 590;
  line-height: 1.25;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.wiki-sidebar a:hover,
.wiki-sidebar a.is-active {
  color: var(--heading);
  background: var(--blue-soft);
  border-color: rgba(37, 99, 235, 0.12);
  transform: translateX(2px);
}

.wiki-sidebar hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 8px 0;
}

.wiki-document-frame {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 34px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.doc-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 25px clamp(22px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.045), transparent 44%),
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(255, 255, 255, 0.90));
}

.doc-eyebrow {
  color: var(--orange);
  font-size: 0.735rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.doc-toolbar h1 {
  margin: 7px 0 0;
  color: var(--heading);
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
  font-weight: 760;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.markdown-body {
  max-width: 880px;
  min-height: 520px;
  margin-inline: auto;
  padding: 42px clamp(26px, 5vw, 66px) 66px;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.78;
  letter-spacing: -0.006em;
}

.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--heading);
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-weight: 740;
}

.markdown-body h1 {
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #dbe3ef;
  font-size: clamp(2.05rem, 4vw, 3.05rem);
}

.markdown-body h2 {
  margin: 46px 0 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e6ecf5;
  font-size: clamp(1.42rem, 2.2vw, 1.95rem);
}

.markdown-body h3 {
  margin: 34px 0 10px;
  font-size: 1.24rem;
}

.markdown-body h4 {
  margin: 26px 0 8px;
  font-size: 1.06rem;
}

.markdown-body p,
.markdown-body li {
  color: #334155;
}

.markdown-body p {
  margin: 12px 0 18px;
}

.markdown-body a {
  color: var(--blue);
  font-weight: 650;
  text-decoration: none;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.markdown-body a:hover { text-decoration: underline; }

.markdown-body strong { color: var(--heading); font-weight: 720; }
.markdown-body em { color: #475569; }

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5rem;
  margin: 12px 0 22px;
}

.markdown-body li + li { margin-top: 7px; }

.markdown-body li::marker {
  color: #57708f;
  font-weight: 700;
}

.markdown-body blockquote {
  margin: 24px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--blue);
  border-radius: 0 19px 19px 0;
  background: #f6f9ff;
  color: #475569;
}

.markdown-body blockquote p {
  margin: 0;
  color: #475569;
}

.markdown-body code,
.markdown-body kbd,
.markdown-body samp {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.markdown-body code {
  padding: 0.16em 0.38em;
  border: 1px solid rgba(37, 99, 235, 0.10);
  border-radius: 7px;
  color: #0f172a;
  background: #eef4ff;
  font-size: 0.88em;
  font-weight: 550;
}

.markdown-body pre {
  overflow: auto;
  margin: 25px 0;
  padding: 20px 22px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 20px;
  background: linear-gradient(180deg, #101827, #0b1220);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 18px 44px rgba(15, 23, 42, 0.12);
}

.markdown-body pre code {
  display: block;
  padding: 0;
  border: 0;
  color: #e6edf7;
  background: transparent;
  font-size: 0.91rem;
  font-weight: 480;
  line-height: 1.72;
  white-space: pre;
}

.markdown-body table {
  width: 100%;
  margin: 25px 0;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #dce4ef;
  border-radius: 18px;
  display: block;
  overflow-x: auto;
  background: #fff;
}

.markdown-body thead { background: #f3f7fd; }
.markdown-body th,
.markdown-body td {
  padding: 12px 14px;
  border-bottom: 1px solid #dce4ef;
  text-align: left;
  vertical-align: top;
}

.markdown-body th + th,
.markdown-body td + td { border-left: 1px solid #dce4ef; }
.markdown-body tr:last-child td { border-bottom: 0; }

.markdown-body th {
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 720;
  letter-spacing: 0.015em;
}

.markdown-body td {
  color: #3a4a60;
  font-size: 0.95rem;
  line-height: 1.58;
}

.markdown-body td code,
.markdown-body th code {
  white-space: nowrap;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 18px;
  border: 1px solid #dce4ef;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid #dce4ef;
  margin: 38px 0;
}

.markdown-body .task-list-item {
  list-style: none;
  margin-left: -1.2rem;
}

.markdown-body input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0 8px 0 0;
  accent-color: var(--blue);
  vertical-align: text-bottom;
}

.loading-card,
.error-card {
  min-height: 280px;
  display: grid;
  place-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}

.loading-card p,
.error-card p {
  color: var(--muted);
  font-weight: 540;
}

.loading-card span {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 4px solid #dbe8ff;
  border-top-color: var(--blue);
  animation: spin 0.9s linear infinite;
}

.error-card {
  padding: 34px;
  border: 1px solid rgba(255, 122, 26, 0.22);
  border-radius: 22px;
  background: rgba(255, 248, 240, 0.9);
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 920px) {
  .wiki-shell { grid-template-columns: 1fr; }
  .wiki-sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-kicker,
  .wiki-sidebar hr { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .wiki-header,
  .doc-toolbar { flex-direction: column; align-items: stretch; }
  .wiki-header nav,
  .doc-actions { justify-content: flex-start; }
  .wiki-sidebar { grid-template-columns: 1fr; }
  .markdown-body {
    padding: 30px 20px 48px;
    font-size: 16px;
    line-height: 1.72;
  }
  .markdown-body pre { padding: 17px; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
