:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #182438;
  background: #f3f6fb;
  --surface: #fff;
  --ink: #182438;
  --muted: #52637a;
  --line: #dfe7f2;
  --blue: #115cbc;
  --blue-soft: #eaf3ff;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--blue); }
a:hover { text-decoration: none; }
:focus-visible { outline: 3px solid #2c73cc; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 10px; background: var(--surface); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.layout { display: grid; grid-template-columns: 284px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 100vh;
  padding: 22px 18px;
  overflow: auto;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; padding: 0 0 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.brand strong { display: block; font-size: 17px; }
.brand small { color: var(--muted); font-size: 12px; }
.search { position: relative; margin-bottom: 20px; }
.search label, .chapter-nav p { display: block; margin: 0 0 7px; font-size: 12px; font-weight: 650; color: var(--muted); }
.search input { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #cbd8e9; border-radius: 7px; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); }
.search-results { position: absolute; inset: calc(100% + 5px) 0 auto; z-index: 1; max-height: min(380px, 54vh); overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px #18243820; }
.search-results p { margin: 4px 6px; color: var(--muted); font-size: 12px; }
.search-results ul { margin: 0; padding: 0; list-style: none; }
.search-results a { display: block; padding: 8px; border-radius: 5px; font-size: 13px; text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--blue-soft); }
.search-results small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.chapter-nav { display: grid; gap: 3px; }
.chapter-nav a { display: block; padding: 9px 10px; border-radius: 6px; color: #34445c; font-size: 14px; text-decoration: none; }
.chapter-nav a:hover, .chapter-nav a[aria-current] { color: var(--blue); background: var(--blue-soft); }
.chapter-nav a[aria-current] { font-weight: 650; }

.content { width: 100%; max-width: 1220px; margin-inline: auto; padding: 26px clamp(18px, 3vw, 44px) 34px; }
.hero, .chapter { margin-bottom: 18px; padding: clamp(20px, 3vw, 38px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); scroll-margin-top: 22px; }
.hero { background: #f8fbff; }
.eyebrow { margin: 0 0 9px; color: var(--blue); font-size: 13px; font-weight: 650; }
h1 { margin: 0 0 12px; font-size: clamp(27px, 3.4vw, 38px); line-height: 1.3; }
.lead { max-width: 650px; margin: 0 0 23px; color: #3b4b61; font-size: 16px; line-height: 1.75; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick-grid a { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); text-decoration: none; }
.quick-grid a:hover { border-color: #79a9e5; }
.quick-grid span { display: block; margin-bottom: 6px; color: var(--blue); font-size: 12px; font-weight: 700; }
.quick-grid strong { display: block; font-size: 14px; }
.quick-grid small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.topic-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 0; font-size: 14px; }
.screenshot-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.chapter h2 { margin: 0 0 12px; font-size: 24px; line-height: 1.4; }
.chapter h3 { margin: 24px 0 8px; font-size: 17px; }
.chapter p, .chapter li, .chapter dd { font-size: 15px; line-height: 1.8; }
.chapter p { margin: 10px 0; }
.chapter .path { color: var(--blue); font-size: 13px; font-weight: 650; }
.chapter .guide-note { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid #b16b14; background: #fff6e6; color: #67420e; }
.chapter h3[id] { scroll-margin-top: 16px; }
.chapter ol, .chapter ul { padding-left: 1.5em; }
.chapter li + li { margin-top: 5px; }
figure { margin: 19px 0; }
.compact-figure { width: min(100%, 465px); margin-inline: auto; }
.screenshot { display: block; cursor: zoom-in; border: 1px solid var(--line); border-radius: 7px; }
.screenshot img { display: block; width: 100%; height: auto; border-radius: 6px; }
figcaption { margin-top: 8px; text-align: center; color: var(--muted); font-size: 13px; }
.modes, .faq { margin: 18px 0 0; border-top: 1px solid var(--line); }
.modes div, .faq div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.modes div { display: grid; grid-template-columns: 85px minmax(0, 1fr); gap: 8px; }
.modes dt, .faq dt { font-size: 15px; font-weight: 650; line-height: 1.8; }
.modes dd, .faq dd { margin: 0; color: #3b4b61; }
.footer { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0 4px; font-size: 13px; color: var(--muted); }

dialog { width: min(1200px, calc(100% - 24px)); max-height: calc(100vh - 24px); margin: auto; padding: 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: #111827c4; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.preview-bar p { margin: 0; font-weight: 650; font-size: 14px; }
.preview-bar button { min-height: 36px; padding-inline: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f5f8fd; color: var(--ink); font: inherit; cursor: pointer; }
#preview-original { display: block; cursor: zoom-in; }
#preview-original img { display: block; max-width: 100%; max-height: calc(100vh - 115px); width: auto; height: auto; margin: 0 auto; }

@media (max-width: 1040px) {
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; overflow: visible; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 12px; padding-bottom: 10px; }
  .search { margin-bottom: 12px; }
  .chapter-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-nav p { grid-column: 1 / -1; margin-bottom: 0; }
  .chapter-nav a { min-height: 38px; padding: 8px; font-size: 13px; }
  .content { padding: 14px 12px 24px; }
  .hero, .chapter { scroll-margin-top: 10px; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
