/* ========= YONG AI 开放平台 全局样式 ========= */
:root {
  --bg: #0b0f1a;
  --bg2: #0f1524;
  --card: #131b2e;
  --card2: #17203632;
  --border: #22304a;
  --text: #e6ecf7;
  --text2: #9aa8c4;
  --text3: #64748b;
  --primary: #6366f1;
  --primary2: #8b5cf6;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: #a5b4fc; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11, 15, 26, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--text); }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .5);
}
.nav-links { display: flex; gap: 22px; align-items: center; margin-left: 8px; flex: 1; flex-wrap: wrap; }
.nav-links a { color: var(--text2); font-size: 15px; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 12px; align-items: center; }
.nav-user { color: var(--text2); font-size: 14px; display: flex; gap: 10px; align-items: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 16px rgba(99,102,241,.35); }
.btn-primary:hover { filter: brightness(1.1); color: #fff; }
.btn-ghost { background: transparent; color: var(--text2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text3); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(239,68,68,.4); }
.btn-danger:hover { background: rgba(239,68,68,.12); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[hidden] { display: none; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page { min-height: calc(100vh - 66px); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card h3 { font-size: 17px; margin-bottom: 10px; }
.card .sub { color: var(--text2); font-size: 14px; }
.stat-num { font-size: 30px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { color: var(--text2); font-size: 13px; margin-top: 2px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--text2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 15px; outline: none; transition: border .15s;
  font-family: inherit;
}
.input:focus { border-color: var(--primary); }
textarea.input { resize: vertical; min-height: 90px; }
.form-card { max-width: 420px; margin: 60px auto; }
.form-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.form-sub { color: var(--text2); margin-bottom: 26px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text2); font-weight: 600; font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid rgba(34,48,74,.5); vertical-align: middle; }
tr:hover td { background: rgba(99,102,241,.05); }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-green { background: rgba(16,185,129,.15); color: var(--green); }
.badge-yellow { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-red { background: rgba(239,68,68,.15); color: var(--red); }
.badge-blue { background: rgba(99,102,241,.15); color: #a5b4fc; }
.badge-gray { background: rgba(100,116,139,.15); color: var(--text3); }

/* ---------- 提示 ---------- */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; display: none; }
.alert.show { display: block; }
.alert-error { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.35); color: #6ee7b7; }
.alert-info { background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.35); color: #a5b4fc; }
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
pre {
  background: #0a0e18; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; overflow-x: auto; color: #c9d4e8; line-height: 1.55;
}
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0 40px; margin-top: 60px; color: var(--text3); font-size: 13px; text-align: center; }

/* ---------- 通用工具类 ---------- */
.flex { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.muted { color: var(--text2); } .small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- Hero ---------- */
.hero { padding: 90px 24px 70px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(99,102,241,.18), transparent 60%),
    radial-gradient(600px 300px at 80% 10%, rgba(139,92,246,.15), transparent 60%);
}
.hero h1 { font-size: 52px; font-weight: 900; letter-spacing: -1px; line-height: 1.15; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text2); font-size: 19px; max-width: 640px; margin: 20px auto 34px; }
.hero .btns { display: flex; gap: 14px; justify-content: center; }

/* 特性图标 */
.feature .icon { width: 46px; height: 46px; border-radius: 12px; background: rgba(99,102,241,.15); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 12px; }

/* 模型卡 */
.model-card { position: relative; overflow: hidden; }
.model-card::after { content: ""; position: absolute; top: -40px; right: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(99,102,241,.25), transparent 70%); }
.model-card .tag { position: absolute; top: 16px; right: 16px; }

/* 步骤 */
.step { display: flex; gap: 16px; }
.step .num { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }

/* 文档页面 */
.doc h2 { font-size: 26px; margin: 44px 0 14px; padding-top: 20px; border-top: 1px solid var(--border); }
.doc h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.doc h3 { font-size: 18px; margin: 26px 0 10px; }
.doc p { margin-bottom: 10px; color: var(--text2); }
.doc table { margin: 12px 0 20px; }
.endpoint { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin: 14px 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.endpoint .method { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 6px; }
.method-get { background: rgba(16,185,129,.15); color: var(--green); }
.method-post { background: rgba(99,102,241,.15); color: #a5b4fc; }
.method-delete { background: rgba(239,68,68,.15); color: #fca5a5; }
.endpoint .path { font-family: ui-monospace, Menlo, monospace; font-size: 15px; font-weight: 600; }

/* 定价表 */
.price-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 100px; gap: 12px; padding: 14px 8px; border-bottom: 1px solid var(--border); align-items: center; font-size: 14px; }
.price-head { color: var(--text2); font-size: 13px; }

/* 聊天（体验页） */
.chat-box { height: calc(100vh - 220px); min-height: 420px; display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 78%; padding: 12px 16px; border-radius: 14px; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; background: rgba(245,158,11,.1); color: var(--yellow); font-size: 13px; max-width: 90%; }
.chat-input-bar { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); background: var(--bg); }
.chat-input-bar .input { flex: 1; }
.typing::after { content: "▍"; animation: blink 1s infinite; color: var(--primary); }
@keyframes blink { 50% { opacity: 0; } }

/* 控制台侧边栏 */
.console-wrap { display: flex; min-height: calc(100vh - 66px); }
.sidebar { width: 230px; flex: none; border-right: 1px solid var(--border); padding: 24px 14px; background: var(--bg2); }
.sidebar .item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; color: var(--text2); font-size: 15px; cursor: pointer; margin-bottom: 4px; transition: all .15s; }
.sidebar .item:hover { background: rgba(99,102,241,.1); color: var(--text); }
.sidebar .item.active { background: rgba(99,102,241,.18); color: #fff; font-weight: 600; }
.main-area { flex: 1; padding: 28px; min-width: 0; }
.main-area h2 { font-size: 22px; margin-bottom: 4px; }
.main-area .desc { color: var(--text2); margin-bottom: 24px; }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 16px; max-width: 560px; width: 100%; padding: 26px; box-shadow: var(--shadow); max-height: 84vh; overflow-y: auto; }

/* 空态 */
.empty { text-align: center; padding: 46px 20px; color: var(--text3); }

/* 响应式 */
@media (max-width: 900px) {
  .hero h1 { font-size: 36px; }
  .nav-links { display: none; }
  .sidebar { width: 64px; padding: 20px 8px; }
  .sidebar .item span.txt { display: none; }
  .price-row { grid-template-columns: 1fr 1fr 1fr; }
  .price-row .hide-m { display: none; }
}