:root {
  color-scheme: light;
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-muted: #f5f4ef;
  --surface-active: #efede5;
  --text: #2a2925;
  --text-strong: #141413;
  --muted: #5e5d59;
  --muted-soft: #8f8d87;
  --line: #e8e6dc;
  --line-strong: #d9d6c8;
  --accent: #d97757;
  --accent-dark: #c25f3f;
  --accent-soft: rgba(217, 119, 87, 0.1);
  --accent-soft-strong: rgba(217, 119, 87, 0.18);
  --info: #4a7fb8;
  --info-soft: rgba(74, 127, 184, 0.1);
  --success: #5a8a4a;
  --success-soft: rgba(90, 138, 74, 0.1);
  --warn: #b08a2a;
  --warn-soft: rgba(176, 138, 42, 0.12);
  --danger: #b45309;
  --code-bg: #1f1e1d;
  --code-bg-soft: #262624;
  --code-text: #f0eee6;
  --code-muted: #91908a;
  --shadow-sm: 0 1px 2px rgba(20, 20, 19, 0.05);
  --shadow-md: 0 6px 18px rgba(20, 20, 19, 0.08);
  --shadow-lg: 0 18px 44px rgba(20, 20, 19, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --sidebar-width: 296px;
  --toc-width: 224px;
  --content-width: 760px;
  --page-width: 1380px;
  --topbar-height: 56px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font-sans:
    "Anthropic Sans", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-mono:
    "JetBrains Mono", "SF Mono", "Cascadia Code", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1e1d;
  --surface: #262624;
  --surface-muted: #2e2d2a;
  --surface-active: #3a3835;
  --text: #d8d6cd;
  --text-strong: #f0eee6;
  --muted: #a09e96;
  --muted-soft: #73716b;
  --line: #3a3835;
  --line-strong: #4a4844;
  --accent: #e08e6f;
  --accent-dark: #ec9d80;
  --accent-soft: rgba(224, 142, 111, 0.14);
  --accent-soft-strong: rgba(224, 142, 111, 0.22);
  --info: #7aa7d8;
  --info-soft: rgba(122, 167, 216, 0.14);
  --success: #91b87f;
  --success-soft: rgba(145, 184, 127, 0.14);
  --warn: #d4ae5e;
  --warn-soft: rgba(212, 174, 94, 0.16);
  --danger: #e89855;
  --code-bg: #16161a;
  --code-bg-soft: #1d1d20;
  --code-text: #ebe9e1;
  --code-muted: #8c8b85;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
}

a {
  color: var(--accent-dark);
  text-decoration: none;
  transition: color 120ms var(--ease);
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input,
textarea,
select {
  font: inherit;
}

::selection {
  background: var(--accent-soft-strong);
  color: var(--text-strong);
}

/* Custom scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--muted-soft);
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  max-width: var(--page-width);
  margin: 0 auto;
  background: var(--bg);
}

@media (min-width: 1440px) {
  body {
    background: color-mix(in srgb, var(--bg) 70%, var(--surface-muted));
  }
  .shell {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg);
  padding: 0;
}

.sidebar-inner {
  flex: 1;
  overflow: auto;
  padding: 14px 14px 24px;
  scrollbar-gutter: stable;
}

.brand {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.brand-meta {
  min-width: 0;
}

.brand strong {
  display: block;
  color: var(--text-strong);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo-card {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 8px 2px 14px;
  padding: 8px 10px;
  transition: border-color 140ms var(--ease), background 140ms var(--ease), color 140ms var(--ease);
  text-decoration: none;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo-card::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  background: currentColor;
  clip-path: path("M7 .7a6.3 6.3 0 0 0-2 12.27c.31.06.43-.13.43-.3v-1.1c-1.76.38-2.13-.75-2.13-.75-.29-.73-.7-.92-.7-.92-.57-.39.04-.38.04-.38.63.04.96.65.96.65.56.95 1.47.68 1.83.52.06-.4.22-.68.4-.84-1.4-.16-2.87-.7-2.87-3.13 0-.69.25-1.25.65-1.69-.07-.16-.28-.8.06-1.67 0 0 .53-.17 1.73.64A5.96 5.96 0 0 1 7 3.8c.54 0 1.08.07 1.59.21 1.2-.81 1.73-.64 1.73-.64.34.87.13 1.51.06 1.67.4.44.65 1 .65 1.69 0 2.44-1.48 2.97-2.89 3.13.23.2.43.58.43 1.16v1.72c0 .17.12.36.44.3A6.3 6.3 0 0 0 7 .7Z");
}

.repo-card:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  text-decoration: none;
}

.doc-nav {
  display: grid;
  gap: 2px;
}

.nav-group {
  border-radius: var(--radius-sm);
}

.nav-item,
.section-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 100ms var(--ease), color 100ms var(--ease);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  letter-spacing: -0.005em;
}

.nav-chev {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  display: inline-block;
  position: relative;
  opacity: 0.5;
  transition: transform 140ms var(--ease), opacity 100ms var(--ease);
}

.nav-chev::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 5px;
  height: 5px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  transform-origin: 60% 40%;
}

.nav-group.open .nav-chev {
  transform: rotate(90deg);
  opacity: 0.85;
}

.nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: var(--surface-muted);
  color: var(--text-strong);
}

.nav-item:hover .nav-chev,
.nav-group.open .nav-item .nav-chev {
  opacity: 1;
}

.nav-item.active {
  color: var(--accent-dark);
}

.section-list {
  display: none;
  margin: 1px 0 4px 18px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.nav-group.open .section-list {
  display: grid;
}

.section-item {
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  padding: 6px 9px;
  position: relative;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.section-item:hover {
  color: var(--text-strong);
  background: var(--surface-muted);
}

.section-item.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 500;
}

.section-item.active::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 10px;
  width: 2px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

.section-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  padding: 0 32px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  transition: border-color 120ms var(--ease), background 120ms var(--ease);
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.theme-button {
  flex: 0 0 auto;
  font-size: 16px;
}

.menu-button {
  display: none;
  place-items: center;
  gap: 4px;
  padding: 9px;
}

.menu-button span {
  display: block;
  width: 17px;
  height: 2px;
  background: var(--text);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 220px;
  max-width: 560px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.search input::placeholder {
  color: var(--muted-soft);
}

.search kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.top-link,
.primary-button,
.secondary-button {
  align-items: center;
  border-radius: var(--radius);
  display: inline-flex;
  min-height: 38px;
  justify-content: center;
  padding: 8px 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), transform 60ms var(--ease);
}

.top-link,
.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.top-link:hover,
.primary-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  text-decoration: none;
}

.primary-button:active,
.top-link:active {
  transform: translateY(1px);
}

:root[data-theme="dark"] .top-link,
:root[data-theme="dark"] .primary-button {
  color: #16161a;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-strong);
}

.secondary-button:hover {
  border-color: var(--accent);
  background: var(--surface-muted);
  text-decoration: none;
}

.top-github {
  flex: 0 0 auto;
}

.top-github::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 7px;
  background: currentColor;
  clip-path: path("M7 .7a6.3 6.3 0 0 0-2 12.27c.31.06.43-.13.43-.3v-1.1c-1.76.38-2.13-.75-2.13-.75-.29-.73-.7-.92-.7-.92-.57-.39.04-.38.04-.38.63.04.96.65.96.65.56.95 1.47.68 1.83.52.06-.4.22-.68.4-.84-1.4-.16-2.87-.7-2.87-3.13 0-.69.25-1.25.65-1.69-.07-.16-.28-.8.06-1.67 0 0 .53-.17 1.73.64A5.96 5.96 0 0 1 7 3.8c.54 0 1.08.07 1.59.21 1.2-.81 1.73-.64 1.73-.64.34.87.13 1.51.06 1.67.4.44.65 1 .65 1.69 0 2.44-1.48 2.97-2.89 3.13.23.2.43.58.43 1.16v1.72c0 .17.12.36.44.3A6.3 6.3 0 0 0 7 .7Z");
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  transition: color 120ms var(--ease);
}

.text-button:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--content-width)) var(--toc-width);
  gap: 56px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.document {
  min-width: 0;
}

.doc-meta {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.breadcrumb {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb-doc {
  color: var(--muted);
}

.breadcrumb-sep {
  color: var(--muted-soft);
}

.breadcrumb-section {
  color: var(--text-strong);
  font-weight: 500;
}

.section-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  align-items: center;
}

.progress-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.section-progress code {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
}

.doc-meta h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(28px, 2.6vw, 36px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.022em;
}

.doc-meta p {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.6;
}

.article-content {
  min-width: 0;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  color: var(--text-strong);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  scroll-margin-top: calc(var(--topbar-height) + 24px);
}

.article-content h1 {
  margin: 0 0 24px;
  font-size: clamp(26px, 2.6vw, 32px);
  letter-spacing: -0.018em;
}

.article-content h2 {
  margin: 48px 0 16px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 22px;
}

.article-content h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.article-content h3 {
  margin: 36px 0 12px;
  font-size: 18px;
}

.article-content h4 {
  margin: 28px 0 10px;
  font-size: 15.5px;
  letter-spacing: -0.005em;
}

.article-content p,
.article-content li {
  font-size: 15.5px;
  line-height: 1.78;
}

.article-content p {
  margin: 14px 0;
}

.article-content ul,
.article-content ol {
  padding-left: 24px;
}

.article-content ul li {
  list-style: none;
  position: relative;
}

.article-content ul li::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0.7em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.article-content ol {
  counter-reset: list;
}

.article-content ol li {
  list-style: none;
  counter-increment: list;
  position: relative;
}

.article-content ol li::before {
  content: counter(list);
  position: absolute;
  left: -28px;
  top: 0;
  width: 20px;
  height: 20px;
  margin-top: 0.25em;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.article-content li + li {
  margin-top: 6px;
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 22px 0;
  padding: 14px 18px;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}

.article-content blockquote p {
  margin: 6px 0;
}

.article-content blockquote p:first-child {
  margin-top: 0;
}

.article-content blockquote p:last-child {
  margin-bottom: 0;
}

.article-content code {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-strong);
  padding: 1.5px 6px;
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-weight: 500;
}

.article-content a code {
  color: var(--accent-dark);
}

.article-content strong {
  color: var(--text-strong);
  font-weight: 650;
}

/* Code block */
.code-block {
  position: relative;
  margin: 22px 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.code-block::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 18px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.7;
}

.article-content .code-block pre {
  margin: 0;
}

.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(240, 238, 230, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(240, 238, 230, 0.08);
  color: var(--code-text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  min-height: 28px;
  padding: 6px 10px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease), background 140ms var(--ease), border-color 140ms var(--ease);
}

.code-block:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.code-copy:hover {
  border-color: rgba(240, 238, 230, 0.32);
  background: rgba(240, 238, 230, 0.16);
}

.code-copy.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  opacity: 1;
}

.code-copy:disabled {
  cursor: default;
}

.article-content pre {
  overflow: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 0;
  padding: 18px 60px 18px 36px;
  line-height: 1.65;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-feature-settings: "calt", "ss01";
}

.article-content pre code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Callouts derived from "**Why this works**" / "**Make it stick**" / "**Needs**" */
.callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 16px 0;
  padding: 12px 16px 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.callout-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin-top: 1px;
}

