:root {
  color-scheme: light;
  --page: #f2f6f3;
  --paper: #ffffff;
  --sidebar: #e9f0ec;
  --ink: #20342d;
  --muted: #66766e;
  --line: #d7e1db;
  --green: #17634c;
  --green-soft: #dcebe3;
  --blue: #315bb5;
  --amber: #b36d19;
  --code: #eff3f6;
  --shadow: 0 12px 36px rgba(29, 55, 43, .08);
  --font: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #17211d;
  --paper: #1e2b25;
  --sidebar: #202d27;
  --ink: #e4eee8;
  --muted: #9aac9f;
  --line: #34483c;
  --green: #72c3a0;
  --green-soft: #263e32;
  --blue: #9bb7ff;
  --amber: #edb267;
  --code: #17211d;
  --shadow: 0 12px 36px rgba(0, 0, 0, .18);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.65; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue); }
button, input { font: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.reading-progress { position: fixed; z-index: 30; inset: 0 auto auto 0; height: 3px; width: 0; background: var(--green); }
.app-shell { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; min-height: 0; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); padding: 20px 16px 14px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px 3px 10px 3px; background: var(--green); color: #fff; font-size: 14px; font-weight: 700; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; line-height: 1.2; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.close-menu { display: none; border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.search-box { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.search-icon { color: var(--muted); font-size: 23px; line-height: 1; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search-box input::placeholder { color: var(--muted); }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); font-family: inherit; font-size: 11px; }
.search-count { min-height: 20px; padding: 3px 5px; color: var(--muted); font-size: 11px; }
.navigation { flex: 1; min-height: 0; overflow: auto; padding: 0 2px 16px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.navigation a { display: block; color: var(--muted); text-decoration: none; }
.nav-home, .nav-module { padding: 7px 9px; border-radius: 5px; font-size: 13px; }
.nav-home:hover, .nav-question:hover, .nav-module:hover { background: var(--paper); color: var(--ink); }
.nav-home.is-active, .nav-module.is-active, .nav-question.is-active { color: var(--green); background: var(--green-soft); font-weight: 600; }
.nav-label { margin: 20px 9px 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.nav-group { border-top: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.nav-group summary { position: relative; padding: 9px 22px 9px 9px; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 600; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { position: absolute; right: 9px; content: "+"; color: var(--muted); font-size: 15px; font-weight: 400; }
.nav-group[open] summary::after { content: "−"; }
.nav-children { padding: 0 0 7px 7px; }
.nav-question { padding: 6px 8px; border-radius: 4px; font-size: 11px; line-height: 1.45; }
.nav-question[hidden], .nav-group[hidden], .nav-home[hidden] { display: none; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 7px 2px; border-top: 1px solid var(--line); font-size: 11px; }
.sidebar-foot a { color: var(--muted); }
.theme-button { border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.theme-button:hover { border-color: var(--green); color: var(--green); }
.main-area { min-width: 0; }
.reader-top { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 34px; border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--muted); font-size: 12px; }
.breadcrumbs a { overflow: hidden; color: var(--muted); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs span:last-child { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.reader-actions { display: flex; gap: 14px; font-size: 12px; }
.source-link { color: var(--muted); text-decoration: none; }
.content-grid { display: grid; grid-template-columns: minmax(0, 780px) 190px; gap: clamp(28px, 5vw, 76px); justify-content: center; padding: 38px 38px 72px; }
.article-content { min-width: 0; }
.article-kicker { margin-bottom: 10px; color: var(--green); font-size: 12px; font-weight: 700; }
.markdown-body { font-size: 16px; line-height: 1.85; overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { color: var(--ink); line-height: 1.35; scroll-margin-top: 24px; }
.markdown-body h1 { margin: 0 0 27px; font-size: clamp(27px, 3vw, 36px); font-weight: 700; }
.markdown-body h2 { margin: 42px 0 14px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: 23px; }
.markdown-body h3 { margin: 32px 0 12px; font-size: 18px; }
.markdown-body h4 { margin: 26px 0 10px; font-size: 16px; }
.markdown-body p { margin: 0 0 18px; }
.markdown-body ul, .markdown-body ol { padding-left: 1.45em; margin: 0 0 20px; }
.markdown-body li { padding-left: 3px; margin: 5px 0; }
.markdown-body blockquote { margin: 22px 0; padding: 4px 0 4px 17px; border-left: 3px solid var(--amber); color: var(--muted); }
.markdown-body hr { height: 1px; margin: 32px 0; border: 0; background: var(--line); }
.markdown-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 22px 0; font-size: 14px; }
.markdown-body th, .markdown-body td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-body th { background: var(--green-soft); font-weight: 600; }
.markdown-body code { padding: .16em .38em; border-radius: 4px; background: var(--code); color: var(--blue); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .88em; }
.markdown-body pre { max-width: 100%; overflow: auto; margin: 20px 0; padding: 17px 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--code); line-height: 1.6; tab-size: 2; }
.markdown-body pre code { padding: 0; background: transparent; color: var(--ink); }
.markdown-body img { max-width: 100%; height: auto; }
.article-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.article-footer a { white-space: nowrap; }
.toc { position: sticky; top: 28px; align-self: start; max-height: calc(100vh - 56px); overflow: auto; padding-left: 15px; border-left: 1px solid var(--line); }
.toc-title { margin-bottom: 10px; color: var(--ink); font-size: 11px; font-weight: 700; }
#tocLinks a { display: block; margin: 7px 0; color: var(--muted); text-decoration: none; font-size: 11px; line-height: 1.45; }
#tocLinks a:hover, #tocLinks a.is-current { color: var(--green); }
#tocLinks a[data-depth="3"] { padding-left: 9px; }
.mobile-bar, .scrim { display: none; }

@media (max-width: 1120px) {
  .content-grid { grid-template-columns: minmax(0, 780px); }
  .toc { display: none; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .mobile-bar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 54px; padding: 0 13px; border-bottom: 1px solid var(--line); background: var(--paper); }
  .mobile-brand { justify-self: center; color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
  .mobile-brand span { color: var(--green); }
  .menu-button { justify-self: start; border: 0; padding: 7px 5px; background: transparent; color: var(--green); cursor: pointer; font-size: 13px; font-weight: 600; }
  .theme-button#themeToggleMobile { justify-self: end; border: 0; padding: 7px; color: var(--ink); font-size: 19px; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(330px, calc(100vw - 46px)); height: 100dvh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.menu-open .sidebar { transform: translateX(0); }
  .close-menu { display: block; }
  .scrim { position: fixed; z-index: 35; inset: 0; background: rgba(17, 30, 24, .42); }
  body.menu-open .scrim { display: block; }
  .reader-top { min-height: 44px; padding: 0 16px; }
  .reader-actions { display: none; }
  .content-grid { display: block; padding: 26px 19px 50px; }
  .markdown-body { font-size: 16px; line-height: 1.82; }
  .markdown-body h1 { margin-bottom: 22px; font-size: 27px; }
  .markdown-body h2 { margin-top: 34px; font-size: 21px; }
  .markdown-body h3 { font-size: 17px; }
  .article-footer { flex-direction: column; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
