:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --line: #d9e2ec;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn-bg: #fff7ed;
  --warn-line: #fed7aa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #eef4f4;
  padding: 24px 18px;
}

.brand {
  margin-bottom: 24px;
}

.brand-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.help-search {
  position: relative;
  margin-top: 14px;
}

.help-search label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.help-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
}

.help-search input:focus {
  border-color: var(--accent);
  outline: 2px solid #99d5d0;
  outline-offset: 1px;
}

.search-results {
  position: absolute;
  z-index: 10;
  top: 100%;
  right: 0;
  left: 0;
  max-height: min(420px, 55vh);
  margin-top: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgb(15 23 42 / 14%);
}

.search-results[hidden] {
  display: none;
}

.search-result {
  display: block;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover,
.search-result:focus {
  background: #e7f3f2;
  text-decoration: none;
}

.search-result-title,
.search-result-snippet,
.search-empty {
  display: block;
}

.search-result-title {
  font-weight: 700;
}

.search-result-snippet,
.search-empty {
  color: var(--muted);
  font-size: 13px;
}

.search-empty {
  padding: 10px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  display: block;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
}

.nav a[aria-current="page"],
.nav summary[aria-current="page"],
.nav a:hover,
.nav summary:hover {
  background: #d9eeee;
  text-decoration: none;
}

.nav-section > summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: 6px;
  padding: 0 10px;
  list-style: none;
}

.nav .nav-section > summary > a {
  flex: 1;
  padding: 8px 0;
}

.nav .nav-section > summary > a:hover {
  background: transparent;
}

.nav-section > summary::-webkit-details-marker {
  display: none;
}

.nav-section > summary::after {
  content: "›";
  flex: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.2;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.nav-section[open] > summary::after {
  transform: rotate(90deg);
}

.subnav-links {
  display: grid;
  gap: 2px;
  margin: 4px 0 2px 14px;
  border-left: 1px solid #b8cccc;
  padding: 2px 0 4px 10px;
}

.nav .subnav-links a {
  padding: 5px 8px;
  color: var(--muted);
  font-size: 13px;
}

.nav .subnav-links a:hover {
  color: var(--text);
}

.content {
  width: min(1120px, 100%);
  padding: 34px 42px 56px;
}

.page-title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.25;
}

.lead {
  margin: 0 0 26px;
  color: var(--muted);
  max-width: 860px;
}

.section {
  margin-top: 28px;
}

.section h2 {
  margin: 0 0 12px;
  font-size: 21px;
  scroll-margin-top: 20px;
}

.section h3,
.section h4 {
  margin: 18px 0 10px;
}

.section h3 {
  font-size: 18px;
}

.section h4 {
  font-size: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
}

.summary-item span {
  color: var(--muted);
}

.note {
  border-left: 4px solid var(--accent);
  background: var(--panel);
  padding: 12px 14px;
}

.warning {
  border: 1px solid var(--warn-line);
  border-left: 4px solid #ea580c;
  background: var(--warn-bg);
  padding: 12px 14px;
}

.danger {
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  background: #fef2f2;
  padding: 12px 14px;
}

.toc-tree {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 18px 14px 38px;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.screenshot {
  margin: 14px 0 0;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0 0;
}

.screenshot-grid .screenshot {
  margin: 0;
}

.screenshot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.screenshot figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
}

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

th {
  background: #eef4f4;
  font-weight: 700;
}

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

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  white-space: nowrap;
}

.tag.reuse {
  background: #dcfce7;
  color: #166534;
}

.tag.rewrite {
  background: #fef3c7;
  color: #92400e;
}

.tag.clean {
  background: #ede9fe;
  color: #5b21b6;
}

.tag.missing {
  background: #fee2e2;
  color: #991b1b;
}

.tag.exclude {
  background: #e5e7eb;
  color: #374151;
}

code {
  background: #e8eef3;
  border-radius: 4px;
  padding: 1px 4px;
}

mark {
  border-radius: 2px;
  background: #fde68a;
  color: inherit;
  padding: 0 1px;
}

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

  .sidebar {
    position: static;
    height: auto;
    overflow-y: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 26px 18px 40px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .sample-grid {
    grid-template-columns: 1fr;
  }
}