.callout-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text);
}

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

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

.callout.info {
  border-left-color: var(--info);
}

.callout.info .callout-label {
  background: var(--info-soft);
  color: var(--info);
}

.callout.success {
  border-left-color: var(--success);
}

.callout.success .callout-label {
  background: var(--success-soft);
  color: var(--success);
}

.callout.warn {
  border-left-color: var(--warn);
}

.callout.warn .callout-label {
  background: var(--warn-soft);
  color: var(--warn);
}

/* Start-N chip in headings */
.article-content .start-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
}

.article-content table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  width: 100%;
  margin: 22px 0;
  font-size: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.article-content th,
.article-content td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 10px 13px;
  text-align: left;
  vertical-align: top;
}

.article-content th:last-child,
.article-content td:last-child {
  border-right: 0;
}

.article-content tr:last-child td {
  border-bottom: 0;
}

.article-content th {
  background: var(--surface-muted);
  color: var(--text-strong);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.article-content tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-muted) 50%, transparent);
}

.article-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 36px 0;
}

.section-pager {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 48px;
  padding-top: 26px;
}

.pager-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  min-height: 76px;
  padding: 14px 16px;
  text-align: left;
  transition: border-color 140ms var(--ease), background 140ms var(--ease), transform 80ms var(--ease);
}

