:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #111111;
  --muted: #666666;
  --line: #e5e7eb;
  --hover: #f3f4f6;
  --accent: #111111;
  --main3: #FF8A3D;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
}
.site-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  justify-content: flex-start;
  gap: 80px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 32px; height: 32px; object-fit: contain; }
.brand-name { font-size: 18px; font-weight: 600; color: #0f172a; }
.top-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.top-nav a {
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 8px 0;
  transition: color 0.2s;
}
.top-nav a:hover { color: #0f172a; }
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 240px;
  gap: 0;
  min-height: calc(100vh - 64px);
}
.sidebar {
  border-right: 1px solid var(--line);
  padding: 16px 16px 24px;
  background: #fafafa;
}
.nav-group { margin-bottom: 8px; }
.nav-title {
  width: 100%;
  background: none;
  border: none;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
  color: #1f2937;
  font-size: 14px;
}
.nav-title:hover { background: var(--hover); }
.nav-title-level-1 {
  font-weight: 600;
}
.nav-title-level-2 {
  font-weight: 500;
  padding-left: 24px;
}
.nav-title-level-3 {
  font-weight: 400;
  padding-left: 38px;
}
.nav-title-text { line-height: 1.4; }
.nav-arrow {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #9ca3af;
  border-bottom: 1.5px solid #9ca3af;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.nav-title[aria-expanded="true"] .nav-arrow {
  transform: rotate(45deg);
}
.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
}
.nav-list.expanded { display: block; }
.nav-item a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}
.nav-item-level-1 a { padding-left: 10px; font-weight: 500; }
.nav-item-level-2 a { padding-left: 24px; font-weight: 400; }
.nav-item-level-3 a {
  position: relative;
  padding-left: 38px;
  font-weight: 400;
}
.nav-item-level-3 a::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #9ca3af;
  transform: translateY(-50%);
}
.nav-item a:hover { background: var(--hover); color: #111111; }
.nav-item.active a {
  background: #f3f4f6;
  color: var(--main3);
  font-weight: 600;
}
.nav-item.active a::before {
  background: var(--main3);
}
.content {
  padding: 24px 32px;
}
.toc {
  border-left: 2px solid #e5e7eb;
  padding: 24px 0 24px 0;
  background: transparent;
  position: sticky;
  top: 72px;
  align-self: start;
  overflow: auto;
}
.toc-title {
  font-size: 16px;
  font-weight: 700;
  color: #111111;
  margin: 0 0 16px 0;
  padding-left: 20px;
}
.toc-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.toc-item {
  color: #666666;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.6;
  padding: 4px 0 4px 18px;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: all 0.2s ease;
  display: block;
}
.toc-item.h1 {
  font-size: 14px;
  font-weight: 600;
  color: #333333;
  padding-left: 18px;
}
.toc-item.h2 {
  padding-left: 30px;
  font-size: 13px;
}
.toc-item.h3 {
  padding-left: 42px;
  font-size: 12.5px;
}
.toc-item:hover {
  color: #111111;
  border-left-color: #d1d5db;
}
.toc-item.active {
  color: var(--main3);
  border-left-color: var(--main3);
  background: linear-gradient(to right, #f8fafc, transparent);
  font-weight: 500;
}
.article-body {
  max-width: 960px;
  color: #1f2937;
}
.article-title {
  font-size: 32px;
  margin: 0 0 24px 0;
  color: var(--main3);
  font-weight: 700;
  line-height: 1.25;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.article-body h1 {
  font-size: 24px;
  margin: 26px 0 12px;
  color: #0f172a;
  font-weight: 700;
  scroll-margin-top: 76px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.article-body h2 {
  font-size: 22px;
  margin: 32px 0 14px;
  color: #0f172a;
  font-weight: 700;
  line-height: 1.45;
  scroll-margin-top: 76px;
}
.article-body h3 {
  font-size: 18px;
  margin: 18px 0 10px;
  color: #374151;
  font-weight: 600;
  line-height: 1.5;
  scroll-margin-top: 76px;
}
.article-body p,
.article-body span {
  line-height: 1.9;
  font-size: 16px;
  color: #4b5563;
}
.article-body p {
  margin: 0 0 16px 0;
}
.article-body strong {
  color: #374151;
  font-weight: 600;
}
.article-body em {
  color: #4b5563;
}
.article-body a {
  color: var(--main3);
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.28);
  text-underline-offset: 3px;
}
.article-body a:hover {
  text-decoration-color: currentColor;
}
.article-body ul,
.article-body ol {
  padding-left: 24px;
  margin: 10px 0 18px;
}
.article-body li {
  margin: 6px 0;
  line-height: 1.8;
  color: #4b5563;
}
.article-body blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 3px solid #dbeafe;
  background: #f8fafc;
  color: #4b5563;
  border-radius: 8px;
}
.article-body code {
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 14px;
  color: #334155;
}
.article-body pre {
  background: #0b1220;
  color: #e5e7eb;
  padding: 16px;
  border-radius: 10px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.7;
}
.article-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}
.article-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 16px 0;
  border-radius: 10px;
}
.article-body img.zoomable-image {
  cursor: zoom-in;
}
.image-zoom-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 9999;
  cursor: zoom-out;
}
.image-zoom-overlay.visible {
  opacity: 1;
  visibility: visible;
}
.image-zoom-preview {
  max-width: min(92vw, 1400px);
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  object-fit: contain;
}
.article-body video,
.article-body iframe {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  margin: 12px 0;
}
.article-body .table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0;
}
.article-body table {
  border-collapse: collapse;
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
  font-size: 14px;
  table-layout: auto;
  background: #ffffff;
  color: #374151;
}
.article-body th,
.article-body td {
  border: 1px solid #e5e7eb;
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}
.article-body th {
  background: #f8fafc;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
}
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 40px 0 20px;
  border-top: 1px solid #f0f0f0;
  padding-top: 20px;
}
.article-nav-item {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  max-width: 48%;
}
.article-nav-item:hover .article-nav-title {
  text-decoration: underline;
}
.article-nav-item.empty {
  visibility: hidden;
}
.article-nav-label {
  font-size: 13px;
  color: #9ca3af;
}
.article-nav-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--main3);
  line-height: 1.4;
}
.article-nav-item.next {
  text-align: right;
  align-items: flex-end;
}
.back-to-top {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 48px;
  height: 48px;
  background-color: var(--main3);
  color: #fff;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
  z-index: 100;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.back-to-top svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
.site-footer {
  border-top: 1px solid var(--line);
  background: #fafafa;
  padding: 24px 24px;
  color: #6b7280;
  font-size: 13px;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: center;
}
.footer-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #6b7280;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-item a {
  color: inherit;
  text-decoration: none;
}
.footer-item a:hover {
  color: var(--main3);
  text-decoration: underline;
}
.footer-icon img,
.footer-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sidebar-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  z-index: 18;
}
.sidebar-mask.visible {
  opacity: 1;
  visibility: visible;
}
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr) 200px;
  }
  .content {
    padding: 20px 24px;
  }
}
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}
@media (max-width: 768px) {
  .site-header {
    height: auto;
    padding: 12px 16px;
    gap: 16px;
    flex-wrap: wrap;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .brand-name {
    font-size: 16px;
  }
  .top-nav {
    flex-wrap: wrap;
    gap: 16px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px 8px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    max-width: 80vw;
    background: #fafafa;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 20;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .content {
    padding: 16px;
  }
  .article-title {
    font-size: 26px;
  }
  .article-body h1 {
    font-size: 20px;
  }
  .article-body h2 {
    font-size: 18px;
  }
  .article-body h3 {
    font-size: 16px;
  }
  .article-body img {
    width: 100% !important;
    height: auto !important;
    max-height: 60vh;
    object-fit: contain;
  }
  .article-nav {
    flex-direction: column;
    gap: 12px;
  }
  .article-nav-item {
    max-width: 100%;
  }
  .article-nav-item.next {
    align-items: flex-start;
    text-align: left;
  }
  .back-to-top {
    right: 16px;
    bottom: 20px;
    width: 44px;
    height: 44px;
  }
  .site-footer {
    padding: 14px 16px;
    font-size: 12px;
  }
  .footer-item {
    white-space: normal;
  }
}
