/**
 * 文档说明页共用样式（API 对接、浏览器插件）。
 */
:root {
  --doc-bg: #ffffff;
  --doc-panel: #fff;
  --doc-text: #37352f;
  --doc-muted: #787774;
  --doc-border: rgba(55, 53, 47, 0.1);
  --doc-link: #2765f6;
  --doc-code-bg: rgba(39, 101, 246, 0.06);
  --doc-note-bg: rgba(39, 101, 246, 0.06);
  --doc-warn-bg: rgba(245, 158, 11, 0.1);
  /* 与首页 footer 语言切换共用变量名 */
  --muted: #787774;
  --text: #37352f;
  --accent: #2765f6;
  --border-ui: rgba(55, 53, 47, 0.08);
  --border-ui-strong: rgba(55, 53, 47, 0.14);
  --surface-dropdown: rgba(255, 255, 255, 0.98);
  --surface-popover-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  --locale-hover-bg: rgba(47, 102, 235, 0.08);
  --locale-active-bg: rgba(47, 102, 235, 0.12);
}

html[data-theme="dark"] {
  --doc-bg: #2b2b2b;
  --doc-panel: #2f2f2f;
  --doc-text: #e8e8e7;
  --doc-muted: #a8a29e;
  --doc-border: rgba(255, 255, 255, 0.1);
  --doc-link: #5b8af7;
  --doc-code-bg: rgba(91, 138, 247, 0.12);
  --doc-note-bg: rgba(91, 138, 247, 0.12);
  --doc-warn-bg: rgba(245, 158, 11, 0.14);
  --muted: #a8a29e;
  --text: #e8e8e7;
  --accent: #5b8af7;
  --border-ui: rgba(255, 255, 255, 0.1);
  --border-ui-strong: rgba(255, 255, 255, 0.16);
  --surface-dropdown: #2f2f2f;
  --surface-popover-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  --locale-hover-bg: rgba(91, 138, 247, 0.12);
  --locale-active-bg: rgba(91, 138, 247, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--doc-text);
  background: var(--doc-bg);
}

.doc-topbar {
  width: 100%;
  border-bottom: 1px solid var(--doc-border);
  background: var(--doc-panel);
  position: sticky;
  top: 0;
  z-index: 30;
}

.doc-topbar-inner {
  display: flex;
  align-items: center;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
}

.doc-brand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--doc-text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.doc-brand:hover {
  color: var(--doc-link);
}

.doc-brand img {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

.doc-topbar-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  flex: 1;
  min-width: 0;
}

.doc-topbar-link {
  color: var(--doc-muted);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
}

.doc-topbar-link:hover {
  color: var(--doc-link);
}

.doc-topbar-link.is-active {
  color: var(--doc-link);
}

/* 文档页头语言切换：与首页 footer-locale-* 结构/样式一致 */
.doc-topbar .doc-topbar-locale-switcher {
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-family: Inter, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.doc-topbar .footer-locale-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.doc-topbar .footer-locale-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.doc-topbar .footer-locale-trigger {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border: 1px solid var(--border-ui);
  border-radius: 6px;
  background: transparent;
  color: currentColor;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.doc-topbar .footer-locale-trigger:hover,
.doc-topbar .footer-locale-trigger[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--border-ui-strong);
  background: transparent;
}

.doc-topbar .footer-locale-label {
  white-space: nowrap;
}

.doc-topbar .footer-locale-caret {
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.doc-topbar .footer-locale-caret svg {
  width: 100%;
  height: 100%;
  display: block;
}

.doc-topbar .footer-locale-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 148px;
  padding: 6px;
  border: 1px solid var(--border-ui);
  border-radius: 8px;
  background: var(--surface-dropdown);
  box-shadow: var(--surface-popover-shadow);
  display: grid;
  gap: 2px;
  z-index: 40;
}

.doc-topbar .footer-locale-menu.hidden {
  display: none;
}

.doc-topbar .footer-locale-option {
  width: 100%;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.doc-topbar .footer-locale-option:hover {
  background: var(--locale-hover-bg);
}

.doc-topbar .footer-locale-option[aria-checked="true"] {
  background: var(--locale-active-bg);
  color: var(--accent);
}

.doc-shell {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.doc-title {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.doc-lead {
  margin: 0 0 28px;
  color: var(--doc-muted);
  font-size: 15px;
}

.doc-section {
  margin-top: 28px;
}

.doc-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.doc-section h3 {
  margin: 16px 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.doc-section p,
.doc-section li {
  margin: 0 0 10px;
  font-size: 15px;
}

.doc-section ul,
.doc-section ol {
  margin: 0 0 10px;
  padding-left: 22px;
}

.doc-section li:last-child {
  margin-bottom: 0;
}

.doc-code {
  display: block;
  margin: 10px 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--doc-border);
  border-radius: 8px;
  background: var(--doc-code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.doc-code-inline {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--doc-code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.doc-note,
.doc-warn {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.55;
}

.doc-note {
  background: var(--doc-note-bg);
  border: 1px solid var(--doc-border);
}

.doc-warn {
  background: var(--doc-warn-bg);
  border: 1px solid var(--doc-border);
}

.doc-table-wrap {
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--doc-border);
  border-radius: 8px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.doc-table th,
.doc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--doc-border);
  text-align: left;
  vertical-align: top;
}

.doc-table tr:last-child th,
.doc-table tr:last-child td {
  border-bottom: 0;
}

.doc-table th {
  width: 28%;
  color: var(--doc-muted);
  font-weight: 600;
  background: var(--doc-code-bg);
}

.doc-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 4px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--doc-link);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  -webkit-text-fill-color: #ffffff;
}

.doc-download:hover {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  text-decoration: none;
  filter: brightness(1.08);
}

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

.doc-section a:not(.doc-download) {
  color: var(--doc-link);
  text-decoration: none;
}

.doc-section a:not(.doc-download):hover {
  text-decoration: underline;
}

.doc-browser-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-browser-list li {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--doc-border);
  border-radius: 8px;
  background: var(--doc-panel);
}

.doc-browser-list li:last-child {
  margin-bottom: 0;
}

.doc-browser-list strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}
