/* AI 创作台 · 设计系统（原生 CSS，零依赖）
   类名约定（各页面统一复用，勿自造）：
     布局   .page .page-head .page-title .page-desc .section .section-head .grid .grid-2 .grid-3 .grid-4 .row .row-between .stack
     卡片   .card .card-head .card-body .card-foot .stat .stat-value .stat-label
     表单   .field .field-label .input .select .textarea .hint .err-text .check
     按钮   .btn .btn.primary .btn.ghost .btn.danger .btn.small .btn.block .icon-btn
     状态   .badge .badge.s-run .badge.s-done .badge.s-fail .pill .pill.ok .pill.warn .pill.err .muted .mono
     数据   .table .table-wrap .empty .skeleton .thumb .thumbs
     其他   .tabs .tab .tab.active .asset-grid .asset-card .task-card .hero .feature-card .tier .toast .modal
*/
:root {
  --bg: #0b0d12;
  --bg-soft: #10131a;
  --panel: #151922;
  --panel-2: #1b2130;
  --line: #262c3a;
  --line-soft: #1f2532;
  --text: #e9edf6;
  --muted: #97a1b6;
  --muted-2: #6b7688;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #7c5cff 0%, #4f8bff 55%, #22d3ee 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
}

* { box-sizing: border-box; }
/* .row/.stack/.grid 等类会设置 display，会盖掉 UA 的 [hidden]{display:none} —— 统一兜住 */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(34, 211, 238, 0.1), transparent 55%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.3; font-weight: 650; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
::selection { background: rgba(124, 92, 255, 0.4); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------------------------------- 布局 ---------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, rgba(21, 25, 34, 0.96), rgba(13, 16, 22, 0.96));
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent-grad);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.35);
}
.brand-text { font-weight: 700; font-size: 15px; display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--muted-2); font-weight: 500; font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-group { color: var(--muted-2); font-size: 11px; letter-spacing: 0.08em; padding: 14px 10px 6px; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--muted); font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav a.active { background: rgba(124, 92, 255, 0.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.35); }
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; }
.sidebar-foot { margin-top: auto; }
.balance-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font-size: 12px; color: var(--muted); }
.balance-card b { color: var(--text); font-size: 20px; display: block; line-height: 1.2; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 22px;
  display: flex; align-items: center; gap: 14px;
  background: rgba(11, 13, 18, 0.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-soft);
}
.crumb { font-weight: 600; color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb small { color: var(--muted-2); font-weight: 500; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.view { padding: 22px; max-width: 1180px; width: 100%; margin: 0 auto; flex: 1 1 auto; }
.only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 25; }

.page { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; margin: 0; }
.page-desc { color: var(--muted); margin: 4px 0 0; max-width: 720px; }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------------------------------- 卡片 ---------------------------------- */
.card { background: linear-gradient(180deg, var(--panel), var(--bg-soft)); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { display: flex; flex-direction: column; gap: 12px; }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.stat { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.accent .stat-value { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------- 表单 ---------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field-label .req { color: var(--err); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; background: #0e1118; border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 11px; font: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { min-height: 104px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.hint { color: var(--muted-2); font-size: 12px; }
.err-text { color: var(--err); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.seg { display: inline-flex; background: #0e1118; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 8px; cursor: pointer; font: inherit; }
.seg button.active { background: rgba(124, 92, 255, 0.2); color: #fff; }

/* ---------------------------------- 按钮 ---------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  transition: filter 0.15s, background 0.15s, transform 0.05s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(124, 92, 255, 0.28); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.4); color: #ffd7de; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }

/* ---------------------------------- 状态 / 徽标 ---------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.s-run { background: rgba(251, 191, 36, 0.14); border-color: rgba(251, 191, 36, 0.35); color: #ffe6a8; }
.badge.s-done { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.35); color: #b9f5da; }
.badge.s-fail { background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.35); color: #ffd0d9; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill.ok { color: #b9f5da; border-color: rgba(52, 211, 153, 0.35); }
.pill.warn { color: #ffe6a8; border-color: rgba(251, 191, 36, 0.35); }
.pill.err { color: #ffd0d9; border-color: rgba(251, 113, 133, 0.35); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 42px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--radius-sm); height: 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------- 表格 ---------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:hover td { background: rgba(255, 255, 255, 0.018); }
.table-wrap { overflow-x: auto; }

/* ---------------------------------- 任务 / 素材 ---------------------------------- */
.task-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.task-card:hover { border-color: var(--line); }
.task-prompt { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs a, .thumbs .thumb { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.thumb { width: 84px; height: 84px; object-fit: cover; background: #0e1118; }
.thumb.wide { width: 148px; height: 84px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.asset-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.asset-card .asset-media { aspect-ratio: 1 / 1; background: #0d1017; display: grid; place-items: center; overflow: hidden; }
.asset-card .asset-media img, .asset-card .asset-media video { width: 100%; height: 100%; object-fit: cover; }
.asset-card .asset-meta { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.asset-card .asset-actions { display: flex; gap: 6px; padding: 0 10px 10px; flex-wrap: wrap; }

/* ---------------------------------- 首页 ---------------------------------- */
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 24px; align-items: center; padding: 34px; border-radius: 22px; background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(34, 211, 238, 0.08) 60%, transparent), var(--panel); border: 1px solid var(--line-soft); }
.hero h1 { font-size: 34px; letter-spacing: -0.02em; }
.hero-sub { color: var(--muted); font-size: 15px; max-width: 560px; }
.hero-cta { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero-art { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-art .tile { aspect-ratio: 1/1; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(135deg, #1d2432, #12161f); display: grid; place-items: center; color: var(--muted-2); font-size: 12px; text-align: center; padding: 10px; }
.feature-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.feature-card .fc-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(124, 92, 255, 0.16); color: #cbbcff; }
.tier { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.tier.featured { border-color: rgba(124, 92, 255, 0.55); box-shadow: 0 12px 34px rgba(124, 92, 255, 0.18); }
.tier .price { font-size: 26px; font-weight: 750; }
.tier .price small { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------------------------------- 标签页 ---------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 9px 14px; cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap; }
.tab.active { color: #fff; border-bottom-color: var(--accent); }

/* ---------------------------------- 浮层 / 提示 ---------------------------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, 90vw); }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow); animation: in 0.18s ease; font-size: 13px; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal { position: fixed; inset: 0; background: rgba(4, 6, 10, 0.66); display: grid; place-items: center; z-index: 80; padding: 18px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; width: min(520px, 94vw); box-shadow: var(--shadow); max-height: 86vh; overflow: auto; }
.modal-card h3 { margin-top: 0; }

/* ---------------------------------- 用户菜单 ---------------------------------- */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 4px; cursor: pointer; color: var(--text); font: inherit; }
.avatar { width: 26px; height: 26px; border-radius: 999px; background: var(--accent-grad); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 40; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.dropdown a:hover, .dropdown button:hover { background: rgba(255, 255, 255, 0.05); }
.dropdown hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 0; }

/* ---------------------------------- 进度 ---------------------------------- */
.progress { height: 6px; border-radius: 999px; background: #0e1118; overflow: hidden; border: 1px solid var(--line-soft); }
.progress > i { display: block; height: 100%; background: var(--accent-grad); transition: width 0.4s ease; }

/* ---------------------------------- 响应式 ---------------------------------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-grid; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.22s ease; }
  .sidebar.open { transform: none; }
  .view { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 26px; }
}

/* ---------------------------------- 知识科普视频（/create/knowledge） ---------------------------------- */
/* 节点进度卡：与知识视频子系统引擎页的「节点进度」同一套信息层级，只换成本站设计令牌。
   节点名称/描述/产物 HTML 都由视图拼好，这里只管呈现。 */
.kv-node { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.kv-node[open] { border-color: var(--line); }
.kv-node > summary { display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.kv-node > summary::-webkit-details-marker { display: none; }
.kv-no { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.kv-node[open] .kv-no { color: #fff; background: rgba(124, 92, 255, 0.22); border-color: rgba(124, 92, 255, 0.45); }
.kv-name { font-weight: 650; }
.kv-desc { flex: 1 1 140px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-node-body { padding: 12px 13px 13px 45px; border-top: 1px solid var(--line-soft); }
.kv-kv { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 6px 10px; font-size: 13px; align-items: baseline; }
.kv-kv .k { color: var(--muted); }
.kv-kv b { font-weight: 600; word-break: break-word; }
.kv-sw { display: inline-flex; gap: 2px; margin-right: 6px; vertical-align: middle; }
.kv-sw i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid rgba(255, 255, 255, 0.16); }
.kv-frame { width: 100%; height: 360px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; margin-top: 10px; }
.kv-video { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #000; margin-top: 10px; }
.kv-pre { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7; color: var(--muted); background: #0e1118; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px; max-height: 240px; overflow: auto; margin: 6px 0 0; }
.kv-slide { border-left: 2px solid var(--line); padding: 2px 0 2px 10px; }
.kv-audio-list { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.kv-audio-list audio { width: 100%; }
.kv-anim-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.kv-anim-grid a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.kv-anim-grid img { width: 100%; height: auto; }
.kv-subs { max-height: 220px; overflow: auto; font-size: 12px; display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }

@media (max-width: 860px) {
  .kv-node-body { padding-left: 13px; }
  .kv-anim-grid { grid-template-columns: 1fr; }
  .kv-frame { height: 260px; }
}
