/* "接入客户端"页。配色变量、基础样式在 base.css；这里是这一页自己的布局和组件，
   都用 cn- 前缀，不跟聊天页、管理台的类名互相影响。 */

body.connect {
  height: auto;
  min-height: 100vh;
  background:
    radial-gradient(1100px 420px at 15% -10%, var(--violet-soft), transparent 70%),
    radial-gradient(800px 360px at 100% -12%, var(--amber-soft), transparent 70%),
    var(--ground);
  background-attachment: fixed;
}

.cn {
  --card: var(--surface);
  --card-line: var(--hairline);
  --card-shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 8px 24px -16px rgba(20, 22, 26, 0.18);
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

@media (prefers-color-scheme: dark) {
  .cn {
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -18px rgba(0, 0, 0, 0.7);
  }
}

.cn svg,
.cn-toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cn code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.cn p code,
.cn li code,
.cn-section-hint code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--ground-2);
  border: 1px solid var(--hairline);
  color: var(--ink);
}

/* ---------- 顶栏 ---------- */

/* 跟拆分 base.css 之前一样单独成一层，顶栏的渲染结果逐像素不变。 */
.cn-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 36px;
}

.cn-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cn-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.cn-brand .brand-mark svg {
  width: 19px;
  height: 19px;
}

.cn-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.cn-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.cn-btn--ghost {
  background: var(--card);
  border: 1px solid var(--card-line);
  color: var(--ink-dim);
  box-shadow: var(--card-shadow);
}

.cn-btn--ghost:hover {
  border-color: var(--violet-line);
  color: var(--ink);
}

/* ---------- 两项必填 ---------- */

.cn-hero h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cn-lead {
  margin: 0 0 22px;
  max-width: 620px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-dim);
}

.cn-creds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cn-cred {
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  min-width: 0;
}

.cn-cred-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.cn-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--violet);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.cn-cred-title {
  font-size: 14px;
  font-weight: 600;
}

.cn-value {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  border-radius: 10px;
  background: var(--ground-2);
  border: 1px solid var(--hairline);
  min-width: 0;
}

.cn-value[hidden] {
  display: none;
}

.cn-value code {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: var(--violet);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 140ms ease, background 140ms ease;
}

.cn-copy:hover {
  filter: brightness(1.08);
}

.cn .cn-copy svg {
  width: 14px;
  height: 14px;
}

.cn-copy.is-done {
  background: var(--ok, #15803d);
}

.cn-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
}

.cn-icon-btn:hover,
.cn-icon-btn[aria-pressed="true"] {
  background: var(--violet-soft);
  color: var(--violet-strong);
}

.cn-missing {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--amber-soft);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}

.cn-missing[hidden] {
  display: none;
}

.cn-missing svg {
  margin-top: 2px;
  color: var(--amber-strong);
}

.cn-missing a {
  color: var(--violet-strong);
}

.cn-hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-faint);
}

.cn-hint[hidden] {
  display: none;
}

.cn-inline-copy {
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.cn-inline-copy:hover,
.cn-inline-copy:focus-visible {
  border-color: var(--violet-line) !important;
  color: var(--violet-strong) !important;
}

.cn-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--ink-dim);
}

.cn-tip svg {
  color: #15803d;
}

/* ---------- 通用区块 ---------- */

.cn-section {
  margin-top: 52px;
}

.cn-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 16px;
}

.cn-section-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.cn-section-hint {
  font-size: 12.5px;
  color: var(--ink-faint);
}

.cn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--surface-hover);
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 600;
}

.cn-count:empty {
  display: none;
}

/* ---------- 常见客户端 ---------- */

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

.cn-client {
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.cn-client-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.cn-client-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

/* 颜色用类而不是 HTML 里的 style="..."：线上 CSP 的 style-src 没有 'unsafe-inline'，
   内联样式属性会被浏览器直接忽略（JS 里改 element.style 不受影响）。 */
.cn-client-logo--chat {
  --accent: #e5484d;
}

.cn-client-logo--cursor {
  --accent: var(--ink);
}

.cn-client-logo--ide {
  --accent: #2f6feb;
}

.cn-client h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
}

.cn-client-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
}

.cn-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cn-steps li {
  position: relative;
  padding-left: 30px;
  counter-increment: step;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-dim);
}

.cn-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--violet-soft);
  color: var(--violet-strong);
  font-size: 11.5px;
  font-weight: 700;
}

.cn-steps strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 模型 ---------- */

.cn-models {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cn-empty {
  margin: 0;
  padding: 28px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-faint);
  background: var(--card);
  border: 1px dashed var(--card-line);
  border-radius: 16px;
}

