/* ===== 图片创作补充、兑换码、后台补充样式 ===== */
/* =========================================================
   漫剧工坊
   ========================================================= */

.status-pill.skipped { color: #64748b; background: #f1f5f9; }

.admin-inline-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; color: #334155; font-size: 12px; }
.admin-inline-check input { width: 15px; height: 15px; accent-color: var(--blue); }
.admin-test-result { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 11px 13px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; }
.admin-test-result.ok { color: #047857; background: #ecfdf5; border-color: #bbf7d0; }
.admin-test-result.bad { color: #b42318; background: #fef3f2; border-color: #fecaca; }
.admin-test-result div { display: grid; gap: 3px; }
.admin-test-result strong { font-size: 12.5px; }
.admin-test-result span { color: inherit; font-size: 11px; opacity: .85; }

/* ----------------------------- 图片创作 ----------------------------- */
/* 只留创作面板一栏：结果统一去「我的作品」看，这里不再重复铺作品网格 */
/* 图片创作沿用视频页的三栏布局（模型 / 参数 / 提示词），铺满内容区 */
.image-workspace { max-width: none; margin: 0; width: 100%; }
.image-workspace .creation-prompt { border-right: 0; border-radius: 0 18px 18px 0; }
/* 图片模型卡：名称 + 模型 id + 单价/参考图能力 */
.image-model-meta { color: var(--muted); font-size: 11px; word-break: break-all; }
.image-model-line { display: flex; align-items: baseline; gap: 8px; }
.image-model-line b { font-size: 12px; color: var(--blue); }
.image-model-line small { color: var(--muted); font-size: 11px; }
.image-model-rate { font-size: 11px; color: #15803d; }
.image-model-rate.is-poor { color: #b42318; }
.image-prompt-panel { display: flex; flex-direction: column; gap: 14px; }
.image-templates { display: flex; flex-wrap: wrap; gap: 8px; }
.image-template-chip { padding: 7px 14px; font-size: 13px; color: var(--muted, #475569); background: #f8fafc; border: 1px solid var(--border, #e2e8f0); border-radius: 999px; cursor: pointer; transition: all .15s ease; }
.image-template-chip:hover { color: var(--primary, #2563eb); border-color: var(--primary, #2563eb); background: #eff6ff; }
.image-prompt-input { width: 100%; padding: 12px 14px; font: inherit; font-size: 14px; line-height: 1.6; color: var(--text, #0f172a); background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; resize: vertical; min-height: 110px; }
.image-prompt-input:focus { outline: none; border-color: var(--primary, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.image-size-segments { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-test-sample { width: 132px; height: 132px; object-fit: cover; margin-left: auto; border-radius: 10px; border: 1px solid var(--border, #e2e8f0); }

/* 图片作品缩略图：网格里直接显示成图，而不是一个「点击查看」的色块 */
.work-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  overflow: hidden;
}
.work-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.work-card:hover .work-thumb img { transform: scale(1.03); }
.work-thumb-skel { display: grid; place-items: center; color: #94a3b8; }
.work-thumb-skel .icon { width: 26px; height: 26px; fill: none; stroke: currentColor; }
.work-thumb-count {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  color: #fff;
  background: rgba(11, 21, 48, .62);
  border-radius: 999px;
  font-size: 11px;
  backdrop-filter: blur(3px);
}
.work-thumb-count .icon { width: 12px; height: 12px; }

/* 图片创作页：参考图上传区 */
.image-ref-field { display: flex; flex-direction: column; gap: 10px; }
.image-ref-list { display: flex; flex-wrap: wrap; gap: 10px; }
.image-ref-item {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  cursor: zoom-in;
  background: #f1f5f9;
}
.image-ref-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  color: #fff;
  background: rgba(15, 23, 42, .62);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.image-ref-remove:hover { background: #dc2626; }
.image-ref-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 84px;
  height: 84px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  transition: all .15s ease;
}
.image-ref-add:hover { color: #2563eb; border-color: #2563eb; background: #eff6ff; }
.image-ref-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.image-ref-hint { display: inline-flex; align-items: center; gap: 5px; color: #94a3b8; font-size: 12px; line-height: 1.5; }
.image-ref-hint .icon { width: 13px; height: 13px; }
.image-ref-status { margin: 0; color: #2563eb; font-size: 12px; }
.link-button { padding: 0; color: #2563eb; background: none; border: 0; font-size: 12px; cursor: pointer; text-decoration: underline; }
.image-ref-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 16px; max-height: 52vh; overflow-y: auto; }
.image-ref-pick { padding: 0; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; overflow: hidden; background: #f1f5f9; cursor: pointer; aspect-ratio: 1 / 1; }
.image-ref-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-ref-pick:hover { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }

/* 作品详情：参考图 / 多图结果 */
.modal-media.is-image { cursor: zoom-in; overflow: hidden; }
.modal-media.is-image img { width: 100%; max-height: 420px; object-fit: contain; display: block; border-radius: 13px; }
.image-open-button { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; color: #2563eb; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 9px; font-size: 12px; cursor: pointer; }
.image-open-button:hover { background: #dbeafe; }
.work-detail-prompt { max-height: 132px; overflow-y: auto; white-space: pre-wrap; }
.work-detail-refs, .work-detail-results { margin-top: 18px; }
.work-detail-refs h3, .work-detail-results h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 13px; color: #0f172a; }
.work-detail-refs h3 small, .work-detail-results h3 small { color: #94a3b8; font-size: 11px; font-weight: 400; }
.work-ref-grid, .work-result-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.work-ref-thumb, .work-result-thumb { width: 68px; height: 68px; padding: 0; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; overflow: hidden; background: #f1f5f9; cursor: zoom-in; }
.work-ref-thumb img, .work-result-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-ref-thumb:hover, .work-result-thumb:hover { border-color: #2563eb; }
.work-ref-audios { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; color: #475569; font-size: 12px; }
.work-ref-audios li { display: flex; align-items: center; gap: 6px; }

/* 全屏看图 */
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 10, 24, .88);
  backdrop-filter: blur(4px);
}
.image-viewer.open { display: flex; }
body.viewer-open { overflow: hidden; }
.image-viewer-figure { margin: 0; display: flex; flex-direction: column; gap: 12px; max-width: min(92vw, 1200px); max-height: 92vh; }
.image-viewer-figure img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 12px; background: #0b1220; }
.image-viewer-figure figcaption { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #e2e8f0; font-size: 12px; }
.image-viewer-download { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; color: #0f172a; background: #fff; border-radius: 9px; text-decoration: none; font-size: 12px; }
.image-viewer-close, .image-viewer-nav {
  position: absolute;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  cursor: pointer;
}
.image-viewer-close:hover, .image-viewer-nav:hover { background: rgba(255, 255, 255, .26); }
.image-viewer-close { top: 20px; right: 22px; }
.image-viewer-nav.prev { left: 20px; top: 50%; transform: translateY(-50%) rotate(90deg); }
.image-viewer-nav.next { right: 20px; top: 50%; transform: translateY(-50%) rotate(-90deg); }
.image-viewer-close .icon, .image-viewer-nav .icon { width: 18px; height: 18px; }
@media (width <= 720px) {
  .image-viewer { padding: 12px; }
  .image-viewer-nav { width: 34px; height: 34px; }
  .image-ref-item, .image-ref-add { width: 72px; height: 72px; }
}

/* ----------------------------- 图片渠道管理（管理后台） ----------------------------- */
.admin-image-channels { display: grid; gap: 10px; margin: 12px 0; }
.admin-image-channels .admin-channel-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  grid-template-areas:
    "model model"
    "name base"
    "key model"
    "cost max"
    "actions enable";
}
.admin-image-channel-actions { display: flex; gap: 8px; flex-wrap: wrap; grid-area: actions; align-self: end; }
.admin-image-channel-actions .secondary-button { padding: 6px 12px; font-size: 12px; }
.admin-image-channel-actions .secondary-button.danger { color: #dc2626; border-color: #fecaca; }
.admin-image-add {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-top: 12px;
  background: #f8fafc;
  border: 1px dashed var(--border, #cbd5e1);
  border-radius: 10px;
}
.admin-image-add label { font-size: 11px; min-width: 0; }
.admin-image-add input { min-height: 36px !important; width: 100%; }
.admin-image-add button { grid-column: 1 / -1; justify-self: start; }
@media (width <= 720px) {
  .admin-image-channels .admin-channel-row { grid-template-columns: 1fr; grid-template-areas: "model" "name" "base" "key" "model" "cost" "max" "actions" "enable"; }
}

/* =========================================================
   兑换码充值 / 后台兑换码管理
   ========================================================= */
.redeem-card { margin-top: 20px; }
.redeem-form { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.redeem-form input {
  width: 240px;
  height: 42px;
  padding: 0 14px;
  color: #1e293b;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.redeem-form input:focus { outline: none; border-color: #9db4ff; box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
.redeem-hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.admin-redeem-metrics { margin: 0 20px 18px; }
.admin-redeem-form { padding: 0 20px 18px; border-bottom: 1px solid #edf1f6; }
.admin-redeem-form .admin-form-grid { margin-bottom: 14px; }
.admin-redeem-result {
  display: grid;
  gap: 10px;
  margin: 18px 20px;
  padding: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
}
.admin-redeem-result-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; }
.admin-redeem-result-head strong { font-size: 13px; }
.admin-redeem-result-head span { color: var(--muted); font-size: 12px; }
.admin-redeem-result textarea {
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  color: #1e293b;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  resize: vertical;
}
.admin-redeem-batches { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 16px; }
.admin-redeem-batch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}
.admin-redeem-batch small { color: var(--muted); }
.admin-filter-chip {
  padding: 6px 12px;
  color: #475569;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.admin-filter-chip:hover,
.admin-filter-chip.active { color: var(--blue); background: var(--pale); border-color: #bdcaff; }
@media (max-width: 640px) {
  .redeem-form { flex-direction: column; align-items: stretch; }
  .redeem-form input { width: 100%; }
}

.face-split-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.face-split-toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--blue); }
.face-split-toggle span { display: grid; gap: 2px; }
.face-split-toggle strong { font-size: 13px; }
.face-split-toggle small { color: var(--muted); font-size: 11px; }
/* 参考图预处理改成下拉后不再用光标样式，改为普通设置行 */
.face-split-toggle.face-mode-field {
  align-items: center;
  justify-content: space-between;
  cursor: default;
}
.face-split-toggle.face-mode-field select {
  min-width: 168px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  font-size: 12px;
  color: var(--text);
}
.work-detail-error { color: #b42318; }

.work-diagnose-result {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.work-diagnose-result strong { display: block; margin-bottom: 6px; }
.work-diagnose-result ul { margin: 0; padding-left: 18px; color: var(--muted); }
.work-diagnose-result li { margin: 4px 0; }
.work-diagnose-error { color: #b42318; }

/* ---------- 移动端兼容（窄屏 / iOS / 微信内置浏览器） ---------- */
@media (max-width: 640px) {
  /* 弹窗占满可视高度，视频按视口收缩，避免被底部导航或浏览器工具栏截断 */
  .modal-root .modal,
  .modal {
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-media video {
    max-height: 46vh;
    margin-top: 12px;
  }
  .modal-media.is-image img { max-height: 46vh; }
  /* 触控目标不小于 40px，避免误触 */
  .primary-button, .secondary-button, .text-link,
  .work-actions button, .segments button, .image-template-chip {
    min-height: 40px;
  }
  /* 作品卡片操作按钮不压在缩略图上 */
  .work-actions { gap: 6px; }
  .work-actions button { width: 36px; height: 36px; }
  /* 长提示词不撑破布局 */
  .work-info p, .modal-details dd, .work-detail-prompt {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  /* 底部导航留出安全区，避免遮挡最后一张卡片 */
  .content { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@supports (-webkit-touch-callout: none) {
  /* iOS Safari：视频默认全屏播放，这里强制内联 */
  video::-webkit-media-controls-panel { display: flex !important; }
}

/* 素材清单表格里的状态与「生成」按钮 */

/* 素材清单下方的批量入口 */

/* 投喂单元的首尾帧开关 */

/* 资产库分组（项目级，数量不设上限） */

/* 分析剧本 */

/* 管理后台 · 用户作品（按账号分组） */
.admin-works-group { margin-bottom: 18px; }
.admin-works-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.admin-works-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted, #9aa4b2);
}
.admin-work-thumb {
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: block;
}
.admin-work-prompt {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-input {
  min-width: 220px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--panel, rgba(255, 255, 255, 0.04));
  color: inherit;
  font-size: 13px;
}

/* 管理后台 · 用户作品：分页 / 播放 / 详情 */
.admin-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  flex-wrap: wrap;
}
.admin-pager button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.admin-work-thumb-wrap {
  position: relative;
  width: 64px;
  height: 40px;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
}
.admin-work-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.35);
}
img.admin-work-thumb { cursor: pointer; }
.admin-work-ops {
  white-space: nowrap;
}
.admin-work-ops .link-button + .link-button {
  margin-left: 10px;
}
.admin-work-viewer {
  display: flex;
  justify-content: center;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.admin-work-full {
  max-width: 100%;
  max-height: 62vh;
  display: block;
}
.admin-work-viewer-meta {
  font-size: 12px;
  line-height: 1.6;
}
.admin-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-detail-table th {
  text-align: left;
  width: 96px;
  padding: 8px 10px;
  color: var(--muted, #9aa4b2);
  font-weight: 500;
  vertical-align: top;
  white-space: nowrap;
}
.admin-detail-table td {
  padding: 8px 10px;
  word-break: break-all;
}
.admin-detail-table tr + tr {
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}

/* 我的作品 · 视频封面（首帧） */
.work-thumb-video { position: relative; cursor: pointer; }
.work-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0f172a;
  transition: transform .25s ease;
}
.work-card:hover .work-thumb video { transform: scale(1.03); }
.work-thumb-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.work-thumb-play .icon,
.work-thumb-play svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  box-sizing: content-box;
  color: #fff;
  fill: #fff;
  stroke: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(2px);
}

@keyframes manjuSoonSlide {
  0%   { left: -40%; width: 38%; }
  50%  { left: 30%;  width: 46%; }
  100% { left: 100%; width: 38%; }
}

/* 视频提示词字数提示 */
.prompt-count {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted, #94a3b8);
  transition: color .2s ease;
}
.prompt-count:empty { display: none; }
.prompt-count.over {
  color: #b45309;
  font-weight: 600;
}

/* 后台 · 文本上游链路 */
.admin-llm-chain {
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: rgba(99, 102, 241, .06);
  border: 1px solid rgba(99, 102, 241, .16);
}
.admin-llm-chain.warn { background: rgba(180, 83, 9, .08); border-color: rgba(180, 83, 9, .28); }
.admin-llm-chain-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-llm-chain p { margin: 8px 0 0; font-size: 12px; }
.llm-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; background: rgba(148, 163, 184, .16);
  border: 1px solid transparent;
}
.llm-chip b {
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: rgba(99, 102, 241, .22); color: #6366f1;
}
.llm-chip em { font-style: normal; opacity: .8; }
.llm-chip.ok { border-color: rgba(22, 163, 74, .4); background: rgba(22, 163, 74, .1); }
.llm-chip.ok em { color: #15803d; }
.llm-chip.fail { border-color: rgba(185, 28, 28, .4); background: rgba(185, 28, 28, .1); }
.llm-chip.fail em { color: #b91c1c; }
.llm-arrow { color: var(--muted, #94a3b8); font-size: 12px; }
