/* ===== 变量与基础 ===== */
:root {
  --bg-page: #0f1419;
  --bg-card: #1a2332;
  --bg-sidebar: #161d28;
  --bg-code: #0d1117;
  --border: rgba(255, 255, 255, 0.06);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.15);
  --success: #3fb950;
  --success-dot: #3fb950;
  --gradient-start: #6366f1;
  --gradient-end: #ec4899;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 浅色主题 */
body.theme-light {
  --bg-page: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #f6f8fa;
  --bg-code: #f6f8fa;
  --border: rgba(0, 0, 0, 0.08);
  --text: #1f2328;
  --text-muted: #656d76;
  --accent: #0969da;
  --accent-soft: rgba(9, 105, 218, 0.12);
  --success: #1a7f37;
  --success-dot: #1a7f37;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ===== 顶栏 ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.nav-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 2s ease-in-out infinite;
}

.status-online .status-dot {
  background: var(--success-dot);
  box-shadow: 0 0 8px var(--success);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.models-path {
  font-size: 13px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

body.theme-light .icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* 主题切换按钮：深色时显示太阳（切到浅色），浅色时显示月亮（切到深色） */
.theme-icon {
  display: none;
}

.icon-sun { display: block; }
.icon-moon { display: none; }

body.theme-light .icon-sun { display: none; }
body.theme-light .icon-moon { display: block; }

.api-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 12px;
  background: var(--accent-soft);
  border-radius: 20px;
}

/* ===== 主内容区 ===== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 48px;
}

/* ===== 步月中转站 开屏 ===== */
.splash {
  text-align: center;
  margin-bottom: 56px;
  padding: 48px 24px 40px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  border-radius: var(--radius);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

body.theme-light .splash {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
  border-color: rgba(99, 102, 241, 0.2);
}

.splash-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #3fb950;
  padding: 6px 14px;
  background: rgba(63, 185, 80, 0.15);
  border-radius: 20px;
  margin-bottom: 20px;
}

.splash-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.3;
}

.splash-title em {
  font-style: normal;
  color: #a78bfa;
}

body.theme-light .splash-title {
  background: linear-gradient(135deg, #1f2328 0%, #6366f1 50%, #c026d3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-desc {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 28px;
  line-height: 1.7;
}

.splash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  border: none;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

body.theme-light .btn-ghost {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
}

body.theme-light .btn-ghost:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.2);
}

.btn-arrow {
  opacity: 0.9;
}

/* ===== 标题区 ===== */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 50%, #f0abfc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

body.theme-light .hero-title {
  background: linear-gradient(135deg, #1f2328 0%, #6366f1 50%, #c026d3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===== 左右布局 ===== */
.content-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .content-wrap {
    grid-template-columns: 1fr;
  }
}

/* ===== 侧边栏 ===== */
.sidebar {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 80px;
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.client-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.client-item.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.client-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  color: inherit;
}

.client-icon .client-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
}

.client-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.client-item.active .client-icon {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
}

.client-icon.claude { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.client-icon.kilo  { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.client-icon.cline { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.client-icon.cherry { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.client-icon.codex { background: rgba(59, 130, 246, 0.2); color: #60a5fa; font-size: 12px; }
.client-icon.gemini { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.client-icon.openai { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.client-icon.curl { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }

.client-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.client-name {
  font-weight: 600;
  color: inherit;
}

.client-tag {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.9;
}

.client-item.active .client-tag {
  color: rgba(255, 255, 255, 0.7);
}

/* ===== 代码面板 ===== */
.code-panel {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.code-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(88, 166, 255, 0.3);
}

.copy-btn.copied {
  color: var(--success);
  border-color: rgba(63, 185, 80, 0.4);
}

.code-block {
  margin: 0;
  padding: 20px 24px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Monaco, monospace;
}

.code-block code {
  color: #e6edf3;
  white-space: pre;
}

body.theme-light .code-block code {
  color: #1f2328;
}

body.theme-light .code-block .comment { color: #656d76; }

/* 简单代码高亮 */
.code-block .comment { color: #8b949e; }
.code-block .key { color: #79c0ff; }
.code-block .string { color: #a5d6ff; }
.code-block .export { color: #7ee787; }

/* ===== 运行监控 ===== */
.monitor-section {
  margin-top: 56px;
}

.monitor-wrap {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .monitor-wrap {
    grid-template-columns: 1fr;
  }
}

.log-panel {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

body.theme-light .log-panel {
  background: #1f2328;
}

.log-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border);
}

.log-window-dots {
  display: flex;
  gap: 6px;
}

.log-window-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.log-window-dots .red { background: #ff5f57; }
.log-window-dots .yellow { background: #febc2e; }
.log-window-dots .green { background: #28c840; }

.log-panel-title {
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
}

.log-view {
  height: 240px;
  overflow-y: auto;
  padding: 12px 16px;
  font-size: 12px;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Monaco, monospace;
  line-height: 1.8;
}

.log-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.log-time {
  color: var(--text-muted);
  margin-right: 6px;
}

.log-level {
  font-weight: 700;
  margin-right: 8px;
  min-width: 48px;
  display: inline-block;
}

.log-line.level-info .log-level { color: #3fb950; }
.log-line.level-warn .log-level { color: #d29922; }
.log-line.level-block .log-level { color: #f85149; }

.log-line {
  transition: background 0.2s ease;
}

.log-line.log-line-updated {
  background: rgba(63, 185, 80, 0.12);
}

/* ===== 实时流量（重写） ===== */
.traffic-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--success);
}

body.theme-light .traffic-panel {
  border-left-color: var(--success);
}

.traffic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.traffic-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
}

.traffic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.traffic-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: trafficBlink 1.2s ease-in-out infinite;
}

@keyframes trafficBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.traffic-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.traffic-kpis .kpi {
  background: var(--bg-panel-alt, rgba(0, 0, 0, 0.2));
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.theme-light .traffic-kpis .kpi {
  background: rgba(0, 0, 0, 0.03);
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kpi-unit {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-success .kpi-value {
  color: var(--success);
}

.traffic-chart-area {
  padding: 14px 20px 18px;
}

.traffic-chart-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.traffic-chart-wrap {
  min-height: 120px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-light .traffic-chart-wrap {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
}

.traffic-chart {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
}

/* ===== 通用区块 ===== */
.section {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}

.section-desc {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== 功能特点 ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== 支持的模型 ===== */
.model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.model-tag {
  font-size: 13px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.model-tag:hover {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.3);
  background: var(--accent-soft);
}

/* ===== 接入流程 ===== */
.steps {
  list-style: none;
  max-width: 560px;
  margin: 0 auto;
}

.step {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
  align-items: flex-start;
}

.step:last-child { margin-bottom: 0; }

.step-num {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  border-radius: 50%;
}

.step h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.step p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.step code {
  font-size: 12px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--accent);
}

/* ===== 数据概览 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 640px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  text-align: center;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== 常见问题 ===== */
.faq-list {
  max-width: 640px;
  margin: 0 auto;
}

.faq-item {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.faq-item dt {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.faq-item dd {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

.faq-item code {
  font-size: 12px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--accent);
}

/* ===== 页脚 ===== */
.footer {
  margin-top: 64px;
  padding: 32px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 14px;
  color: var(--text-muted);
}

.footer-muted {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.8;
}