.pager-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.pager-card.next {
  text-align: right;
}

.pager-card span {
  color: var(--muted);
  display: block;
  font-size: 11.5px;
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.pager-card strong {
  display: block;
  color: var(--text-strong);
  font-weight: 600;
  line-height: 1.4;
}

.toc {
  position: sticky;
  top: calc(var(--topbar-height) + 28px);
  align-self: start;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  max-height: calc(100vh - var(--topbar-height) - 56px);
  overflow: auto;
}

.toc-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.toc button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 5px 0;
  text-align: left;
  text-decoration: none;
  position: relative;
  transition: color 120ms var(--ease);
}

.toc button:hover {
  color: var(--text-strong);
}

.toc .toc-h3 {
  padding-left: 14px;
  font-size: 12px;
}

.toc button.active {
  color: var(--accent-dark);
  font-weight: 600;
}

.toc button.active::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 10px);
  z-index: 35;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: min(560px, calc(100vh - 92px));
  overflow: auto;
  padding: 8px;
  animation: dropdown-in 140ms var(--ease);
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-results-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  justify-content: space-between;
  margin: 0 4px 4px;
  padding: 6px 4px 10px;
}

.search-results-head strong {
  background: var(--accent-soft);
  border: 0;
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
  min-width: 24px;
  padding: 2px 8px;
  text-align: center;
  letter-spacing: 0;
}

