/* ============ 全局基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1f2630;
  --card: rgba(255, 255, 255, 0.04);
  --card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #e6edf3;
  --text-soft: #c9d1d9;
  --muted: #8b949e;
  --primary: #6366f1;
  --primary-2: #ec4899;
  --accent-grad: linear-gradient(135deg, #6366f1, #ec4899);
  --success: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Courier New", monospace;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(at 20% 10%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 80% 80%, rgba(236, 72, 153, 0.10) 0px, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
code, pre { font-family: var(--mono); font-size: 13px; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ============ 布局壳 ============ */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: var(--accent-grad); color: #fff;
  border-radius: 8px; font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.area-tag {
  padding: 3px 10px; font-size: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc; border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.user-name { color: var(--text-soft); font-size: 14px; }
.body { flex: 1; display: flex; }
.body-full { display: block; }
.body-app { padding: 0; }
.sidebar {
  width: 220px; flex-shrink: 0;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  background: rgba(22, 27, 34, 0.5);
  backdrop-filter: blur(8px);
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-size: 14px;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--card-hover); color: var(--text); }
.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.content { flex: 1; padding: 28px 36px; min-width: 0; max-width: 100%; }
.footer {
  padding: 16px 24px; text-align: center;
  color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ============ 通用组件 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  background: var(--bg-3); color: var(--text);
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5); }
.btn-secondary { background: var(--card); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--card-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn-ghost:hover { background: var(--card); }
.btn-danger { color: var(--danger); border-color: rgba(248, 81, 73, 0.4); }
.btn-danger:hover { background: rgba(248, 81, 73, 0.1); }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--text-soft); font-weight: 500; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin: 12px 0; font-size: 14px; }
.alert-error { background: rgba(248, 81, 73, 0.12); border: 1px solid rgba(248, 81, 73, 0.4); color: #ffa198; }
.alert-warn  { background: rgba(210, 153, 34, 0.12); border: 1px solid rgba(210, 153, 34, 0.4); color: #e3b341; }
.alert-ok    { background: rgba(63, 185, 80, 0.12); border: 1px solid rgba(63, 185, 80, 0.4); color: #56d364; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.grad { background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; font-weight: 600; }
.page-head .back { color: var(--muted); font-size: 13px; margin-bottom: 4px; display: inline-block; }
.cat-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: 13px;
  border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text-soft); transition: all 0.15s ease;
}
.chip:hover { background: var(--card-hover); border-color: var(--border-strong); }
.chip.active { background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.4); color: #c7d2fe; }
.chip-icon { font-size: 14px; }

/* ============ 首页 Hero ============ */
.hero {
  min-height: 80vh;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 24px;
  position: relative;
}
.hero-inner { text-align: center; max-width: 760px; }
.hero-tag { letter-spacing: 4px; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.hero h1 { font-size: 64px; font-weight: 800; letter-spacing: -2px; margin-bottom: 20px; }
.hero-sub { color: var(--text-soft); font-size: 17px; margin-bottom: 36px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-bottom: 56px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 40px; justify-content: center; flex-wrap: wrap; }
.hero-stats .stat { display: flex; flex-direction: column; gap: 4px; }
.hero-stats .num { font-size: 32px; font-weight: 700; background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-stats .lbl { color: var(--muted); font-size: 13px; }

.features { max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px; }
.section-title { text-align: center; font-size: 26px; margin-bottom: 32px; font-weight: 600; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 980px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card {
  padding: 28px 24px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}
.feature-card:hover { background: var(--card-hover); transform: translateY(-3px); box-shadow: var(--shadow); }
.fc-icon { font-size: 32px; margin-bottom: 12px; }
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { color: var(--text-soft); font-size: 14px; }

/* ============ 落地页（高端增强） ============ */
.land-hero { min-height: 88vh; overflow: hidden; }
.land-blob {
  position: absolute; border-radius: 50%; filter: blur(90px);
  opacity: 0.5; pointer-events: none; animation: landFloat 14s ease-in-out infinite alternate;
}
.land-blob-a { width: 520px; height: 520px; top: -140px; left: 8%; background: radial-gradient(circle, rgba(99,102,241,.55), transparent 65%); }
.land-blob-b { width: 620px; height: 620px; bottom: -220px; right: 4%; background: radial-gradient(circle, rgba(217,70,239,.4), transparent 65%); animation-delay: -6s; }
@keyframes landFloat {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,30px) scale(1.12); }
}
.land-section { padding-top: 72px; }
.land-sub { text-align: center; color: var(--muted); font-size: 14px; margin: -22px 0 36px; }

/* 五步流水线 */
.land-flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
.land-step {
  position: relative; flex: 1; min-width: 176px;
  padding: 26px 18px 20px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  text-align: center;
}
.land-step:hover { transform: translateY(-4px); border-color: rgba(99,102,241,.45); box-shadow: var(--shadow); }
.ls-num {
  position: absolute; top: 10px; left: 14px;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.ls-icon { font-size: 30px; margin-bottom: 10px; }
.land-step h3 { font-size: 16px; margin-bottom: 6px; }
.land-step p { color: var(--text-soft); font-size: 12.5px; line-height: 1.6; }
.land-arrow { display: flex; align-items: center; color: var(--muted); font-size: 18px; flex: 0 0 auto; }

/* 三大工坊 */
.land-engines { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.land-engine {
  padding: 26px 24px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  display: flex; flex-direction: column; gap: 14px;
}
.land-engine:hover { transform: translateY(-4px); border-color: rgba(217,70,239,.4); box-shadow: var(--shadow); }
.le-head { display: flex; align-items: center; gap: 12px; }
.le-icon { font-size: 30px; }
.le-head h3 { font-size: 19px; margin: 0; }
.le-sub { color: var(--muted); font-size: 12.5px; }
.land-engine > p { color: var(--text-soft); font-size: 14px; line-height: 1.75; flex: 1; }
.le-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.le-tags span {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  background: var(--bg-3); color: var(--text-soft); border: 1px solid var(--border);
}
.le-tags .t-zhipu { border-color: rgba(56,189,248,.45); color: #7dd3fc; }
.le-tags .t-ark   { border-color: rgba(251,146,60,.45); color: #fdba74; }
.le-tags .t-mm    { border-color: rgba(217,70,239,.45); color: #f0abfc; }

/* 模型矩阵 */
.land-models { display: flex; flex-direction: column; gap: 14px; max-width: 920px; margin: 0 auto; }
.land-mrow {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 22px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
}
.lm-cat { font-size: 13px; font-weight: 600; color: var(--text-soft); min-width: 74px; }
.lm-list { display: flex; flex-wrap: wrap; gap: 10px; }
.lm-list span {
  font-size: 13px; padding: 6px 16px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text-soft);
  transition: all .15s ease;
}
.lm-list span:hover { border-color: rgba(99,102,241,.5); color: #c7d2fe; }

/* 尾部 CTA */
.land-cta { padding: 40px 24px 90px; }
.land-cta-inner {
  max-width: 920px; margin: 0 auto; text-align: center;
  padding: 56px 32px;
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(217,70,239,.14));
  border: 1px solid rgba(99,102,241,.35);
  position: relative; overflow: hidden;
}
.land-cta-inner::before {
  content: ''; position: absolute; inset: -60%;
  background: radial-gradient(circle at 30% 40%, rgba(99,102,241,.22), transparent 55%),
              radial-gradient(circle at 72% 65%, rgba(217,70,239,.18), transparent 50%);
  pointer-events: none;
}
.land-cta-inner h2 { font-size: 32px; font-weight: 800; margin-bottom: 10px; position: relative; }
.land-cta-inner p { color: var(--text-soft); margin-bottom: 28px; position: relative; }
.land-cta-inner .hero-cta { margin-bottom: 0; position: relative; }
@media (max-width: 768px) {
  .land-flow { flex-direction: column; }
  .land-arrow { transform: rotate(90deg); justify-content: center; }
}

/* ============ 认证卡片 ============ */
.auth-card {
  max-width: 420px; margin: 60px auto; padding: 36px 32px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 24px; margin-bottom: 8px; }
.auth-tip { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 13px; }
.auth-foot a { color: #a5b4fc; }

/* ============ 工作台 ============ */
/* 流水线总览条 */
.pipe-nav {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 16px 20px; margin-bottom: 28px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px);
}
.pipe-node {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-soft); font-size: 13px; text-decoration: none;
  transition: all .15s ease;
}
.pipe-node:hover { border-color: rgba(99,102,241,.5); color: #c7d2fe; transform: translateY(-1px); }
.pn-num { font-weight: 700; font-size: 12px; background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.pn-icon { font-size: 15px; }
.pipe-arrow { color: var(--muted); }

/* 流水线阶段：左侧阶段牌 + 右侧模块网格 */
.pipe-stage {
  display: grid; grid-template-columns: 230px 1fr; gap: 24px;
  padding: 28px 0 34px; margin-bottom: 10px;
  border-top: 1px dashed var(--border);
  scroll-margin-top: 80px;
}
.pipe-stage:first-of-type { border-top: none; }
.pipe-side { position: relative; padding-left: 6px; }
.ps-num {
  font-size: 56px; font-weight: 800; line-height: 1;
  background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  opacity: .85; margin-bottom: 10px;
}
.ps-icon { font-size: 26px; margin-bottom: 8px; }
.ps-name { font-size: 21px; margin-bottom: 8px; }
.ps-desc { color: var(--text-soft); font-size: 13.5px; line-height: 1.7; margin-bottom: 14px; }
.ps-count {
  display: inline-block; font-size: 12px; color: var(--muted);
  background: var(--bg-3); border: 1px solid var(--border);
  padding: 3px 12px; border-radius: 999px;
}
/* 生成成片工具卡 */
.tool-card .tc-icon { font-size: 30px; margin-bottom: 10px; }
.tool-card .tc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.tool-card .tc-tags span {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text-soft);
}
.tool-card { border-color: rgba(99,102,241,.35); }
.tool-card:hover { border-color: rgba(217,70,239,.5); }
@media (max-width: 900px) {
  .pipe-stage { grid-template-columns: 1fr; gap: 16px; }
  .pipe-side { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
  .ps-num { font-size: 34px; margin-bottom: 0; }
  .ps-icon { margin-bottom: 0; }
  .ps-desc { margin-bottom: 0; width: 100%; }
}
.cat-section { margin-bottom: 40px; }
.cat-title { font-size: 20px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.cat-emoji { font-size: 24px; }
.cat-count { background: var(--bg-3); color: var(--muted); font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.module-card {
  position: relative;
  padding: 22px 20px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  display: flex; flex-direction: column;
}
.module-card:hover {
  background: var(--card-hover);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.15);
}
.module-card .mc-code { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.module-card h3 { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.module-card p { color: var(--text-soft); font-size: 13px; flex: 1; }
.module-card .mc-go {
  margin-top: 16px; color: #a5b4fc; font-size: 13px; font-weight: 500;
}

/* ============ 生成页 ============ */
.generate-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; min-height: calc(100vh - 200px); }
.gen-head h1 { font-size: 22px; margin: 8px 0 6px; }
.gen-head .mc-code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gen-left, .gen-right {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  backdrop-filter: blur(12px);
  display: flex; flex-direction: column;
}
.gen-result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.gen-result-head h3 { font-size: 16px; }
.result-actions { display: flex; gap: 6px; }
.gen-result {
  flex: 1; padding: 18px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-y: auto; max-height: 600px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}
.result-placeholder { color: var(--muted); font-style: italic; font-family: var(--font); }
.gen-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.gen-actions #gen-status { font-size: 13px; }

/* ============ 历史 ============ */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.hist-item {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 18px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.hist-item:hover { background: var(--card-hover); }
.hist-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.hist-cat { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--bg-3); padding: 2px 8px; border-radius: 4px; }
.hist-input { color: var(--text-soft); font-size: 13px; }
.hist-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty a { color: #a5b4fc; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.page { padding: 6px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.page.active { background: rgba(99, 102, 241, 0.2); border-color: var(--primary); color: #c7d2fe; }

.hist-detail { display: flex; flex-direction: column; gap: 24px; }
.hd-block h3 { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.hd-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pre-box {
  padding: 16px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}

/* ============ 我的 API ============ */
.api-card, .api-help {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-bottom: 20px;
}
.api-card { max-width: 720px; }
/* 「我的 API」配置卡片：宽屏左右两列排列，窄屏自动单列 */
.api-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(min(430px, 100%), 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.api-grid .api-card { margin-bottom: 0; max-width: none; }
@media (max-width: 1200px) { .api-grid { grid-template-columns: 1fr; } }
/* 后台「模型积分价格」：图片/视频两表左右排列，窄屏单列 */
.rates-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(min(430px, 100%), 1fr));
  gap: 28px;
}
@media (max-width: 1200px) { .rates-grid { grid-template-columns: 1fr; } }
.api-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.api-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.api-table th, .api-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.api-table th { color: var(--muted); font-weight: 500; }
.api-table code { font-family: var(--mono); }

/* ============ 总后台 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  padding: 24px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center;
}
.sc-num { font-size: 32px; font-weight: 700; background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sc-lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 16px; background: var(--card); border-radius: var(--radius-sm); overflow: hidden; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--bg-3); color: var(--muted); font-weight: 500; font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--card-hover); }
.data-table code { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: var(--bg-3); color: var(--text-soft); }
.badge-ok { background: rgba(63, 185, 80, 0.15); color: #56d364; }
.badge-warn { background: rgba(210, 153, 34, 0.15); color: #e3b341; }
.badge-primary { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }

.admin-form { max-width: 880px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-row > div { display: flex; flex-direction: column; }
.code-area { font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.input-group { display: flex; align-items: stretch; }
.input-prefix { padding: 10px 12px; background: var(--bg-3); border: 1px solid var(--border); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-family: var(--mono); font-size: 13px; color: var(--muted); }
.input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text-soft); }
.switch input[type=checkbox] { width: auto; }

.search-form { display: flex; gap: 6px; }
.search-form input { width: 200px; }

.not-found { text-align: center; padding: 100px 20px; }
.not-found h1 { font-size: 80px; background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* ============ 安装页 ============ */
.install-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 40px 20px; }
.install-card { max-width: 580px; width: 100%; padding: 40px 36px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.install-logo { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.install-logo .logo-mark { width: 48px; height: 48px; background: var(--accent-grad); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 18px; }
.install-logo h1 { font-size: 22px; }
.install-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.install-card h2 { font-size: 18px; margin: 24px 0 14px; }
.install-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.install-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.install-table td:first-child { width: 30px; color: var(--success); font-weight: 700; }
.install-tip { color: var(--muted); font-size: 13px; margin-top: 12px; padding: 12px 16px; background: var(--bg-2); border-radius: var(--radius-sm); }
.install-success { text-align: center; padding: 20px 0; }
.success-icon { width: 64px; height: 64px; background: rgba(63, 185, 80, 0.15); border: 2px solid var(--success); border-radius: 50%; color: var(--success); font-size: 32px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.install-actions { display: flex; gap: 10px; justify-content: center; margin: 24px 0; }

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
  .generate-layout { grid-template-columns: 1fr; }
  .gen-result { max-height: 400px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .topbar { padding: 0 14px; }
  .body-app { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 12px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .content { padding: 18px 16px; }
  .hero h1 { font-size: 40px; }
  .hero-sub { font-size: 15px; }
  .hero-cta { flex-direction: column; align-items: center; }
  .hero-stats { gap: 24px; }
  .auth-card { margin: 20px 14px; padding: 24px 20px; }
  .search-form input { width: 120px; }
}

/* ================= 媒体工坊（图片/视频） ================= */
.workshop-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}
.ws-panel {
  background: var(--panel, #161b22);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 20px;
  position: sticky;
  top: 16px;
}
.ws-panel label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--text-soft); font-weight: 600; }
.ws-panel textarea, .ws-panel select, .ws-panel input[type=text] {
  width: 100%; box-sizing: border-box;
  background: #0d1117; border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  color: var(--text); padding: 10px 12px; font-size: 13px; outline: none;
}
.ws-panel textarea:focus, .ws-panel select:focus { border-color: var(--primary); }
.form-row { display: flex; gap: 12px; }
.form-cell { flex: 1; }
.form-cell label { margin-top: 14px; }
.ws-tips {
  margin-top: 16px; padding: 12px 14px; border-radius: 10px;
  background: rgba(99,102,241,.08); border: 1px solid rgba(99,102,241,.25);
  font-size: 12.5px; line-height: 1.7; color: var(--text-soft);
}
.ws-result h3 { margin: 0 0 14px; font-size: 16px; }
.vid-advanced {
  margin-top: 14px; padding: 14px; border-radius: 10px;
  background: rgba(255,255,255,.03); border: 1px dashed rgba(255,255,255,.12);
}
.check-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 400 !important; }
.check-line input { width: 16px; height: 16px; accent-color: var(--primary); }

/* 首帧选择器 */
.ref-picker { display: flex; gap: 12px; align-items: stretch; }
.ref-picker select { flex: 1; min-width: 0; }
.ref-preview {
  width: 72px; height: 72px; border-radius: 10px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.12); background: #0d1117;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ref-preview img { width: 100%; height: 100%; object-fit: cover; }

/* 资产网格 */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.media-card {
  background: var(--panel, #161b22);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.media-card:hover { transform: translateY(-2px); border-color: rgba(99,102,241,.5); }
.mc-thumb { display: block; aspect-ratio: 9/16; background: #0d1117; }
.mc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-card video { width: 100%; display: block; aspect-ratio: 9/16; background: #000; }
.mc-actions { display: flex; gap: 6px; padding: 8px 10px 2px; flex-wrap: wrap; }
.mc-meta {
  padding: 6px 12px 12px; font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-processing, .mc-fail {
  aspect-ratio: 9/16; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 16px; background: #0d1117;
}
.mc-processing p, .mc-fail p { margin: 0; font-size: 13px; }
.mc-fail-icon { font-size: 28px; }
.media-empty {
  grid-column: 1/-1; padding: 60px 20px; text-align: center;
  color: var(--muted); border: 1px dashed rgba(255,255,255,.12); border-radius: 14px;
}
.media-empty a { color: var(--primary); }
.btn-danger { color: var(--danger) !important; }
.btn-danger:hover { background: rgba(248,81,73,.12) !important; }

/* 加载 spinner */
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(99,102,241,.25); border-top-color: var(--primary);
  animation: dt-spin .8s linear infinite;
}
@keyframes dt-spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .workshop-layout { grid-template-columns: 1fr; }
  .ws-panel { position: static; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ================= 镜头流水线（生成页内集成） ================= */
.shot-board {
  margin-top: 22px;
  background: var(--panel, #161b22);
  border: 1px solid rgba(99,102,241,.35);
  border-radius: 16px;
  padding: 22px;
}
.sb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.sb-head h2 { margin: 0 0 4px; font-size: 19px; }
.sb-batch { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-settings {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; padding: 14px; border-radius: 10px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
}
.sb-settings label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-soft); }
.sb-settings select {
  background: #0d1117; color: var(--text); border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; min-width: 150px;
}
.shot-list { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.shot-card {
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px; padding: 16px;
  background: rgba(13,17,23,.5);
}
.shot-card.busy { border-color: rgba(99,102,241,.6); }
.sc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sc-no {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.sc-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sc-dialogue {
  font-size: 12.5px; color: var(--text-soft);
  background: rgba(210,153,34,.1); border-left: 3px solid var(--warn);
  padding: 4px 10px; border-radius: 4px; width: 100%;
}
.sc-body { display: grid; grid-template-columns: 1fr 230px; gap: 16px; }
.sc-prompts label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.sc-prompts textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: #0d1117; color: var(--text);
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px; line-height: 1.6; outline: none;
}
.sc-prompts textarea:focus { border-color: var(--primary); }
.sc-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sc-status { word-break: break-all; }
.sc-media { display: flex; gap: 10px; align-items: flex-start; }
.sc-slot {
  position: relative;
  width: 105px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  background: #0d1117; border: 1px solid rgba(255,255,255,.1);
  aspect-ratio: 9/16;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
/* 已生成图片/视频上的重新生成悬浮按钮（镜头槽 + 资产槽共用） */
.slot-regen {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  background: rgba(13,17,23,.72); color: #e6edf3;
  font-size: 10.5px; line-height: 1; padding: 4px 9px; cursor: pointer;
  backdrop-filter: blur(4px); white-space: nowrap;
  opacity: 0; transition: opacity .15s ease, background .15s ease;
  z-index: 3;
}
.sc-slot:hover .slot-regen,
.ac-slot:hover .slot-regen { opacity: 1; }
.slot-regen:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot-regen:disabled { opacity: .5; cursor: default; }
.slot-regen.is-video { font-size: 10px; padding: 3px 8px; }
/* 触屏无 hover：常驻显示 */
@media (hover: none) {
  .slot-regen { opacity: .92; }
}
.sc-slot img, .sc-slot video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-slot.is-video { aspect-ratio: 9/16; }
.sc-slot .mini-spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(99,102,241,.25); border-top-color: var(--primary);
  animation: dt-spin .8s linear infinite;
}
.sc-slot-err { color: var(--danger); font-size: 11px; padding: 8px; }
.sc-slot-link { margin-top: 6px; }

@media (max-width: 960px) {
  .sc-body { grid-template-columns: 1fr; }
  .sc-media { justify-content: flex-start; }
}

/* 资产定妆图区 */
.sb-assets { margin-top: 18px; padding: 16px; border-radius: 12px; background: rgba(99,102,241,.07); border: 1px solid rgba(99,102,241,.25); }
.sba-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sba-head h3 { margin: 0; font-size: 14.5px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.asset-list { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.asset-card {
  flex: 0 0 148px; width: 148px;
  background: #0d1117; border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
}
.asset-card.busy { border-color: var(--primary); }
.ac-slot {
  position: relative;
  width: 100%; aspect-ratio: 3/4; background: #0d1117;
  display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
}
.ac-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ac-slot .mini-spin {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2.5px solid rgba(99,102,241,.25); border-top-color: var(--primary);
  animation: dt-spin .8s linear infinite;
}
.ac-info { padding: 8px 9px; }
.ac-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-tag { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 10px; margin-top: 3px; }
.ac-tag.character { background: rgba(99,102,241,.2); color: #a5b4fc; }
.ac-tag.scene { background: rgba(63,185,80,.18); color: #7ee787; }
.ac-tag.prop { background: rgba(210,153,34,.18); color: #e3b341; }
.ac-actions { padding: 0 9px 9px; }
.ac-actions .btn { width: 100%; }
.ac-actions .btn + .btn { margin-top: 6px; }
.ac-err { color: var(--danger); font-size: 10.5px; padding: 6px 9px; word-break: break-all; }

/* 本地上传图片入口 */
#assets-upload-btn { margin-left: 10px; }
#assets-upload-status { margin-left: 8px; }
#vid-upload { width: 100%; }
.sc-actions .btn-ghost { border-style: dashed; }

/* 顶栏积分徽章 */
.credit-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; margin-right: 10px;
  background: linear-gradient(135deg, #fff4d6, #ffe4a8);
  border: 1px solid #f0c36d; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: #8a5a00;
  text-decoration: none; white-space: nowrap;
}
.credit-badge:hover { background: linear-gradient(135deg, #ffeec2, #ffd985); }

/* 视觉模块：参考图上传区 */
.ref-upload-area {
  border: 2px dashed #d0d7de;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: #fafbfc;
  margin-bottom: 4px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ref-upload-area .ref-placeholder { color: #8b949e; }
.visual-form .form-row { display: flex; gap: 12px; margin: 12px 0; }
.visual-form .form-cell { flex: 1; }
.visual-form .form-cell label { display: block; margin-bottom: 4px; font-size: 13px; }

.sb-shots-head { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 4px; }
.sb-shots-head h3 { margin: 0; font-size: 14.5px; }

/* 视频分段标题条 */
.seg-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 22px 0 10px; padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(99,102,241,.22), rgba(99,102,241,.06));
  border-left: 4px solid var(--primary);
}
.seg-bar:first-child { margin-top: 4px; }
.seg-bar-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg-bar-no { font-weight: 700; font-size: 14.5px; }
.seg-bar-name { font-size: 13.5px; color: #c9d1d9; background: rgba(255,255,255,.08); padding: 2px 10px; border-radius: 10px; }
.seg-bar-count { font-size: 12px; }
.seg-bar-ops { display: flex; gap: 8px; }
.sc-time { font-size: 11px; color: #a5b4fc; background: rgba(99,102,241,.15); padding: 2px 8px; border-radius: 10px; }
.sc-shot-type { font-size: 11px; color: #e3b341; background: rgba(210,153,34,.12); padding: 2px 8px; border-radius: 10px; }
.sc-refs { display: flex; gap: 4px; flex-wrap: wrap; }
.sc-ref { font-size: 10.5px; color: var(--muted); border: 1px solid rgba(255,255,255,.15); padding: 1px 6px; border-radius: 8px; }

/* ============ 项目工作台 ============ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; margin-top: 16px;
}
.card h3 { margin: 0 0 8px; font-size: 15px; }
.pj-create { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pj-create input[name=name] { flex: 0 0 220px; }
.pj-create input[name=description] { flex: 1; min-width: 200px; }
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
.pj-card {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; transition: .15s;
}
.pj-card:hover { background: var(--card-hover); border-color: var(--primary); transform: translateY(-2px); }
.pj-card-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.pj-card-desc { font-size: 12.5px; color: var(--text-soft); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pj-card-meta { font-size: 11.5px; }
.pj-add-script textarea, .pj-script-source textarea { width: 100%; }
.pa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.pa-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pa-thumb { aspect-ratio: 3/4; background: #0d1117; display: flex; align-items: center; justify-content: center; text-align: center; }
.pa-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pa-name { padding: 7px 9px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-name .ac-tag { margin-right: 5px; }
.ps-list { display: flex; flex-direction: column; gap: 10px; }
.ps-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px;
}
.ps-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.ps-ops { display: flex; gap: 8px; flex-shrink: 0; }
.pj-script-source { margin-bottom: 16px; }
@media (max-width: 640px) {
  .pj-create { flex-direction: column; align-items: stretch; }
  .pj-create input[name=name] { flex: none; }
  .ps-card { flex-direction: column; align-items: stretch; }
  .ps-ops { justify-content: flex-end; }
}