.cn-empty.is-error {
  color: var(--error);
  border-color: var(--error-line);
}

.cn-model-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.cn-model-group-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.cn-model-group-hint {
  margin-left: auto;
  font-size: 11.5px !important;
  color: var(--ink-faint);
}

.cn-model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* 整张卡片就是复制按钮：点一下复制模型名。 */
.cn-model {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.cn-model:hover,
.cn-model:focus-visible {
  border-color: var(--violet-line);
  box-shadow: var(--card-shadow);
  transform: translateY(-1px);
  outline: none;
}

.cn-model.is-featured {
  border-color: var(--violet-line);
  background: linear-gradient(135deg, var(--violet-soft), transparent 60%), var(--card);
}

.cn-model.is-done {
  border-color: #15803d;
}

.cn-model-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.cn-model-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px !important;
  font-weight: 600;
}

.cn-model.is-unavailable .cn-model-name,
.cn-model.is-unavailable .cn-model-desc {
  opacity: 0.6;
}

.cn-model-copy {
  margin-left: auto;
  display: inline-flex;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity 140ms ease;
}

.cn-model:hover .cn-model-copy,
.cn-model:focus-visible .cn-model-copy {
  opacity: 1;
}

.cn .cn-model-copy svg {
  width: 14px;
  height: 14px;
}

.cn-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.cn .cn-pill svg {
  width: 11px;
  height: 11px;
}

.cn-pill--brand {
  background: var(--violet);
  color: #fff;
}

.cn-pill--vision {
  background: var(--amber-soft);
  color: var(--amber-strong);
}

.cn-pill--muted {
  background: var(--ground-2);
  border: 1px solid var(--hairline);
  color: var(--ink-faint);
}

.cn-model-meta {
  display: flex;
  gap: 8px;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-faint);
}

.cn-model-provider {
  flex-shrink: 0;
  color: var(--ink-dim);
  font-weight: 500;
}

/* ---------- 代码示例 ---------- */

.cn-seg {
  display: inline-flex;
  margin-left: auto;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--ground-2);
  border: 1px solid var(--hairline);
}

.cn-seg button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.cn-seg button:hover {
  color: var(--ink);
}

.cn-seg button[aria-selected="true"] {
  background: var(--violet);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px -6px var(--violet);
}

/* 代码块两种主题下都用深色底，像个终端。 */
.cn-code {
  border-radius: 14px;
  overflow: hidden;
  background: #16171d;
  border: 1px solid #262833;
  box-shadow: var(--card-shadow);
}

.cn-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid #262833;
  font-size: 12px;
  color: #8b909c;
}

.cn-copy--dark {
  background: rgba(255, 255, 255, 0.08);
  color: #e6e7eb;
}

.cn-copy--dark:hover {
  background: rgba(255, 255, 255, 0.14);
  filter: none;
}

.cn-code pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
}

.cn-code code {
  font-size: 13px !important;
  line-height: 1.7;
  color: #e6e7eb;
  white-space: pre;
}

/* ---------- 几点说明 ---------- */

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

.cn-note {
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 16px;
}

.cn-note-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--violet-soft);
  color: var(--violet-strong);
}

.cn-note h3 {
  margin: 12px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.cn-note p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-dim);
}

/* ---------- 复制提示 ---------- */

.cn-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ground);
  font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
  animation: rise 200ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cn-toast[hidden] {
  display: none;
}

/* ---------- 确认框 ---------- */

.cn-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  animation: fade 160ms ease;
}

.cn-overlay[hidden] {
  display: none;
}

.cn-dialog {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: 0 32px 64px -24px rgba(10, 10, 20, 0.35);
  animation: rise 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cn-dialog h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 650;
}

.cn-dialog p {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-dim);
}

.cn-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.cn-dialog .cn-btn {
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
}

.cn-btn--primary {
  border: 0;
  background: var(--violet);
  color: #fff;
  font-weight: 600;
}

.cn-btn--primary:hover {
  filter: brightness(1.08);
}

/* ---------- 窄屏 ---------- */

@media (max-width: 860px) {
  .cn-clients,
  .cn-notes {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .cn {
    padding: 20px 16px 56px;
  }

  .cn-top {
    margin-bottom: 26px;
  }

  .cn-hero h2 {
    font-size: 23px;
  }

  .cn-creds,
  .cn-model-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cn-section {
    margin-top: 40px;
  }

  .cn-seg {
    margin-left: 0;
  }

  .cn-model-group-hint {
    display: none;
  }

  .cn-model-copy {
    opacity: 1;
  }
}