.result-item {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 11px 12px;
  transition: background 100ms var(--ease), border-color 100ms var(--ease);
}

.result-item:hover,
.result-item.focused {
  background: var(--surface-muted);
  border-color: var(--line);
}

.result-item.focused {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.result-item strong {
  color: var(--text-strong);
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.result-source {
  color: var(--muted-soft);
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.result-item p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  margin: 6px 0 0;
}

.result-item mark {
  background: var(--accent-soft-strong);
  border-radius: 3px;
  color: var(--text-strong);
  font-weight: 500;
  padding: 0 3px;
}

.search-empty {
  display: grid;
  gap: 6px;
  padding: 20px 14px;
  text-align: center;
}

.search-empty strong {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
}

.search-empty span {
  color: var(--muted);
  font-size: 12.5px;
}

.feedback {
  border-top: 1px solid var(--line);
  margin-top: 52px;
  padding-top: 28px;
  max-width: 100%;
}

.feedback-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.comments-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 4px;
}

.feedback h2 {
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.012em;
}

.feedback-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 0;
}

.feedback h3 {
  color: var(--text-strong);
  font-size: 15.5px;
  font-weight: 600;
  margin: 0;
}

.feedback-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.feedback-main {
  min-width: 0;
}

.feedback-form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.feedback-row {
  align-items: end;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 16px;
}

.feedback-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  padding-bottom: 10px;
}

.feedback-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.feedback-form select,
.feedback-form input,
.feedback-form textarea {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  resize: vertical;
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}

.feedback-form select:focus,
.feedback-form input:focus,
.feedback-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.feedback-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.feedback-actions > * {
  flex: 0 1 auto;
}

.issue-list {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.issue-list-body {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.issue-item {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 13px 14px;
  display: grid;
  gap: 4px;
  text-decoration: none;
  transition: border-color 120ms var(--ease), background 120ms var(--ease), transform 80ms var(--ease);
}

.issue-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  transform: translateY(-1px);
}

.issue-item span {
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.issue-item strong {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.empty {
  color: var(--muted);
  margin: 0;
  font-size: 13.5px;
}

.feedback-footnote {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 16px -16px -16px;
  padding: 12px 16px;
  background: var(--surface-muted);
  border-radius: 0 0 var(--radius) var(--radius);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(120px);
  opacity: 0;
  transition: transform 200ms var(--ease), opacity 200ms var(--ease);
  background: var(--text-strong);
  color: var(--bg);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    width: var(--sidebar-width);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 20px 60px rgba(17, 24, 39, 0.18);
  }

  .menu-button {
    display: grid;
  }

  .content-grid {
    grid-template-columns: minmax(0, var(--content-width));
    justify-content: center;
  }

  .toc {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0 0;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .topbar {
    height: auto;
    padding: 10px;
  }

  .topbar-inner {
    width: 100%;
    gap: 8px;
  }

  .top-link {
    display: none;
  }

  .top-github {
    display: none;
  }

  .theme-button {
    width: 40px;
  }

  .search {
    min-width: 0;
  }

  .search-results {
    left: -48px;
    right: -48px;
    max-height: calc(100vh - 78px);
  }

  .content-grid {
    padding: 22px 16px 54px;
  }

  .doc-meta h1 {
    font-size: 30px;
  }

  .section-pager,
  .feedback-heading,
  .feedback-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .feedback-heading .secondary-button {
    width: 100%;
  }

  .feedback-note {
    padding-bottom: 0;
  }
}
