:root {
  --docs-bg: #ffffff;
  --docs-text: #252826;
  --docs-muted: #626963;
  --docs-line: #e7eae7;
  --docs-soft: #f6f8f6;
  --docs-brand: #08764d;
  --docs-brand-soft: #eff7f1;
  --docs-radius: 6px;
  --docs-max: 1440px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --docs-bg: #0b1321;
  --docs-text: #e5e7eb;
  --docs-muted: #a8b3c5;
  --docs-line: #334155;
  --docs-soft: #18253a;
  --docs-brand: #4ade80;
  --docs-brand-soft: rgba(34,197,94,.12);
  background: var(--docs-bg);
  color: var(--docs-text);
}

html[data-theme="dark"] .brand img[src$="logo.svg"] { filter: invert(1); }
html[data-theme="dark"] h1 { color: var(--docs-text); }
html[data-theme="dark"] kbd { border-color: var(--docs-line); }
html[data-theme="dark"] .docs-search-trigger { border-color: #8191a9; }
html[data-theme="dark"] .docs-search-trigger:hover,
html[data-theme="dark"] .prev-next a:hover { border-color: #4ade80; }
html[data-theme="dark"] .docs-main a { text-decoration-color: #8191a9; }
html[data-theme="dark"] .skip-link { color: #0b1220; }
html[data-theme="dark"] .sidebar { scrollbar-color: #8191a9 transparent; }
html[data-theme="dark"] .docs-search-overlay { box-shadow: 0 20px 70px rgba(0,0,0,.4); }
html[data-theme="dark"] .docs-search-overlay::backdrop { background: rgba(2,6,23,.65); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--docs-bg);
  color: var(--docs-text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: var(--docs-brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--docs-brand); outline-offset: 4px; }
button { color: inherit; }
.skip-link {
  position: fixed;
  top: -80px;
  left: 20px;
  padding: 8px 16px;
  background: var(--docs-brand);
  color: #fff;
  z-index: 100;
}
.skip-link:focus { top: 8px; }
.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--docs-line);
  background: var(--docs-bg);
}
.topbar-inner {
  max-width: var(--docs-max);
  min-height: 64px;
  margin: 0 auto;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--docs-text);
  font-weight: 650;
  white-space: nowrap;
  line-height: 1.3;
}
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 28px; height: 28px; }
.brand-docs { margin-left: 6px; color: var(--docs-muted); font-weight: 450; }
.top-actions { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.open-app { color: var(--docs-text); white-space: nowrap; }
.docs-search-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  min-height: 38px;
  padding: 6px 10px 6px 14px;
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  background: var(--docs-soft);
  color: var(--docs-muted);
  font-size: 13px;
}
.docs-search-trigger:hover { border-color: #b5c5ba; }
kbd {
  padding: 1px 5px;
  border: 1px solid #dde2dd;
  border-radius: 4px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--docs-muted);
  white-space: nowrap;
}
.docs-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 780px) 180px;
  justify-content: center;
  align-items: start;
  gap: 40px;
  max-width: var(--docs-max);
  margin: 0 auto;
  padding: 44px 28px 72px;
}
.docs-navigation, .toc { position: sticky; top: 100px; min-width: 0; }
.docs-navigation > summary { display: none; }
.sidebar {
  max-height: calc(100dvh - 124px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #dfe4df transparent;
  padding-right: 20px;
}
.nav-group { margin-bottom: 26px; }
.nav-group:last-child { margin-bottom: 0; }
.nav-group p {
  margin: 0 0 8px;
  color: var(--docs-text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}
.nav-group a {
  display: block;
  padding: 6px 0;
  color: var(--docs-muted);
  font-size: 14px;
  line-height: 1.5;
}
.nav-group a:hover, .nav-group a[aria-current] { color: var(--docs-brand); }
.nav-group a[aria-current] { font-weight: 600; }
.docs-main { min-width: 0; }
.docs-main:focus { outline: none; }
.article-header { margin-bottom: 34px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--docs-muted);
  font-size: 13px;
  line-height: 1.5;
}
h1 {
  margin: 0 0 22px;
  color: #1d211e;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
p { margin: 14px 0; }
.article-header > p:not(.eyebrow) { margin: 16px 0; }
.doc-section {
  padding-top: 32px;
  margin-top: 34px;
  border-top: 1px solid var(--docs-line);
}
h2 {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
h3 {
  margin: 28px 0 8px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
}
strong { font-weight: 600; }
ul, ol { padding-left: 24px; margin: 14px 0; }
li { padding-left: 3px; margin: 8px 0; }
.steps li { margin: 16px 0; }
.steps strong { display: block; }
.docs-main a { text-decoration: underline; text-decoration-color: #b7cebf; text-underline-offset: 3px; }
.docs-main a:hover { text-decoration-color: currentColor; }
.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--docs-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.callout {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 3px solid #8db99b;
  border-radius: 0 4px 4px 0;
  background: var(--docs-brand-soft);
  font-size: 15px;
  line-height: 1.65;
}
.callout > strong { display: block; }
.callout p { margin: 6px 0 0; }
.sentence-example {
  margin: 24px 0;
  padding: 22px 24px;
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  background: var(--docs-soft);
}
.sentence-example figcaption { color: var(--docs-muted); font-size: 12px; margin-bottom: 16px; }
.sentence-example p { margin: 6px 0; }
.sentence-meaning { font-size: 16px; }
.sentence-example .sentence-hanzi { font-size: 29px; line-height: 1.6; letter-spacing: 0.05em; margin-top: 12px; }
.sentence-pinyin { color: var(--docs-muted); font-size: 15px; }
.sentence-input { border-top: 1px solid var(--docs-line); margin-top: 20px; padding-top: 16px; }
.sentence-input span { display: block; color: var(--docs-muted); font-size: 12px; margin-bottom: 6px; }
.sentence-input code { background: transparent; padding: 0; font-size: 15px; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 5px;
  background: var(--docs-soft);
  border-radius: 3px;
  overflow-wrap: anywhere;
}
pre {
  margin: 20px 0;
  padding: 18px 20px;
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  background: var(--docs-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre code { padding: 0; background: none; }
.table-wrap {
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
}
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; line-height: 1.6; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--docs-line); vertical-align: top; }
thead th { font-weight: 600; background: var(--docs-soft); }
tbody th { font-weight: 550; min-width: 110px; }
tbody tr:last-child > * { border-bottom: 0; }
.related-links { list-style: none; margin: 20px 0; padding: 0; }
.related-links li { margin: 0; padding: 14px 0; border-bottom: 1px solid var(--docs-line); }
.related-links li:last-child { border: 0; }
.related-links a { font-weight: 550; }
.related-links span { display: block; margin-top: 3px; color: var(--docs-muted); font-size: 14px; }
.toc-details > summary {
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 14px;
}
.toc-details > summary::-webkit-details-marker { display: none; }
.toc nav { max-height: calc(100dvh - 170px); overflow-y: auto; scrollbar-width: thin; border-left: 1px solid var(--docs-line); }
.toc a {
  display: block;
  padding: 5px 0 5px 14px;
  border-left: 1px solid transparent;
  margin-left: -1px;
  color: var(--docs-muted);
  font-size: 13px;
  line-height: 1.5;
}
.toc a[aria-current], .toc a:hover { color: var(--docs-brand); border-left-color: var(--docs-brand); text-decoration: none; }
.article-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--docs-line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  color: var(--docs-muted);
  font-size: 12px;
}
.article-footer p { margin: 0; }
.prev-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.prev-next a { padding: 16px 18px; border: 1px solid var(--docs-line); border-radius: var(--docs-radius); text-decoration: none; font-size: 14px; }
.prev-next a:hover { border-color: #a8c9b4; background: var(--docs-soft); }
.prev-next a[rel="next"] { grid-column: 2; text-align: right; }
.prev-next span { display: block; margin-bottom: 3px; font-size: 12px; color: var(--docs-muted); }
.docs-footer { border-top: 1px solid var(--docs-line); color: var(--docs-muted); font-size: 12px; }
.footer-inner { max-width: var(--docs-max); margin: 0 auto; padding: 24px 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-inner a { color: var(--docs-muted); }
.docs-search-overlay {
  width: min(660px, calc(100% - 32px));
  max-height: calc(100dvh - 80px);
  margin: 80px auto 0;
  padding: 0;
  border: 1px solid var(--docs-line);
  border-radius: 10px;
  color: var(--docs-text);
  background: var(--docs-bg);
  box-shadow: 0 20px 70px #10201726;
}
.docs-search-overlay::backdrop { background: #18241d60; }
.docs-search-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--docs-line); }
.docs-search-head input { min-width: 0; flex: 1; padding: 4px; border: 0; background: transparent; color: var(--docs-text); font-size: 16px; }
.docs-search-head input:focus-visible { outline-offset: 0; }
.docs-search-head button { padding: 6px 8px; border: 1px solid var(--docs-line); border-radius: 4px; background: var(--docs-soft); font-size: 12px; }
.docs-search-status { margin: 0; padding: 10px 20px 4px; font-size: 12px; color: var(--docs-muted); }
.docs-search-results { max-height: min(55dvh, 460px); overflow-y: auto; margin: 0; padding: 8px; list-style: none; }
.docs-search-results li { margin: 0; padding: 0; }
.docs-search-result { display: block; padding: 12px; border-radius: 4px; text-decoration: none; }
.docs-search-result:hover, .docs-search-result:focus-visible { background: var(--docs-brand-soft); text-decoration: none; }
.docs-search-result strong { display: block; font-size: 15px; color: var(--docs-text); }
.docs-search-result span { display: block; margin-top: 4px; font-size: 13px; line-height: 1.6; color: var(--docs-muted); }
.docs-search-empty { margin: 0; padding: 16px; color: var(--docs-muted); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1150px) {
  .docs-shell { grid-template-columns: 190px minmax(0, 760px); gap: 0 32px; padding-top: 32px; }
  .docs-navigation { grid-column: 1; grid-row: 1 / span 2; }
  .docs-main { grid-column: 2; grid-row: 2; }
  .toc { grid-column: 2; grid-row: 1; position: static; margin-bottom: 28px; }
  .toc-details { padding: 12px 16px; border: 1px solid var(--docs-line); border-radius: var(--docs-radius); }
  .toc-details > summary { display: list-item; list-style: disclosure-closed; margin: 0; }
  .toc-details[open] > summary { list-style: disclosure-open; margin-bottom: 12px; }
  .toc-details > summary::-webkit-details-marker { display: inline; }
  .toc nav { max-height: 280px; }
}
@media (max-width: 760px) {
  html { scroll-padding-top: 84px; }
  .topbar-inner { padding: 12px 18px; min-height: 64px; gap: 12px; }
  .brand { font-size: 14px; gap: 8px; }
  .brand-docs { display: none; }
  .top-actions { gap: 0; }
  .open-app, .docs-search-trigger kbd { display: none; }
  .docs-search-trigger { min-height: 36px; padding: 6px 10px; gap: 0; white-space: nowrap; font-size: 12px; }
  .docs-shell { display: flex; flex-direction: column; gap: 0; padding: 0 20px 48px; }
  .docs-navigation { width: 100%; position: static; order: 0; margin: 0 0 16px; border-bottom: 1px solid var(--docs-line); }
  .docs-navigation > summary { display: list-item; padding: 14px 0; font-size: 13px; font-weight: 550; }
  .sidebar { max-height: 60dvh; padding: 8px 0 22px; }
  .nav-group { margin-bottom: 20px; }
  .nav-group a { padding: 8px 0; }
  .toc { order: 1; width: 100%; margin-bottom: 28px; }
  .docs-main { order: 2; width: 100%; }
  h1 { font-size: 30px; margin-bottom: 18px; }
  h2 { font-size: 23px; }
  .article-header { margin-bottom: 28px; }
  .doc-section { padding-top: 28px; margin-top: 28px; }
  .sentence-example { padding: 18px; }
  .sentence-example .sentence-hanzi { font-size: 26px; }
  .table-wrap table { min-width: 480px; }
  th, td { padding: 10px 12px; }
  .prev-next { gap: 10px; }
  .prev-next a { padding: 12px; }
  .footer-inner { padding: 22px 20px; }
  .docs-search-overlay { margin-top: 20px; max-height: calc(100dvh - 40px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
