/* ====== API 页 ====== */
/* 只放这一页专属的样式；按钮/输入/顶栏/页脚复用 style.css */

.api-wrap {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.api-hero { margin-bottom: 18px; }
.api-hero h1 { font-size: 23px; margin: 0 0 6px; }
.api-hero p { margin: 0; color: var(--text-2); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.card h2 { font-size: 16px; margin: 0; }
.card h3 { font-size: 14px; margin: 20px 0 8px; color: var(--text); }

.hint { color: var(--text-3); font-size: 12.5px; margin: 6px 0; }
.hint code, .notes code, .endpoint-table code, .ex-title + pre code { font-size: 12.5px; }
.hint code, .notes code, .card p code {
  background: var(--surface-2);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row .input { flex: 1 1 220px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
}

/* 新密钥展示：要显眼，用户只看到一次 */
.token-new {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.token-new .warn {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--danger);
}
.token-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.token-line code {
  flex: 1 1 240px;
  min-width: 0;
  word-break: break-all;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

/* 表格：窄屏横向滚动，别把布局撑破 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0;
}
.token-table, .endpoint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.token-table { min-width: 560px; }
.endpoint-table { min-width: 520px; }
.token-table th, .endpoint-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.token-table td, .endpoint-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.token-table tr:last-child td, .endpoint-table tr:last-child td { border-bottom: 0; }
.token-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text-2);
}
.token-table .dim { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* 方法徽章：颜色只作辅助，文字本身已区分 */
.m {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
}
.m.get { color: #1f7a4d; background: #e5f5ec; }
.m.post { color: #1c5fa8; background: #e6f0fc; }
.m.put { color: #8a5a00; background: #fdf0d9; }
.m.patch { color: #6a3fa0; background: #f0e9fc; }
.m.del { color: #a52a2a; background: #fbe6e6; }
[data-theme="dark"] .m.get { color: #7fd6a9; background: #1d3a2c; }
[data-theme="dark"] .m.post { color: #8fbcf0; background: #1c2c44; }
[data-theme="dark"] .m.put { color: #e8c07a; background: #3d3118; }
[data-theme="dark"] .m.patch { color: #c3a6ee; background: #302545; }
[data-theme="dark"] .m.del { color: #f0a0a0; background: #432427; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .m.get { color: #7fd6a9; background: #1d3a2c; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .m.post { color: #8fbcf0; background: #1c2c44; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .m.put { color: #e8c07a; background: #3d3118; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .m.patch { color: #c3a6ee; background: #302545; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .m.del { color: #f0a0a0; background: #432427; }
}

/* 代码块 */
pre.code {
  margin: 6px 0 4px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
pre.code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  color: var(--text);
}
.ex-title {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-2);
}
.notes { margin: 8px 0 0; padding-left: 18px; }
.notes li { font-size: 13px; color: var(--text-2); margin: 6px 0; }

/* 窄屏：卡片内边距收一点，行内控件允许折行 */
@media (max-width: 640px) {
  .api-wrap { padding: 18px 12px 32px; }
  .card { padding: 14px 14px; border-radius: 10px; }
  .api-hero h1 { font-size: 20px; }
  .row .input { flex: 1 1 100%; }
  .row .btn { flex: 1 1 auto; }

  /* 端点表改堆叠：横向滚动在手机上很容易漏看被裁掉的说明文字 */
  .endpoint-table { min-width: 0; }
  .endpoint-table thead { display: none; }
  .endpoint-table, .endpoint-table tbody, .endpoint-table tr, .endpoint-table td { display: block; width: 100%; }
  .endpoint-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .endpoint-table tr:last-child { border-bottom: 0; }
  .endpoint-table td {
    border: 0;
    padding: 0;
  }
  .endpoint-table td:nth-child(1) {
    display: inline-block;
    width: auto;
    margin-right: 6px;
    vertical-align: middle;
  }
  .endpoint-table td:nth-child(2) {
    display: inline-block;
    width: auto;
    vertical-align: middle;
  }
  .endpoint-table td:nth-child(3) {
    margin-top: 5px;
    color: var(--text-2);
    font-size: 12.5px;
    line-height: 1.5;
  }

  /* 代码块在手机上软换行：横滑看命令很难受，复制仍然拿到原文 */
  pre.code { overflow-x: hidden; }
  pre.code code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* 密钥表仍横滑，但给一条右侧阴影提示「后面还有内容」 */
  .table-wrap {
    box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, .35);
  }
}

/* ====== 保留名清单 ====== */
/* 名字长短不一（manifest.json / apple-touch-icon-precomposed.png），
   用等宽 chip 流式排列：比表格省竖向空间，窄屏也不会被裁掉。 */
.rsv-groups { display: flex; flex-direction: column; gap: 14px; }
.rsv-group h3 {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.rsv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rsv-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  /* 超长名字自身折行，绝不撑破卡片 */
  overflow-wrap: anywhere;
  max-width: 100%;
}

@media (max-width: 640px) {
  .rsv-chip { font-size: 11.5px; padding: 4px 7px; }
}
