/* GOUYING AI PLATFORM - 浅色主题，延续 prototype 风格 */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --text: #172033;
  --muted: #697386;
  --line: #e4e8f0;
  --primary: #5b5bd6;
  --primary-soft: #ededff;
  --cyan: #128a9d;
  --cyan-soft: #e8f8fa;
  --orange: #a15c08;
  --orange-soft: #fff4df;
  --red: #c43d4b;
  --red-soft: #fff0f2;
  --green: #16805c;
  --green-soft: #eaf8f1;
  --shadow: 0 10px 30px rgba(38, 50, 85, .07);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(91, 91, 214, .25); outline-offset: 2px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 26px; letter-spacing: -.5px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 登录 / 注册 ---------- */
.login-page { display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(430px, .95fr); min-height: 100dvh; }
.story { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 46px 56px; overflow: hidden; background: linear-gradient(145deg, #ececff, #f8f7ff 55%, #edf8fa); border-right: 1px solid var(--line); }
.story::after { content: ""; position: absolute; right: -140px; bottom: -160px; width: 460px; height: 460px; border: 1px solid #d6d8f5; border-radius: 50%; box-shadow: 0 0 0 65px rgba(255,255,255,.25), 0 0 0 130px rgba(255,255,255,.18); }
.story .brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.hero { position: relative; z-index: 1; max-width: 580px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: 1.5px; }
.hero h1 { margin: 16px 0 20px; font-size: clamp(34px, 4vw, 58px); line-height: 1.14; letter-spacing: -1.8px; }
.hero p { max-width: 500px; color: var(--muted); font-size: 16px; line-height: 1.85; }
.flow { display: flex; align-items: center; gap: 10px; margin-top: 30px; }
.flow span { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #d8daef; border-radius: 14px; background: rgba(255,255,255,.7); color: var(--primary); font-weight: 750; }
.flow i { width: 30px; height: 1px; background: #bfc3df; }
.story .note { position: relative; z-index: 1; color: var(--muted); font-size: 12px; }
.login-side { display: grid; place-items: center; padding: 40px 28px; background: var(--surface); }
.login-box { width: min(420px, 100%); }
.login-box h2 { margin: 0 0 9px; font-size: 28px; letter-spacing: -.5px; }
.login-box .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); }
.login-box .tab { padding: 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.login-box .tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px rgba(40,50,80,.07); font-weight: 650; }
.input-wrap { position: relative; }
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; padding: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.send-code { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; padding: 6px 10px; border-radius: 6px; background: var(--primary); color: #fff; cursor: pointer; font-size: 12px; white-space: nowrap; }
.send-code:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.send-code + input { padding-right: 90px; }
.submit { width: 100%; padding: 13px; border: 1px solid var(--primary); border-radius: 10px; background: var(--primary); color: #fff; font-weight: 650; cursor: pointer; }
.submit:hover { background: #4d4dc4; }
.message { min-height: 22px; margin-top: 12px; color: var(--red); font-size: 12px; text-align: center; }
.secure { margin-top: 20px; padding: 13px; border-radius: 9px; background: var(--green-soft); color: var(--green); font-size: 12px; line-height: 1.7; }
@media (max-width: 850px) { .login-page { grid-template-columns: 1fr; } .story { display: none; } .login-side { min-height: 100dvh; padding: 32px 22px; } }

/* ---------- 应用骨架 ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 24px 16px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 800; font-size: 21px; box-shadow: 0 6px 18px rgba(91,91,214,.22); }
.brand strong { display: block; font-size: 15px; letter-spacing: .7px; }
.brand strong.brand-cn { font-size: 24px; line-height: 1.1; letter-spacing: 4px; font-weight: 800; }
.story .brand strong.brand-cn { font-size: 34px; letter-spacing: 6px; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: 1.5px; }
.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 22px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--line); }
.role-switch button { border: 0; border-radius: 7px; padding: 8px; color: var(--muted); background: transparent; }
.role-switch button.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 7px rgba(30,40,70,.08); font-weight: 650; }
.nav-title { padding: 16px 10px 7px; color: #929bad; font-size: 11px; letter-spacing: 1.1px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 11px; margin: 2px 0; border: 0; border-radius: 9px; background: transparent; color: #4f5b70; text-align: left; }
.nav-item:hover { background: var(--surface-soft); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.nav-icon { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid currentColor; border-radius: 6px; font-size: 10px; opacity: .8; }
.sidebar-note { margin: 24px 7px 0; padding: 13px; border-radius: 10px; background: var(--primary-soft); color: #4d4da8; font-size: 12px; line-height: 1.7; }
.shell { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 70px; padding: 0 30px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--text); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.balance-chip { border: 1px solid #dddffa; border-radius: 9px; padding: 8px 12px; background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #e8edf7; color: #526079; font-weight: 700; }
main#pageContainer { padding: 28px 30px 48px; max-width: 1600px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.sub { color: var(--muted); line-height: 1.7; margin-bottom: 0; }

/* ---------- 通用组件 ---------- */
.btn { border: 1px solid var(--line); border-radius: 9px; padding: 9px 14px; background: var(--surface); color: var(--text); font-weight: 550; }
.btn:hover { border-color: #c9cddd; }
.btn-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-primary:hover { background: #4d4dc4; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn-sm { padding: 4px 11px; border-radius: 7px; font-size: 12px; font-weight: 550; }
.btn-danger { color: var(--red); }

/* 上传小说 / 剧本：短剧流程的第一步，用青色实心强调，
   与「开始生成」的主色按钮区分开，免得用户不知道从哪下手 */
.btn-upload {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(18, 138, 157, .22);
}
.btn-upload:hover {
  background: #0f7788;
  border-color: #0f7788;
  transform: translateY(-1px);
}
.btn-upload.is-picked {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 6px 16px rgba(22, 128, 92, .22);
}
.full { width: 100%; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 5px rgba(33,44,72,.015); }
.card-pad { padding: 20px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.search { min-width: 220px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); }
.filter { border: 1px solid var(--line); border-radius: 8px; padding: 8px 13px; background: var(--surface); color: var(--muted); }
.filter.active { border-color: #cfd0f6; background: var(--primary-soft); color: var(--primary); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
/* 模型广场：卡片按内容取高，不被同行最高的那张拉长（拉长就会在按钮上方留白） */
.model-grid { align-items: start; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tag { display: inline-flex; align-items: center; border-radius: 6px; padding: 4px 7px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 650; }
.tag.cyan { background: var(--cyan-soft); color: var(--cyan); }
.tag.orange { background: var(--orange-soft); color: var(--orange); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.gray { background: var(--surface-soft); color: var(--muted); }
.price { color: var(--primary); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.kv { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; color: var(--muted); font-size: 13px; }
.kv strong { color: var(--text); font-weight: 550; text-align: right; }
.secure-note { padding: 12px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 12px; line-height: 1.65; }
.warn-note { padding: 12px; border-radius: 8px; background: var(--orange-soft); color: var(--orange); font-size: 12px; line-height: 1.65; }
.error-note { padding: 12px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 13px; line-height: 1.65; }
.error-note .btn { margin-left: 8px; }
.empty-note { padding: 40px; text-align: center; color: var(--muted); }
.field { margin: 14px 0; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #babcf0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 550; }
td { font-size: 13px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 18px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.page-buttons { display: flex; align-items: center; gap: 5px; }
.page-buttons button { min-width: 31px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); }
.page-buttons button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.stat { padding: 19px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin: 9px 0 5px; font-size: 27px; font-weight: 730; letter-spacing: -.5px; }

/* 模型卡片 */
/* 卡片只负责"把信息摆全"，不靠留白撑版面：
   原来顶部色块固定 130px、字母方块 62px，却只放一个标签，等于每张卡白占半屏。 */
.model-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.model-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.model-cover { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 13px; background: linear-gradient(135deg, #e9e9ff, #f5efff); }
.model-cover.cyan { background: linear-gradient(135deg, #e3f6f7, #edf9f3); }
.model-cover.orange { background: linear-gradient(135deg, #fff0dc, #fff7ee); }
.model-symbol { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.75); color: var(--primary); font-size: 13px; font-weight: 750; flex: none; }
.model-body { display: flex; flex-direction: column; flex: 1; padding: 11px 13px 9px; }
.model-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.model-meta h3 { font-size: 15px; line-height: 1.35; }
.model-desc { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 卡内档位行：跟卡片一起压缩，别再用列表那种 10px 上下留白 */
.model-card .kv { padding: 2px 0; font-size: 12.5px; }
.model-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.model-foot .btn { padding: 4px 12px; font-size: 12.5px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; }
.detail-hero { padding: 26px; margin-bottom: 20px; }
.detail-title { display: flex; align-items: center; gap: 14px; }
.detail-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); font-size: 22px; font-weight: 750; }
.schema-row { display: grid; grid-template-columns: 130px 90px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.price-panel { position: sticky; top: 92px; align-self: start; }
.price-big { margin: 14px 0; font-size: 30px; color: var(--primary); font-weight: 750; }
.price-big small { color: var(--muted); font-size: 13px; font-weight: 400; }

/* 问答生成
   旧写法 .qa-wrap { height: calc(100dvh - 180px); min-height: 560px } 靠硬编码估算
   「topbar 70 + 主区 padding 28 + 页头约 80」的占位：一旦视口偏矮、页头换行或浏览器缩放，
   min-height 会把卡片顶出视口，历史消息一多，输入区就被挤到浏览器窗口下面，要滚页面才看得见。
   改为：问答页主区域变成占满视口的 flex 列，把「剩余高度」分给 .qa-wrap；
   消息只在 .qa-messages 内部滚动，.qa-composer 始终固定在卡片底部可见。 */
main#pageContainer.qa-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);   /* 旧浏览器回退 */
  height: calc(100dvh - 70px);  /* 70px = .topbar 固定高度，唯一需要对齐的尺寸 */
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
}
/* 问答页紧凑页头：标题贴左上，副标题同行，整体只占一行高度 */
.qa-pagehead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; flex: 0 0 auto; margin: 0 0 8px; padding: 0 2px; }
.qa-pagehead h1 { margin: 0; font-size: 19px; line-height: 1.3; }
.qa-pagehead .sub { margin: 0; color: var(--muted); font-size: 12px; }
.qa-wrap { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1 1 0; height: auto; min-height: 0; overflow: hidden; }
.qa-sidebar { min-height: 0; padding: 13px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.qa-session { padding: 9px 10px; margin: 5px 0; border-radius: 9px; color: #4f5b70; }
.qa-session small { display: block; margin-top: 3px; color: var(--muted); }
.qa-main { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: #f8f9fd; }
.qa-messages { min-height: 0; padding: 12px 20px; overflow-y: auto; }
/* 极矮视口：不再压缩卡片，改为整页滚动，保证输入区不被 overflow:hidden 裁掉 */
@media (max-height: 560px) {
  main#pageContainer.qa-page { overflow-y: auto; }
  main#pageContainer.qa-page .qa-wrap { flex: 0 0 auto; min-height: 420px; }
}
.message-row { display: flex; margin: 10px 0; }
.message-row.user { justify-content: flex-end; }
.message-bubble { max-width: 72%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); line-height: 1.65; }
.message-row.user .message-bubble { background: var(--primary-soft); border-color: #d8d9f7; }
/* 提问时间：贴在提问气泡下方，弱化为次要信息 */
.message-time { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: right; }
/* 消息头部一行：模型名 + 状态 + 修改/重新生成（不再单独占一行） */
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.msg-meta .msg-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.generation-result { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.media-placeholder { display: grid; place-items: center; min-height: 150px; background: linear-gradient(135deg, #e9e9ff, #edf8fa); color: var(--primary); font-weight: 750; text-align: center; padding: 10px; }
.media-placeholder.video { background: linear-gradient(135deg, #fff0dc, #edf8fa); color: var(--orange); }
.generation-result img, .generation-result video { display: block; width: 100%; max-height: 320px; object-fit: contain; background: #0e1526; }
.generation-result footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; color: var(--muted); font-size: 12px; }
.qa-composer { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.composer-box { position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 14px rgba(35,45,75,.04); }
/* 提示词编辑区：默认更高；右上角小按钮可把输入框向上提（展开成大输入区） */
.qa-editor-wrap { position: relative; }
.qa-editor { display: block; width: 100%; min-height: 208px; max-height: 420px; overflow-y: auto; padding: 13px 46px 13px 15px; border: 0; color: var(--text); background: transparent; font: inherit; line-height: 1.7; white-space: pre-wrap; word-break: break-word; outline: none; }
.qa-editor-wrap.expanded .qa-editor { min-height: 46vh; max-height: 64vh; }
.qa-expand { position: absolute; right: 9px; top: 8px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; }
.qa-expand:hover { color: var(--primary); border-color: #d8d9f7; background: var(--primary-soft); }
/* 提示词编辑器：可编辑 div，支持内嵌 @ 图片 chip */
.qa-editor:focus { outline: none; }
.qa-editor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.composer-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-pill { border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; background: var(--surface); color: var(--muted); }
.mode-pill.active { border-color: #c9c9f2; background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.estimate { color: var(--muted); font-size: 12px; }
.qa-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-soft); }
.qa-seg .mode-pill { border: 0; border-radius: 0; }
.qa-seg .mode-pill.active { background: var(--primary); color: #fff; }
.qa-field { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.qa-field .qa-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.qa-field select { border: 0; background: transparent; color: var(--text); font-weight: 600; padding: 4px 2px; cursor: pointer; }
.qa-field select:focus { outline: none; }
/* 数字型参数（时长）也做成"胶囊内直接编辑"，与下拉同一观感 */
.qa-field input[type="number"] { border: 0; background: transparent; color: var(--text); font-weight: 600; padding: 4px 2px; text-align: center; }
.qa-field input[type="number"]:focus { outline: none; }
/* 运营端模型测试：当前任务不收素材时的说明块 */
.mt-slots-empty { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; }
.composer-submit { display: flex; align-items: center; gap: 12px; }
.qa-cost { font-size: 14px; font-weight: 650; color: var(--primary); white-space: nowrap; }

/* 参考素材上传 */
/* 参考素材缩略图卡片：序号 + 删除，数量提示 */
.qa-files { padding: 12px 15px 0; }
.qa-files-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.qa-files-head strong { color: var(--primary); }
.qa-files-tip { margin-left: auto; font-size: 11px; opacity: .8; }
.qa-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.qa-thumb { position: relative; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface-soft); }
.qa-thumb-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.qa-thumb-ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: 11px; }
.qa-thumb-no { position: absolute; left: 2px; bottom: 2px; display: grid; place-items: center; min-width: 12px; height: 12px; padding: 0 2px; border-radius: 4px; background: rgba(20,24,38,.72); color: #fff; font-size: 9px; line-height: 1; }
.qa-thumb-x { position: absolute; right: 1px; top: 1px; display: grid; place-items: center; width: 13px; height: 13px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: #333; font-size: 10px; line-height: 1; cursor: pointer; }
.qa-thumb-x:hover { background: var(--red); color: #fff; }

/* 上传占位态：本地预览模糊 + 加载转圈；失败项红色角标；生成按钮 hover 提示 */
.qa-thumb-uploading { border-color: var(--primary); }
.qa-thumb-img-pending { filter: blur(3px); opacity: .78; transform: scale(1.08); }
.qa-thumb-mask { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: rgba(20,24,38,.18); pointer-events: none; }
.qa-thumb-spinner { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid rgba(255,255,255,.55); border-top-color: var(--primary); border-radius: 50%; animation: qa-thumb-spin .8s linear infinite; pointer-events: none; }
@keyframes qa-thumb-spin { to { transform: rotate(360deg); } }
.qa-thumb-failed { border-color: var(--red); }
.qa-thumb-badge { position: absolute; left: 2px; top: 2px; display: grid; place-items: center; width: 12px; height: 12px; border-radius: 50%; background: var(--red); color: #fff; font-size: 9px; font-weight: 700; line-height: 1; pointer-events: none; }
.qa-submit-wrap { position: relative; display: inline-flex; }
.qa-submit-wrap[data-tip]:hover::after { content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; white-space: nowrap; padding: 6px 10px; border-radius: 8px; background: rgba(20,24,38,.92); color: #fff; font-size: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.18); pointer-events: none; }
.qa-mention-flag { margin-left: auto; font-size: 10px; font-weight: 600; white-space: nowrap; }
.qa-mention-flag.pending { color: var(--primary); }
.qa-mention-flag.failed { color: var(--red); }

/* 提示词里的 @图片N inline chip（不可编辑，带小缩略图） */
.qa-mention { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 3px; margin: 0 2px; border: 1px solid #d8d9f7; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 600; vertical-align: middle; user-select: none; }
.qa-mention img { display: block; width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }

/* 输入 @ 后弹出的参考素材选择浮层 */
.qa-mention-menu { position: absolute; left: 12px; bottom: 100%; margin-bottom: 8px; z-index: 20; width: min(320px, calc(100% - 24px)); max-height: 240px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgba(33,43,70,.18); }
.qa-mention-title { padding: 6px 8px; color: var(--muted); font-size: 11px; }
.qa-mention-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; font-size: 12px; cursor: pointer; }
.qa-mention-item:hover { background: var(--surface-soft); }
.qa-mention-item img, .qa-mention-ph { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; object-fit: cover; background: var(--surface-soft); color: var(--muted); font-size: 12px; }

/* 充值 */
.recharge-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; }
.balance-panel { padding: 25px; margin-bottom: 18px; background: linear-gradient(120deg, #ededff, #f8f7ff); }
.balance-number { margin: 8px 0; font-size: 36px; font-weight: 760; color: var(--primary); }
.package-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 20px; }
.package { position: relative; padding: 20px 14px; border: 1px solid var(--line); border-radius: 11px; text-align: center; background: var(--surface); }
.package.selected { border: 2px solid var(--primary); background: var(--primary-soft); }
.package strong { display: block; margin: 7px 0; font-size: 22px; }
.package .bonus { color: var(--orange); font-size: 11px; }
.pay-panel { padding: 22px; align-self: start; }
.payment-empty { display: grid; place-items: center; min-height: 300px; padding: 30px; color: var(--muted); text-align: center; }
.payment-empty-icon { display: grid; place-items: center; width: 74px; height: 74px; margin: 0 auto 18px; border: 1px dashed #c9cfdd; border-radius: 20px; background: var(--surface-soft); color: var(--primary); font-size: 26px; }
.record-link { display: block; margin: 16px auto 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.record-link:hover { color: var(--primary); }

/* 公告 */
.announcement-button { position: relative; }
.announcement-badge { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border: 2px solid var(--surface); border-radius: 12px; background: var(--red); color: #fff; font-size: 10px; font-weight: 750; }
.announcement-item { border-bottom: 1px solid var(--line); }
.announcement-item:last-of-type { border-bottom: 0; }

/* API Key */
.apikey-once { word-break: break-all; padding: 14px; border-radius: 9px; background: var(--surface-soft); border: 1px dashed #c9cfdd; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }

/* API 文档 */
.code-block { padding: 13px 15px; margin: 10px 0; border-radius: 9px; background: #1f2430; color: #e6e8ef; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; line-height: 1.7; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.code-block .method { display: inline-block; padding: 1px 8px; margin-right: 8px; border-radius: 5px; background: var(--primary); color: #fff; font-weight: 700; font-size: 11px; }
.copy-area { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--text); font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; resize: vertical; }
.table-mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-mini th, .table-mini td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.table-mini th { color: var(--muted); font-weight: 600; }

/* API 文档：每个模型的参数/素材/示例默认折叠，先让人扫一眼模型清单 */
.api-detail { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.api-detail > summary { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; list-style: none; user-select: none; color: var(--primary); font-size: 13px; font-weight: 600; }
.api-detail > summary::-webkit-details-marker { display: none; }
.api-detail > summary::before { content: "▸"; display: inline-block; transition: transform .15s; }
.api-detail[open] > summary::before { transform: rotate(90deg); }
.api-detail > summary:hover { opacity: .8; }
.api-detail-tags { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.api-detail-body { padding-top: 6px; }

/* 短剧创作：左边（首张）是「添加作品」，其余是作品卡 */
.drama-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .drama-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.drama-card { display: flex; flex-direction: column; gap: 8px; padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; }
.drama-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.drama-card-head h3 { margin: 0; font-size: 15px; line-height: 1.4; word-break: break-all; }
.drama-card-script { min-height: 20px; overflow-wrap: anywhere; }
.drama-card-script a { color: var(--primary); text-decoration: none; }
.drama-card-script a:hover { text-decoration: underline; }
.drama-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.drama-card-models { padding: 4px 10px; border-radius: 8px; background: var(--surface-soft); }
.drama-card-models .kv { padding: 5px 0; font-size: 12px; }
.drama-card-models .kv + .kv { border-top: 1px solid var(--line); }
.drama-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.drama-card-foot .btn { padding: 4px 10px; font-size: 12px; }
/* 新建卡：虚线 + 居中，视觉上明确"这里可以点" */
.drama-card-new { align-items: center; justify-content: center; gap: 6px; min-height: 200px; border-style: dashed; background: transparent; color: var(--muted); cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.drama-card-new:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.drama-new-plus { font-size: 30px; line-height: 1; font-weight: 300; }
.drama-new-title { font-size: 14px; font-weight: 650; }

/* 「添加作品」卡：淡紫红底 + 紫红虚线边，和已有作品卡一眼分得开，但不刺眼（玫红整块会太跳） */
.drama-add { background: rgba(219, 112, 147, .07); border: 1px dashed rgba(190, 78, 120, .42); color: #a4506f; }
.drama-add:hover { background: rgba(219, 112, 147, .14); border-color: rgba(190, 78, 120, .72); color: #8c3f5c; }
.drama-add .drama-new-plus { color: #b4567a; }
.drama-add-hint { font-size: 12px; line-height: 1.6; opacity: .8; }

/* 已有作品卡整块可点（进详情）：hover 抬一点，明确"能点进去" */
.drama-card-open { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.drama-card-open:hover { border-color: #c9cdf0; box-shadow: var(--shadow); transform: translateY(-1px); }
.drama-card-title { display: block; max-width: 100%; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 15px; font-weight: 650; line-height: 1.4; text-align: left; word-break: break-all; }
.drama-card-open:hover .drama-card-title { color: var(--primary); }

/* 新建页：上传文件 / 粘贴正文 两个 tab */
.drama-source-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.drama-tab { padding: 6px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 13px; }
.drama-tab.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.drama-source-pane { display: block; }
.drama-paste { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--text); font-size: 13px; line-height: 1.7; resize: vertical; }
.drama-paste-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }

/* 作品详情：顶部操作 / 参数摘要 / 按集剧本列表 */
.drama-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.drama-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 22px; margin-bottom: 16px; }
.drama-summary .kv { border-bottom: 1px solid var(--line); }
.drama-ep-card { padding: 4px 0 6px; }
/* 剧本列表空态：用户上传完小说就来这里，得说清「空的」是正常的、下一步做什么 */
.drama-ep-empty { padding: 26px 18px 30px; text-align: center; }
.drama-ep-empty p { margin: 0 0 8px; }
.drama-ep-empty code { padding: 1px 5px; border-radius: 4px; background: var(--surface-soft); font-size: 12px; }
.drama-detail-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.drama-detail-head h3 { margin: 0; }
.drama-ep-row { border-bottom: 1px solid var(--line); }
.drama-ep-row:last-child { border-bottom: 0; }
/* 头部分两层：左边整块可点展开，右边独立「编辑」——不能把 button 套进 button 里 */
.drama-ep-head { display: flex; align-items: stretch; }
.drama-ep-head .drama-ep-toggle { flex: 1 1 auto; width: auto; min-width: 0; }
.drama-ep-edit { flex: 0 0 auto; align-self: center; margin: 0 16px 0 4px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.drama-ep-edit:hover { color: var(--primary); border-color: var(--primary); background: var(--surface-soft); }
/* 剧本正文编辑：等宽字体更接近剧本排版，行高放宽便于逐行改台词 */
.drama-script-edit { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.75; }
.drama-ep-toggle { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 18px; border: 0; background: transparent; color: var(--text); text-align: left; }
.drama-ep-toggle:hover { background: var(--surface-soft); }
.drama-ep-no { flex: 0 0 auto; min-width: 62px; color: var(--primary); font-size: 13px; font-weight: 650; }
.drama-ep-title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.drama-ep-meta { flex: 0 0 auto; }
.drama-ep-caret { flex: 0 0 auto; color: var(--muted); font-size: 11px; transition: transform .15s; }
.drama-ep-toggle[aria-expanded="true"] .drama-ep-caret { transform: rotate(90deg); }
.drama-ep-body { padding: 0 18px 14px; }
.drama-ep-content { max-height: 420px; overflow: auto; padding: 12px 14px; border-radius: 9px; background: var(--surface-soft); font-size: 13px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 800px) {
  .drama-summary { grid-template-columns: 1fr; }
  .drama-ep-toggle { flex-wrap: wrap; gap: 6px; }
}

/* 新建表单：上传行 + 视频尺寸二选一 */
.drama-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drama-ratio-row { display: flex; gap: 8px; }
.drama-ratio { padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.drama-ratio.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 650; }

/* 供应商 */
.import-check, .import-price, .import-schema { font-size: 13px; }
.import-price, .import-schema { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }

/* 运营端 */
.admin-banner { padding: 13px 16px; margin-bottom: 18px; border: 1px solid #f0dfbd; border-radius: 10px; background: var(--orange-soft); color: var(--orange); }
.ratio-bar { display: flex; width: 100%; min-width: 140px; height: 9px; overflow: hidden; border-radius: 8px; background: var(--surface-soft); }
.ratio-success { background: var(--green); }
.ratio-failure { background: var(--red); }

/* 对话框与提示 */
dialog { width: min(560px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 70px rgba(33,43,70,.18); }
dialog::backdrop { background: rgba(40, 46, 65, .28); }
/* 查看大图：默认 560px 太窄，这里放宽到近全屏并加深遮罩；内容超高时弹窗内部滚动 */
dialog.dialog-large { width: min(1200px, calc(100vw - 40px)); max-height: 92vh; }
dialog.dialog-large::backdrop { background: rgba(18, 22, 36, .74); }
dialog.dialog-large .dialog-body { max-height: calc(92vh - 140px); overflow: auto; padding: 14px 20px; }
.dialog-head, .dialog-body, .dialog-foot { padding: 18px 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.dialog-foot:empty { display: none; }
.captcha-box { display: flex; align-items: center; gap: 12px; }
.captcha-box img { border: 1px solid var(--line); border-radius: 8px; }
/* 登录页的图形验证码：输入框占满剩余宽度，图片固定在右侧 */
.captcha-box input { flex: 1; min-width: 0; }
.toast { position: fixed; z-index: 30; right: 26px; bottom: 26px; display: none; max-width: 380px; padding: 15px 18px; border: 1px solid #cce8db; border-radius: 11px; background: var(--green-soft); color: var(--green); box-shadow: var(--shadow); }
.toast.show { display: block; }
.toast.error { border-color: #f1ccd1; background: var(--red-soft); color: var(--red); }
.loading { padding: 60px; text-align: center; color: var(--muted); }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .detail-layout, .recharge-layout { grid-template-columns: 1fr; }
  .price-panel { position: static; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 18px 9px; }
  .sidebar .brand strong, .sidebar .brand small, .nav-item span:not(.nav-icon), .nav-title, .sidebar-note, .role-switch { display: none; }
  .sidebar .brand { justify-content: center; padding: 0 0 20px; }
  .nav-item { justify-content: center; }
  .topbar { padding: 0 16px; }
  #userEmail { display: none; }
  main#pageContainer { padding: 20px 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .qa-wrap { grid-template-columns: 1fr; }
  .qa-sidebar { display: none; }
  .page-head { flex-direction: column; }
}

/* 模型定价档位对话框 */
.pf-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pf-row:last-child { border-bottom: 0; }
.pf-check { display: inline-flex; align-items: center; gap: 8px; min-width: 90px; color: var(--text); font-weight: 500; cursor: pointer; }
.pf-check input { width: 16px; height: 16px; cursor: pointer; }
.pf-row input[type="number"] { flex: 0 0 auto; }

/* 生成结果：大图预览 */
.result-img { cursor: zoom-in; }

/* 数据明细：类型多选下拉（原生 details，勾选后保持展开不丢状态） */
.records-filter { position: relative; display: inline-block; }
.records-filter > summary {
  cursor: pointer; list-style: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 13px; background: var(--surface); color: var(--text); font-size: 13px;
  user-select: none;
}
.records-filter > summary::-webkit-details-marker { display: none; }
.records-filter > summary::after { content: " ▾"; color: var(--muted); }
.records-filter[open] > summary { border-color: #cfd0f6; background: var(--primary-soft); color: var(--primary); }
.records-type-panel {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 210px;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
  display: flex; flex-direction: column; gap: 9px;
}
.records-type-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.records-type-check input { width: 15px; height: 15px; cursor: pointer; }
/* 数据明细的产物缩略：图片给 48px 小图，视频只给播放按钮（单条 15MB，不能预加载） */
.records-thumb { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); overflow: hidden; cursor: pointer; }
.records-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.records-thumb:hover { border-color: var(--primary); }
.records-thumb.video { color: var(--primary); font-size: 15px; }
.records-type-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
