/* Personal API and documentation. */

.docs-link {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}
html[data-api-entry="on"] .docs-link:not([hidden]) { display: inline-flex; }
.docs-link:hover { background: var(--soft); }
.docs-link.is-current { color: var(--accent-ink); background: var(--accent-soft); }

@media (max-width: 700px) {
  html[data-api-entry="on"] .topbar {
    padding: 10px 12px;
    gap: 6px;
  }
  html[data-api-entry="on"] .top-controls { gap: 3px; }
  html[data-api-entry="on"] .auth-entry {
    padding: 0 10px;
    font-size: 12px;
    min-height: 32px;
  }
  html[data-api-entry="on"] .docs-link {
    min-height: 28px;
    padding: 0 4px;
    font-size: 12px;
    font-weight: 700;
  }
  html[data-api-entry="on"] .theme-switch { padding: 1px; flex-shrink: 0; }
  html[data-api-entry="on"] .theme-switch button {
    width: 28px;
    height: 28px;
  }
  html[data-api-entry="on"] .lang-switch .lang-toggle {
    width: 32px;
    min-width: 32px;
  }
}

/* —— 用户中心 API 接口页 —— */
.api-lead {
  margin: -8px 0 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}
.api-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 14px;
}
.api-toolbar .count { color: var(--muted); font-size: 13px; font-weight: 650; }
.api-create-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.api-limit-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.api-name-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.api-table .name { font-weight: 750; }
.api-table .meta, .api-table .prefix { color: var(--muted); font-weight: 650; font-size: 13px; }
.api-table .prefix { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.api-card {
  display: none;
}
.api-card.is-disabled .name,
.api-card.is-disabled .meta,
.api-card.is-disabled .prefix,
.api-table tr.is-disabled td:not(:last-child) {
  color: var(--muted);
  opacity: 0.7;
}
.api-quick {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.api-quick h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
}
.api-docs-action {
  margin-top: 20px;
}
.api-warn {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ead089;
  background: #fff6d8;
  color: #6a4b00;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.65;
  overflow-wrap: break-word;
  word-break: keep-all;
}
:root[data-theme="dark"] .api-warn,
html[data-theme="dark"] .api-warn {
  border-color: #7a6220;
  background: #3d3214;
  color: #f3d98a;
}
.api-key-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
}
.api-key-box code {
  display: block;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.uc-dialog .api-warn { color: #6a4b00; font-size: 13px; font-weight: 700; }
:root[data-theme="dark"] .uc-dialog .api-warn { color: #f3d98a; }

.code-block {
  position: relative;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}
.code-block pre {
  margin: 0;
  padding: 16px 16px 14px;
  padding-right: 84px;
  overflow: auto;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.code-copy.is-copied {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: transparent;
}
.code-hscroll { display: none; }

@media (max-width: 800px) {
  .api-table-wrap, .api-table { display: none; }
  .api-cards { display: grid; gap: 10px; }
  .api-card {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg);
  }
  .api-card .name { margin: 0; font-size: 14px; font-weight: 750; }
  .api-card .meta { margin: 0; color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.6; }
  .api-card .prefix { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
  .api-card .row-actions { margin-top: 6px; }
  .code-block { max-width: 100%; min-width: 0; }
  .code-block pre {
    padding-right: 16px;
    padding-top: 44px;
    padding-bottom: 10px;
    white-space: pre;
    overflow-x: auto;
    overflow-y: hidden;
    overflow-wrap: normal;
    word-break: normal;
    max-width: 100%;
  }
  .code-block.is-overflow::after {
    content: "";
    position: absolute;
    top: 40px;
    right: 0;
    bottom: 16px;
    width: 36px;
    pointer-events: none;
    border-radius: 0 14px 0 0;
    background: linear-gradient(to right, transparent, var(--bg) 72%);
  }
  .code-block.is-overflow .code-hscroll {
    display: block;
    height: 4px;
    margin: 0 12px 10px;
    border-radius: 99px;
    background: var(--border);
    position: relative;
    overflow: hidden;
  }
  .code-block.is-overflow .code-hscroll > i {
    display: block;
    width: 30%;
    height: 100%;
    border-radius: 99px;
    background: var(--muted);
    opacity: 0.55;
  }
}

/* —— 公开文档页 —— */
.docs-page {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 28px 28px 80px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.docs-toc {
  position: sticky;
  top: 16px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.docs-toc p {
  margin: 0 0 8px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
}
.docs-toc a {
  display: block;
  padding: 7px 8px;
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  text-decoration: none;
}
.docs-toc a:hover, .docs-toc a.is-current { background: var(--accent-soft); color: var(--accent-ink); }
.docs-toc-mobile { display: none; }
.docs-main h1 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: .02em;
  line-height: 1.25;
}
.docs-main .docs-intro {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
}
.docs-main h2 {
  margin: 32px 0 12px;
  padding-top: 8px;
  font-size: 20px;
  font-weight: 800;
}
.docs-main h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 800;
}
.docs-main p {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.7;
}
.docs-endpoint {
  margin: 0 0 28px;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.docs-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.meth {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  font-family: inherit;
}
.meth-get { background: #e7f0fb; color: #1e4e8c; }
.meth-post { background: #e7f6ee; color: #1c6b3a; }
.meth-del { background: #f3eef8; color: #5b3d8c; }
:root[data-theme="dark"] .meth-get { background: #1c2d48; color: #9ec3f0; }
:root[data-theme="dark"] .meth-post { background: #173528; color: #8ad4a8; }
:root[data-theme="dark"] .meth-del { background: #2b2040; color: #c8b0ef; }
.docs-table-wrap { overflow: auto; margin: 0 0 14px; }
.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.docs-table th, .docs-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-weight: 650;
}
.docs-table th { color: var(--muted); font-weight: 750; }
.docs-table code, .docs-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}
.docs-sub { margin: 16px 0 6px; font-size: 13px; font-weight: 800; color: var(--muted); }
.docs-addr {
  margin: 0 0 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 750;
}

@media (max-width: 800px) {
  .docs-page {
    grid-template-columns: 1fr;
    padding: 16px 16px 56px;
    gap: 14px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
  .docs-main, .docs-endpoint, .docs-main p { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .docs-toc { display: none; }
  .docs-toc-mobile {
    display: block;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 0 14px;
    min-width: 0;
    max-width: 100%;
  }
  .docs-toc-mobile summary {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
  }
  .docs-toc-mobile summary::-webkit-details-marker { display: none; }
  .docs-toc-caret {
    color: var(--muted);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-1px);
  }
  .docs-toc-mobile[open] .docs-toc-caret { transform: rotate(180deg); }
  .docs-toc-mobile a {
    display: block;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
  }
  .docs-main h1 { font-size: 22px; }
  .docs-endpoint { padding: 14px; }
}


.api-card .name, .api-table .name { overflow-wrap: anywhere; }
.api-table .name { min-width: 80px; max-width: 160px; }
.api-table .meta { white-space: normal; }
.api-table .prefix { white-space: nowrap; }
.api-docs-action a { text-decoration: none; display: inline-flex; align-items: center; }
.api-empty-actions { margin-top: 14px; justify-content: center; }
#api-created-modal { width: min(520px, calc(100% - 48px)); }
.key-name-nowrap { white-space: nowrap; }
.docs-notice { max-width: 1124px; margin: 16px auto; }
.docs-main li { font-size: 14px; font-weight: 600; line-height: 1.7; margin-bottom: 8px; }
.docs-main section, .docs-main h1, .docs-main h2 { scroll-margin-top: 16px; }
@media (max-width: 700px) {
  html[data-api-entry="on"] .topbar { flex-wrap: nowrap; }
  html[data-api-entry="on"] .top-controls { gap: 5px; }
  html[data-api-entry="on"] .topbar .brand { gap: 6px; }
  html[data-api-entry="on"] .auth-entry { padding-inline: 8px; }
  html[data-api-entry="on"] .docs-link { padding-inline: 4px; }
  html[data-api-entry="on"][lang="en"] .topbar .brand-name { max-width: 78px; font-size: 12px; }
  html[data-api-entry="on"][lang="en"] .auth-entry { padding-inline: 6px; font-size: 11px; }
}
@media (max-width: 380px) {
  html[data-api-entry="on"] .topbar .brand { gap: 5px; font-size: 18px; }
  html[data-api-entry="on"] .brand-mark, html[data-api-entry="on"] .brand-mark img { width: 28px; height: 28px; }
  html[data-api-entry="on"][lang="en"] .topbar .brand-name { max-width: 64px; font-size: 11px; }
  html[data-api-entry="on"] .top-controls { gap: 3px; }
  html[data-api-entry="on"] .auth-entry { padding-inline: 6px; font-size: 11px; }
  html[data-api-entry="on"] .docs-link { padding-inline: 3px; font-size: 11px; }
  html[data-api-entry="on"] .lang-switch .lang-toggle { width: 28px; min-width: 28px; }
  html[data-api-entry="on"] .theme-switch button { width: 25px; height: 28px; }
}
