/* ==========================================================================
   网页版登录/注册门禁（积分制）— 独立全屏登录页（深色科技风）
   主色 #5B61F0、青渐变 #22D3EE
   2026-08-18 重设计：更通透的玻璃质感、更克制的动效、更清晰的层级
   ========================================================================== */
.web-login-mask {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: auto;
  background: #05070f;
}
.web-login-mask[hidden] { display: none !important; }

/* ---- 深色科技风动态背景 ---- */
.web-login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 25%, rgba(91, 97, 240, 0.38), transparent 32%),
    radial-gradient(circle at 85% 70%, rgba(34, 211, 238, 0.18), transparent 30%),
    radial-gradient(circle at 55% 12%, rgba(168, 85, 247, 0.16), transparent 26%),
    linear-gradient(145deg, #05070f 0%, #0c1022 45%, #061018 100%);
}

/* 缓慢流动的双色光晕 */
.wl-aurora {
  position: absolute;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 28% 38%, rgba(91, 97, 240, 0.26), transparent 46%),
    radial-gradient(circle at 72% 62%, rgba(34, 211, 238, 0.16), transparent 48%),
    radial-gradient(circle at 48% 18%, rgba(168, 85, 247, 0.13), transparent 54%);
  filter: blur(36px);
  animation: wlAurora 20s ease-in-out infinite alternate;
}
@keyframes wlAurora {
  0% { transform: translate(-2%, -1%) scale(1); }
  50% { transform: translate(2%, 2%) scale(1.06); }
  100% { transform: translate(-1%, 2%) scale(1.02); }
}

/* 透视网格：缓慢上移 */
.wl-grid {
  position: absolute;
  inset: -40% 0;
  height: 180%;
  opacity: 0.10;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 130, 255, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 130, 255, 0.13) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(circle at center, black 8%, transparent 72%);
  mask-image: radial-gradient(circle at center, black 8%, transparent 72%);
  animation: wlGridDrift 50s linear infinite;
}
@keyframes wlGridDrift { from { transform: translateY(0); } to { transform: translateY(60px); } }

/* 细密星点粒子 */
.wl-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
  background-image:
    radial-gradient(1px 1px at 18% 30%, #c7d2ff 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 72%, #a5f3fc 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 80% 32%, #e9d5ff 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 82%, #c7d2ff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 50% 50%, #bfdbfe 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 60%, #a5f3fc 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 8% 64%, #e0e7ff 50%, transparent 51%);
  background-size: 100% 100%;
  animation: wlTwinkle 6s ease-in-out infinite;
}
@keyframes wlTwinkle { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.75; } }

/* 流光光束 */
.wl-sweep {
  position: absolute;
  top: -35%;
  bottom: -35%;
  left: -55%;
  width: 42%;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.09), rgba(91, 97, 240, 0.09), transparent);
  transform: rotate(16deg);
  animation: wlSweep 16s ease-in-out infinite;
}
@keyframes wlSweep {
  0%, 100% { transform: translateX(-30%) rotate(16deg); }
  50% { transform: translateX(310%) rotate(16deg); }
}

/* 噪点纹理 */
.wl-noise {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* 浮动光球 */
.wl-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(24px);
  opacity: 0.5;
  pointer-events: none;
  animation: wlFloating 12s ease-in-out infinite;
}
.wl-orb-1 { width: 320px; height: 320px; top: 8%; left: -110px; background: rgba(91, 97, 240, 0.42); }
.wl-orb-2 { width: 260px; height: 260px; right: -60px; bottom: -90px; background: rgba(34, 211, 238, 0.18); animation-delay: -4s; }
.wl-orb-3 { width: 180px; height: 180px; top: 14%; right: 32%; background: rgba(168, 85, 247, 0.20); animation-delay: -8s; }
@keyframes wlFloating { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(22px, -16px) scale(1.07); } }

/* ---- 页面容器 ---- */
.web-login-page {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 32px;
  display: flex;
  flex-direction: column;
  color: #f1f3ff;
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

/* ---- 顶部导航 / Logo ---- */
.wl-navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 28px 0 32px;
  /* 用 left 实现左移，避免被入场动画的 transform 覆盖 */
  position: relative;
  left: -40px;
}
.wl-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.wl-brand-left {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
}
.wl-brand-left::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 28px;
  background: radial-gradient(circle at center, rgba(91, 97, 240, 0.18), transparent 70%);
  filter: blur(10px);
  z-index: -1;
}
.wl-nav-icon {
  position: relative;
  z-index: 1;
  display: block;
  height: 165px;
  max-width: 40vw;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 0 10px rgba(91, 97, 240, 0.28)) drop-shadow(0 0 20px rgba(34, 211, 238, 0.12));
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}
.wl-brand-left:hover .wl-nav-icon { transform: scale(1.05) rotate(-3deg); }
.wl-brand-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.wl-nav-word {
  display: block;
  height: 150px;
  max-width: 64vw;
  object-fit: contain;
  object-position: center;
  opacity: .98;
  filter: drop-shadow(0 2px 16px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 28px rgba(91, 97, 240, 0.26));
  transition: transform .25s ease, opacity .25s ease;
}
.wl-brand:hover .wl-nav-word { opacity: 1; transform: translateX(2px); }
.wl-brand-tagline {
  margin: 3px 0 0;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: #7a80a3;
}

/* ---- 主体布局 ---- */
.wl-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  gap: 64px;
  align-items: center;
  padding: 36px 0 24px;
}

/* 入场动画 */
.wl-navbar { animation: wlRiseIn 600ms cubic-bezier(.22, 1, .36, 1) both; }
.wl-hero { animation: wlRiseIn 700ms cubic-bezier(.22, 1, .36, 1) .08s both; }
.wl-login-wrap { animation: wlRiseIn 700ms cubic-bezier(.22, 1, .36, 1) .2s both; }
@keyframes wlRiseIn { from { opacity: 0; transform: translate(0, 20px); } to { opacity: 1; transform: translate(0, 0); } }

/* 主视觉内逐级错峰 */
.wl-eyebrow { animation: wlRiseIn 600ms cubic-bezier(.22, 1, .36, 1) .16s both; }
.wl-title { animation: wlRiseIn 600ms cubic-bezier(.22, 1, .36, 1) .24s both; }
.wl-desc { animation: wlRiseIn 600ms cubic-bezier(.22, 1, .36, 1) .32s both; }
.wl-feature-tags { animation: wlRiseIn 600ms cubic-bezier(.22, 1, .36, 1) .4s both; }
.wl-advantages { animation: wlRiseIn 600ms cubic-bezier(.22, 1, .36, 1) .48s both; }

/* ---- 左侧主视觉 ---- */
.wl-hero { position: relative; max-width: 680px; }
.wl-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  margin-bottom: 22px;
  border: 1px solid rgba(34, 211, 238, 0.5);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #e7fbff;
  background: linear-gradient(135deg, rgba(91, 97, 240, 0.22), rgba(34, 211, 238, 0.14));
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.06), 0 4px 16px rgba(34, 211, 238, 0.14);
}
.wl-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7);
  animation: wlPulse 1.8s infinite;
}
@keyframes wlPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(34, 211, 238, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}
.wl-title {
  margin: 0;
  font-size: clamp(42px, 4.8vw, 68px);
  line-height: 1.08;
  letter-spacing: -1.8px;
  font-weight: 900;
  color: #fff;
}
.wl-gradient-text {
  display: block;
  margin-top: 8px;
  background: linear-gradient(100deg, #ffffff 5%, #c8ccff 38%, #67e8f9 92%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.wl-desc {
  max-width: 580px;
  margin: 20px 0 24px;
  color: #b6bad1;
  font-size: 16px;
  line-height: 1.8;
}
.wl-desc strong { color: #f4f5ff; font-weight: 800; }
.wl-feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.wl-tag {
  padding: 8px 13px;
  border: 1px solid rgba(161, 168, 255, 0.16);
  border-radius: 10px;
  color: #e1e4f7;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
  transition: background .2s ease, border-color .2s ease;
}
.wl-tag:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(161, 168, 255, 0.28); }
.wl-tag-highlight {
  border-color: rgba(34, 211, 238, 0.35);
  color: #c8faff;
  background: linear-gradient(135deg, rgba(91, 97, 240, 0.18), rgba(34, 211, 238, 0.10));
}
.wl-advantages {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.wl-adv {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  color: #d9dbea;
  font-size: 13px;
  background: rgba(10, 13, 30, 0.42);
  transition: background .2s ease, border-color .2s ease;
}
.wl-adv:hover { background: rgba(10, 13, 30, 0.6); border-color: rgba(255, 255, 255, 0.12); }
.wl-adv-ic { color: #22d3ee; font-size: 16px; line-height: 1; }
.wl-price { color: #67e8f9; font-weight: 800; }
.wl-storyboard {
  position: absolute;
  right: -36px;
  bottom: -20px;
  width: 240px;
  padding: 12px;
  transform: rotate(-6deg);
  border: 1px solid rgba(91, 97, 240, 0.26);
  border-radius: 16px;
  background: rgba(20, 23, 54, 0.54);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  opacity: 0.86;
}
.wl-sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #c9cbe0;
  font-size: 11px;
}
.wl-sb-head b { color: #22d3ee; }
.wl-frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.wl-frame {
  position: relative;
  aspect-ratio: 0.74;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(180deg, transparent 45%, rgba(3, 4, 20, 0.9)),
    radial-gradient(circle at 72% 24%, #f5b3dd 0 3%, transparent 4%),
    linear-gradient(135deg, #5b61f0 0%, #2d3d80 44%, #101832 100%);
}
.wl-frame:nth-child(2) {
  background:
    linear-gradient(180deg, transparent 45%, rgba(3, 4, 20, 0.9)),
    radial-gradient(circle at 35% 24%, #8ef3ff 0 3%, transparent 4%),
    linear-gradient(135deg, #173c72, #7450af 55%, #13152f);
}
.wl-frame:nth-child(3) {
  background:
    linear-gradient(180deg, transparent 45%, rgba(3, 4, 20, 0.9)),
    radial-gradient(circle at 64% 22%, #ffd69a 0 3%, transparent 4%),
    linear-gradient(135deg, #773a7d, #3158a4 57%, #11132b);
}
.wl-frame::after {
  content: "";
  position: absolute;
  width: 35%;
  height: 48%;
  left: 33%;
  bottom: 9%;
  border-radius: 48% 48% 20% 20%;
  background: rgba(13, 13, 33, 0.72);
  box-shadow: 0 -13px 0 -5px rgba(25, 21, 55, 0.95);
}

/* ---- 右侧登录卡片 ---- */
.wl-login-wrap { display: flex; align-items: center; justify-content: center; }
.web-login-card {
  position: relative;
  width: min(100%, 420px);
  padding: 36px;
  overflow: hidden;
  border: 1px solid rgba(91, 97, 240, 0.22);
  border-radius: 26px;
  background:
    linear-gradient(160deg, rgba(32, 36, 78, 0.78), rgba(12, 15, 36, 0.82)),
    rgba(255, 255, 255, 0.02);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 40px rgba(91, 97, 240, 0.08) inset;
  backdrop-filter: blur(22px);
  animation: webLoginIn .3s ease;
}
.web-login-card::before {
  content: "";
  position: absolute;
  top: -110px;
  left: -80px;
  width: 240px;
  height: 150px;
  background: rgba(91, 97, 240, 0.22);
  filter: blur(42px);
  pointer-events: none;
}
.web-login-card::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 170px;
  height: 140px;
  background: rgba(34, 211, 238, 0.12);
  filter: blur(36px);
  pointer-events: none;
}
@keyframes webLoginIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.web-login-card-inner { position: relative; z-index: 1; }
.wl-card-head { margin-bottom: 24px; }
.wl-card-head.wl-center { text-align: center; }
.wl-card-title { margin: 0 0 6px; color: #fff; font-size: 24px; letter-spacing: -0.4px; font-weight: 800; }
.wl-card-sub { margin: 0; color: #9ca3c2; font-size: 13px; }

.web-login-panel { display: flex; flex-direction: column; gap: 16px; }
.web-login-panel[hidden] { display: none !important; }
.web-login-panel-loggedin { align-items: center; text-align: center; }
.web-login-field label, .wl-field-label { display: block; font-size: 12px; font-weight: 600; color: #d2d6ec; margin-bottom: 7px; }
.wl-input-box {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(185, 190, 225, 0.12);
  border-radius: 13px;
  background: rgba(4, 6, 18, 0.42);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.wl-input-box:hover { border-color: rgba(185, 190, 225, 0.2); background: rgba(4, 6, 18, 0.5); }
.wl-input-box:focus-within {
  border-color: rgba(91, 97, 240, 0.85);
  background: rgba(4, 6, 18, 0.58);
  box-shadow: 0 0 0 3px rgba(91, 97, 240, 0.12), 0 0 18px rgba(34, 211, 238, 0.08);
}
.wl-input-icon { width: 18px; color: #7a80a3; text-align: center; font-size: 15px; flex-shrink: 0; transition: color .2s ease; }
.wl-input-box:focus-within .wl-input-icon { color: #a5b4fc; }
.wl-input-box input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 14px;
  background: transparent;
  line-height: 1.4;
}
.wl-input-box input::placeholder { color: #5c627a; }

.web-login-actions { display: flex; gap: 10px; width: 100%; margin-top: 4px; }
.wl-actions .web-login-btn { flex: 1; }
.web-login-btn {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  color: #fff;
  letter-spacing: 0.2px;
}
.web-login-btn:active { transform: scale(0.98); }
.web-login-btn.primary {
  background: linear-gradient(135deg, #5b61f0 0%, #7c6df5 45%, #22d3ee 100%);
  box-shadow: 0 10px 26px rgba(91, 97, 240, 0.32), 0 0 14px rgba(34, 211, 238, 0.08);
}
.web-login-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(91, 97, 240, 0.48), 0 0 22px rgba(34, 211, 238, 0.14);
}
.web-login-btn.secondary {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #e0e2ff !important;
  border: 1px solid rgba(161, 168, 255, 0.24) !important;
}
.web-login-btn.secondary:hover { background: rgba(91, 97, 240, 0.16) !important; border-color: rgba(91, 97, 240, 0.5) !important; }
.web-login-btn.danger {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #fda4a4 !important;
  border: 1px solid rgba(248, 113, 113, 0.32) !important;
}
.web-login-btn.danger:hover { background: rgba(220, 38, 238, 0.22) !important; }

.web-login-msg { min-height: 18px; margin-top: 10px; font-size: 13px; color: #fda4a4; text-align: center; }

/* 已登录视图 */
.wl-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  margin: 4px auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(91, 97, 240, 0.35);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}
.wl-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wl-balance { font-size: 14px; color: #d2d6ec; }
.wl-balance b { color: #67e8f9; font-size: 22px; }
.wl-hint { font-size: 12px; color: #6b7090; line-height: 1.6; max-width: 300px; margin: 0 auto; }

/* ---- 页脚式安全说明 ---- */
.wl-foot-note { margin-top: 16px; text-align: center; color: #545873; font-size: 11px; }

/* ---- 响应式 ---- */
@media (max-width: 980px) {
  .wl-main { grid-template-columns: 1fr; gap: 36px; padding: 32px 0 28px; }
  .wl-hero { max-width: 640px; margin: 0 auto; text-align: center; }
  .wl-desc { margin-right: auto; margin-left: auto; }
  .wl-feature-tags, .wl-advantages { justify-content: center; }
  .wl-storyboard { display: none; }
  .web-login-card { max-width: 460px; }
}
@media (max-width: 640px) {
  .web-login-page { width: calc(100% - 28px); padding-top: 16px; }
  .wl-navbar { margin: 16px 0 18px; }
  .wl-brand-left::before { inset: -8px; border-radius: 22px; }
  .wl-nav-icon { height: 95px; max-width: 36vw; }
  .wl-nav-word { height: 72px; max-width: 74vw; }
  .wl-brand-tagline { display: none; }
  .wl-title { font-size: 38px; letter-spacing: -1.2px; }
  .wl-desc { font-size: 14px; }
  .wl-advantages { flex-direction: column; align-items: stretch; }
  .web-login-card { padding: 26px 20px; border-radius: 22px; }
  .wl-card-title { font-size: 21px; }
}

/* ---- 尊重系统减弱动态偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  .web-login-bg .wl-aurora,
  .web-login-bg .wl-grid,
  .web-login-bg .wl-stars,
  .web-login-bg .wl-sweep,
  .web-login-bg .wl-orb,
  .wl-pulse-dot { animation: none !important; }
  .wl-navbar, .wl-hero, .wl-login-wrap,
  .wl-eyebrow, .wl-title, .wl-desc,
  .wl-feature-tags, .wl-advantages { animation: none !important; }
}

/* ==========================================================================
   造梦·帧影 · AIGC 网页用户端 统一样式表
   设计规范：左侧导航 + 双配色主题（白天/深夜）
   主题切换：html 根节点加 data-theme="light|dark"
   说明：所有 class 名保留原 HTML 中使用的名称（保证 JS 不报错、不重复）
   ========================================================================== */

/* ---------- 1. 主题 CSS 变量（白天默认） ---------- */
:root,
html[data-theme="light"] {
  color-scheme: light;
  /* 小云雀白天色板（真正偏灰的中性色，不带蓝调）：画布中性浅灰 + 侧栏/卡片纯白 + 中性灰分割 */
  --canvas: #F2F3F5;                        /* 画布底色（小云雀工作台中性浅灰） */
  --sidebar-bg: #FFFFFF;                    /* 左侧栏（雪白） */
  --surface: #FFFFFF;                       /* 卡片/面板底色（纯白） */
  --surface-muted: #F5F6F8;                 /* 次表面（输入框/统计胶囊：中性淡灰） */
  --sidebar-border: #E5E6EB;                /* 侧栏右边框（中性灰） */
  --border: #E5E6EB;                        /* 常规分割线（中性灰，不带蓝） */
  --border-strong: #D4D6DB;                 /* 强调描边 */
  --text: #1D2129;                          /* 主标题/正文（字节系产品默认深灰字） */
  --text-2: #4E5969;                        /* 次要文字 */
  --text-3: #86909C;                        /* 辅助/占位文字 */
  --brand: #5B61F0;                         /* 品牌靛蓝 */
  --brand-soft: #EEF2FF;                    /* 品牌浅色（激活态背景） */
  --accent: #06B6D4;                        /* 辅助青蓝（渐变/标签） */
  --ok: #10B981;                            /* 成功绿 */
  --warn: #F59E0B;                          /* 警告黄 */
  --err: #EF4444;                           /* 错误红 */
  --info: #2563EB;                          /* 信息蓝 */
  --purple: #7C3AED;                        /* 紫色（会员 tag） */

  --tag-blue-bg: #EFF6FF;
  --tag-blue-fg: #2563EB;
  --tag-green-bg: #ECFDF5;
  --tag-green-fg: #059669;
  --tag-amber-bg: #FFFBEB;
  --tag-amber-fg: #D97706;
  --tag-purple-bg: #F5F3FF;
  --tag-purple-fg: #7C3AED;
  --tag-rose-bg: #FFF1F2;
  --tag-rose-fg: #E11D48;

  --input-bg: #F2F4F8;
  --placeholder: #BFC6D2;

  --grad-btn: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);
  --grad-brand: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);
  --grad-logo: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);

  --shadow-sm: 0 2px 8px rgba(30, 41, 59, 0.04), 0 1px 2px rgba(30,41,59,0.02);
  --shadow-card: 0 4px 16px rgba(30, 41, 59, 0.05), 0 1px 3px rgba(30,41,59,0.03);
  --shadow-md: 0 12px 40px rgba(30, 41, 59, 0.10), 0 3px 8px rgba(30,41,59,0.04);
  --shadow-modal: 0 20px 60px rgba(30, 41, 59, 0.15), 0 8px 20px rgba(30,41,59,0.08);
  --shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.15);

  --radius: 10px;
  --radius-sm: 8px;
  --radius-card: 16px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 22px;
  --space-xl: 30px;

  --topbar-bg: rgba(255, 255, 255, 0.9);
  --hover: #F2F3F5;
  --sidebar-hover: #F5F6F8;
  --mask: rgba(29, 33, 41, 0.38);
}

/* 深夜配色 */
html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0B0D12;
  --sidebar-bg: #12151E;
  --surface: #151821;
  --surface-muted: #1C202B;
  --sidebar-border: #252A38;
  --border: #2A2F3D;
  --border-strong: #3C4357;
  --text: #F1F5F9;
  --text-2: #94A3B8;
  --text-3: #64748B;
  --brand: #818CF8;
  --brand-soft: #2A2F52;
  --accent: #22D3EE;
  --ok: #34D399;
  --warn: #FBBF24;
  --err: #F87171;
  --info: #60A5FA;
  --purple: #A78BFA;

  --tag-blue-bg: #1E3A5F;
  --tag-blue-fg: #60A5FA;
  --tag-green-bg: #134E3A;
  --tag-green-fg: #6EE7B7;
  --tag-amber-bg: #4A3A14;
  --tag-amber-fg: #FCD34D;
  --tag-purple-bg: #3B2A5F;
  --tag-purple-fg: #C4B5FD;
  --tag-rose-bg: #5A2430;
  --tag-rose-fg: #FDA4AF;

  --input-bg: #1C202B;
  --placeholder: #475569;

  --grad-btn: linear-gradient(135deg, #818CF8 0%, #22D3EE 100%);
  --grad-brand: linear-gradient(135deg, #818CF8 0%, #22D3EE 100%);
  --grad-logo: linear-gradient(135deg, #818CF8 0%, #22D3EE 100%);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.55), 0 3px 8px rgba(0,0,0,0.3);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.7), 0 8px 20px rgba(0,0,0,0.4);
  --shadow-focus: 0 0 0 3px rgba(129, 140, 248, 0.25);

  --topbar-bg: rgba(21, 24, 33, 0.85);
  --hover: #232639;
  --sidebar-hover: #1A1E28;
  --mask: rgba(0, 0, 0, 0.65);
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body { overflow: hidden; }

h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: 600; color: var(--text); }
p { margin: 0; color: var(--text-2); }
button { font-family: inherit; }
input, select, textarea, button { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }

/* 全局过渡：主题切换平滑（排除非主题相关动画） */
.sidebar, .app-main, .card, .notice-dialog-card, .settings-modal,
input, select, textarea, button, .nav-btn, .toast {
  transition: background-color 0.25s ease, border-color 0.25s ease,
              color 0.25s ease, box-shadow 0.2s ease;
}

/* ---------- 3. 应用整体布局：左侧栏 + 右主区 ---------- */
.app {
  display: flex;
  width: 100vw;
  height: 100vh;
  background: var(--canvas);
  overflow: hidden;
}

/* ---------- 4. 左侧导航栏 ---------- */
.glass-nav {
  width: 228px;
  flex-shrink: 0;
  height: 100%;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

.glass-nav-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* LOGO 区 */
.glass-nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.brand-block {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--grad-logo);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-block:has(.brand-logo-img) {
  background: var(--surface-muted);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.grad-text {
  font-size: 16px;
  font-weight: 700;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
  letter-spacing: 0.3px;
}
.brand-sub {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
}
/* 品牌整图（图标+字） */
.brand-full-img {
  height: 44px;
  width: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
/* 品牌文字图（透明字.png：3840x2160 横版，cover 铺满横向显示） */
.brand-text-block {
  display: block;
  flex: 1;
  height: 84px;
  overflow: hidden;
  flex-shrink: 0;
  min-width: 0;
}
.brand-word-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  min-width: 0;
}

/* 用户信息胶囊 */
.sb-user-card {
  margin: 14px 12px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s;
}
.sb-user-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.sb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad-logo);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-user-plan {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
  display: inline-block;
  line-height: 1.5;
  letter-spacing: 0.5px;
}

/* 分组标题 */
.sb-group-title {
  padding: 16px 20px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-3);
  text-transform: uppercase;
}
.sb-group-title:first-of-type { padding-top: 4px; }

/* 导航菜单（沿用原选择器 .glass-nav-menu + .nav-btn 以兼容 app.js 绑定） */
.glass-nav-menu {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.glass-nav-menu::-webkit-scrollbar { width: 4px; }
.glass-nav-menu::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  width: 100%;
  text-align: left;
  position: relative;
  transition: all 0.15s;
}
.nav-btn:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}
.nav-btn.nav-btn-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.12);
}
html[data-theme="dark"] .nav-btn.nav-btn-active {
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.25);
}
.nav-btn:active { transform: translateY(1px); }

.nav-ic {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
}
.nav-ic-sm {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.nav-btn .nav-count {
  margin-left: auto;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  background: var(--tag-blue-bg);
  color: var(--tag-blue-fg);
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-btn.nav-btn-active .nav-count {
  background: var(--brand);
  color: #fff;
}

/* 状态区（侧栏底部：版本号+设置+主题切换） */
.glass-nav-status {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-top: auto;
}

.status-pill {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pill-purple {
  background: var(--tag-purple-bg);
  color: var(--tag-purple-fg);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}
.icon-btn.theme-toggle {
  flex: 1;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  width: auto;
  padding: 0 10px;
}

/* ---------- 5. 右侧主工作区 ---------- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

/* 顶栏（页面标题 + 面包屑 + 搜索） */
.ws-topbar {
  height: 54px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  gap: var(--space-md);
  flex-shrink: 0;
  z-index: 5;
}
.ws-page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.ws-page-crumb {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
}
.ws-search {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  font-size: 12px;
  color: var(--text-3);
  transition: all 0.2s;
  flex-shrink: 0;
}
.ws-search:focus-within {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: var(--shadow-focus);
  color: var(--text);
}
.ws-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  color: var(--text);
  min-width: 0;
  padding: 0;
}
.ws-search input::placeholder { color: var(--placeholder); }

/* ---------- 6. 视图容器 ---------- */
.view {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.view[hidden] { display: none !important; }

.view > .grid {
  width: 100%;
  height: 100%;
  padding: var(--space-lg);
  gap: var(--space-lg);
  display: grid;
  overflow: hidden;
}

.grid {
  grid-template-columns: 1fr;
}
/* 剧本生成页专用：左选题预览卡 + 右剧本详情卡 两栏布局 */
.grid.two-col {
  grid-template-columns: minmax(380px, 440px) minmax(0, 1fr);
}
.prompt-layout,
.video-gen-layout,
.asset-layout {
  width: 100%;
  height: 100%;
}
/* 个人中心：顶部通栏横幅 + 下方两栏布局 */
.profile-page {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  overflow: hidden;
  box-sizing: border-box;
}
.profile-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: var(--space-md);
}
.card.profile-aside {
  overflow-y: auto;
}

/* ---------- 7. 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card.wide {
  /* 右侧宽卡 */
}
.card-head {
  padding: 15px var(--space-md);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}
.card-head h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.card-head > span {
  font-size: 11px;
  color: var(--text-3);
}
.card-head > *:last-child:not(h2) { margin-left: auto; }

/* —— 资产库滑块开关（剧本 | 个人）—— */
.asset-mode-switch {
  display: inline-flex;
  margin-left: auto;
  user-select: none;
  cursor: pointer;
}
.asset-mode-track {
  position: relative;
  display: flex;
  align-items: center;
  width: 160px;
  height: 34px;
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 0;
}
.asset-mode-label {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  z-index: 2;
  cursor: pointer;
  transition: color 0.22s;
  padding: 0 16px;
}
.asset-mode-switch.is-personal .asset-mode-label[data-label="script"] {
  color: var(--text-3);
}
.asset-mode-switch:not(.is-personal) .asset-mode-label[data-label="script"] {
  color: #fff;
}
.asset-mode-switch.is-personal .asset-mode-label[data-label="personal"] {
  color: #fff;
}
.asset-mode-switch:not(.is-personal) .asset-mode-label[data-label="personal"] {
  color: var(--text-3);
}
/* 滑块 */
.asset-mode-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: var(--brand);
  border-radius: 8px;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  z-index: 1;
}
.asset-mode-switch.is-personal .asset-mode-thumb {
  transform: translateX(100%);
}
/* hover 反馈 */
.asset-mode-switch:hover .asset-mode-thumb {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

/* —— 个人资产库区域 —— */
.asset-personal-list[hidden] { display: none !important; }
.asset-personal-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.asset-personal-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  position: relative;
}
/* 上传图片按钮：绝对定位右侧，不占据导航栏空间 */
.asset-personal-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* 上传图片按钮：简约圆形图标按钮，不使用通用蓝色渐变 */
.asset-upload-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  background: var(--surface-muted);
  border: none;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background 0.18s, color 0.18s, transform 0.15s;
}
.asset-upload-btn:hover {
  background: var(--surface);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: none;
}
.asset-upload-btn svg.nav-ic { width: 16px; height: 16px; color: inherit; }
/* 左标题样式已移除，保留兼容性以防其他引用 */
.asset-personal-head { display: none; }
/* 中：四分类滑块胶囊导航 */
.asset-personal-nav {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--surface-muted);
  border-radius: 999px;
  padding: 4px;
}
/* 滑块：跟随选中项，平滑移动 */
.apn-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  background: var(--text);
  border-radius: 999px;
  z-index: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, width;
}
html[data-theme="light"] .apn-thumb { background: #1D2129; }
html[data-theme="dark"] .apn-thumb { background: #F2F3F5; }

.apn-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}
.apn-item svg.nav-ic { width: 15px; height: 15px; color: inherit; }
.apn-item:hover { color: var(--text-2); }
.apn-item.active { color: #FFFFFF; }
html[data-theme="dark"] .apn-item.active { color: #0F1115; }

/* 右：上传图片按钮区 - 已合并到上方 .asset-personal-actions 绝对定位样式 */

/* 单网格容器 */
.asset-personal-grid-wrap {
  width: 100%;
}

/* 卡片选择框（左上） */
.asset-item-card.has-select { position: relative; }
.asset-select-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.asset-select-check > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  z-index: 2;
}
.aselect-box {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.25);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s, border-color 0.16s;
  z-index: 1;
  backdrop-filter: blur(4px);
}
.aselect-box svg.nav-ic { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity 0.16s; }
.asset-select-check > input:checked + .aselect-box {
  background: var(--text);
  border-color: var(--text);
}
.asset-select-check > input:checked + .aselect-box svg { opacity: 1; }
.asset-select-check:hover .aselect-box {
  border-color: #fff;
  background: rgba(0,0,0,0.4);
}

/* 卡片选中高亮 */
.asset-item-card.is-selected {
  outline: 2px solid var(--text);
  outline-offset: -1px;
  border-radius: 10px;
}
.asset-item-card.is-selected .asset-item-img::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(0,0,0,0.06);
  pointer-events: none;
  z-index: 1;
}

/* 收藏按钮样式已移除 */

/* —— 上传分类弹窗 —— */
.upload-cat-card {
  position: relative;
  width: 380px !important;
  max-width: 92vw !important;
  padding: 24px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* 关闭按钮：右上角，淡雅灰，覆盖通用蓝色渐变 button 样式 */
.upload-cat-card .script-detail-close-btn {
  position: absolute !important;
  top: 14px !important;
  right: 14px !important;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  border: none !important;
  color: var(--text-3) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  transition: background 0.15s, color 0.15s !important;
  z-index: 2;
}
.upload-cat-card .script-detail-close-btn:hover {
  background: var(--surface-muted) !important;
  color: var(--text) !important;
  transform: none !important;
  box-shadow: none !important;
}
.upload-cat-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.upload-cat-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: -8px;
}
.upload-cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.upload-cat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  text-align: left;
}
.upload-cat-item:hover {
  background: var(--surface);
  border-color: var(--border);
}
.uc-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--surface-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.uc-icon svg.nav-ic {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}
.uc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.uc-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
}

/* —— 参考图添加分类选择弹窗（对齐资产库上传分类弹窗） —— */
.vp-ref-cat-dlg { z-index: 1300 !important; }
.vp-ref-cat-card {
  width: 520px !important;
  max-width: 94vw !important;
}
.vp-ref-cat-grid {
  grid-template-columns: repeat(2, 1fr);
}
.vp-ref-cat-grid .vp-ref-cat-item { min-height: 92px; }

/* —— 个人库底部选择栏 —— */
.asset-bottom-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  min-width: 520px;
  max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(29,33,41,0.16);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  animation: assetBottomBarIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes assetBottomBarIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.asset-bottom-bar[hidden] { display: none !important; }
.asset-bottom-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.asset-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  user-select: none;
}
.asset-select-all > input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.asset-select-all .aselect-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--text-3);
  background: var(--surface);
  border-radius: 4px;
}
.asset-select-all .aselect-box svg.nav-ic { width: 11px; height: 11px; }
.asset-select-all:hover .aselect-box { border-color: var(--text-2); background: var(--surface-muted); }
.asset-select-all > input:checked + .aselect-box {
  background: var(--text);
  border-color: var(--text);
}
.asset-bottom-count {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}
.asset-bottom-count b {
  color: var(--text);
  font-weight: 700;
  margin: 0 2px;
}
.asset-bottom-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.asset-bottom-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #E34D59;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
}
.asset-bottom-btn:hover { background: #cf3d48; }
.asset-bottom-btn svg.nav-ic { width: 15px; height: 15px; }

/* 上传图片的标记角标 */
.asset-item-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border-radius: 4px;
  padding: 2px 6px;
  z-index: 3;
}

/* 内嵌子区域标题（创作参数 / 生成参数 等放在 login-box 内容里的分区头） */
.login-box .sub-head,
.script-collapse-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 0 10px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  border-bottom: none;
}
.login-box .sub-head h2,
.script-collapse-head h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.login-box .sub-head > span,
.script-collapse-head > span:not(:last-child) {
  font-size: 11px;
  color: var(--text-3);
}
.login-box .sub-head > *:last-child:not(h2),
.script-collapse-head > *:last-child:not(h2) {
  margin-left: auto;
}
.script-collapse-head {
  cursor: pointer;
  user-select: none;
}
.script-collapse-head > span:last-child {
  color: var(--brand);
  font-weight: 700;
}

/* 卡片内容容器（沿用原 login-box 选择器，历史原因不改名称） */
.login-box {
  padding: var(--space-md);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.login-box::-webkit-scrollbar { width: 6px; }
.login-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.login-box > p,
.login-box > .intro-text {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-2);
  margin: 0 0 var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-muted);
  border-radius: var(--radius);
  border-left: 3px solid var(--brand);
}

/* ---------- 8. 表单 ---------- */
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 7px;
}

.script-label-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.script-label-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  margin-left: 4px;
  cursor: help;
  position: relative;
  transition: all 0.15s;
}
.script-label-help:hover {
  background: var(--brand);
  color: #fff;
}
.script-label-help[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  transform: none;
  background: var(--text);
  color: var(--surface);
  font-size: 11px;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.script-topic-pick-row,
.script-product-wrap {
  display: flex;
  gap: 7px;
  align-items: center;
}
.script-topic-pick-row > input,
.script-topic-pick-row > select,
.script-topic-pick-row > button,
.script-product-wrap > input {
  height: 38px;
  flex-shrink: 0;
}
.script-topic-pick-row > input,
.script-topic-pick-row > select,
.script-product-wrap > input {
  flex: 1;
  min-width: 0;
}
.script-topic-pick-row > button {
  padding: 0 16px !important;
  height: 38px;
}

.script-product-wrap { position: relative; }

/* 输入框通用 */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="file"],
input:not([type]),
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all 0.2s;
  line-height: 1.5;
}
input::placeholder,
textarea::placeholder { color: var(--placeholder); }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: var(--shadow-focus);
}

textarea { resize: vertical; min-height: 80px; }

/* 只读/禁用样式 */
input[readonly] {
  background: var(--surface-muted);
  opacity: 0.9;
  cursor: default;
}
input[readonly]:focus {
  box-shadow: none;
  border-color: var(--border);
  background: var(--surface-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

/* 固定不可变 API 配置行 */
.script-fixed-api {
  opacity: 0.75;
}
.script-fixed-api input {
  background: var(--surface-muted);
  cursor: not-allowed;
  user-select: all;
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  font-size: 12px;
}

/* 产品输入历史下拉（隐藏态） */
.script-product-history {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 20;
  padding: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.script-product-history[hidden] { display: none !important; }
.script-product-history > div {
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}
.script-product-history > div:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------- 9. 按钮 ---------- */
button[type="button"]:not(.secondary):not(.nav-btn):not(.icon-btn):not(.tab-btn):not(.script-detail-tab):not(.script-detail-close):not(.script-detail-close-btn):not(.script-image-viewer-close):not(.settings-modal-close):not(.toast-close):not(.upload-cat-item):not(.apn-item):not(.asset-upload-btn):not(.chat-opt-nav):not(.chat-opt-add):not(.chat-opt-add-confirm):not(.chat-opt-next):not(.chat-opt-prev):not(.chat-home-btn):not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn),
button:not([type]):not(.secondary):not(.nav-btn):not(.icon-btn):not(.tab-btn):not(.script-detail-tab):not(.script-detail-close):not(.script-detail-close-btn):not(.script-image-viewer-close):not(.settings-modal-close):not(.toast-close):not(.upload-cat-item):not(.apn-item):not(.asset-upload-btn):not(.chat-opt-nav):not(.chat-opt-add):not(.chat-opt-add-confirm):not(.chat-opt-next):not(.chat-opt-prev):not(.chat-home-btn):not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn) {
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--grad-btn);
  color: #fff;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.25);
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  white-space: nowrap;
}
html[data-theme="dark"] button[type="button"]:not(.secondary):not(.nav-btn):not(.icon-btn):not(.tab-btn):not(.script-detail-tab):not(.script-detail-close):not(.script-detail-close-btn):not(.script-image-viewer-close):not(.settings-modal-close):not(.toast-close):not(.upload-cat-item):not(.apn-item):not(.asset-upload-btn):not(.chat-opt-nav):not(.chat-opt-add):not(.chat-opt-add-confirm):not(.chat-opt-next):not(.chat-opt-prev):not(.chat-home-btn):not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn),
html[data-theme="dark"] button:not([type]):not(.secondary):not(.nav-btn):not(.icon-btn):not(.tab-btn):not(.script-detail-tab):not(.script-detail-close):not(.script-detail-close-btn):not(.script-image-viewer-close):not(.settings-modal-close):not(.toast-close):not(.upload-cat-item):not(.apn-item):not(.asset-upload-btn):not(.chat-opt-nav):not(.chat-opt-add):not(.chat-opt-add-confirm):not(.chat-opt-next):not(.chat-opt-prev):not(.chat-home-btn):not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn) {
  box-shadow: 0 3px 12px rgba(129, 140, 248, 0.35);
}

button:hover:not(:disabled):not(.secondary):not(.nav-btn):not(.icon-btn):not(.tab-btn):not(.script-detail-tab):not(.script-detail-close):not(.script-detail-close-btn):not(.script-image-viewer-close):not(.settings-modal-close):not(.toast-close):not(.upload-cat-item):not(.apn-item):not(.asset-upload-btn):not(.chat-opt-nav):not(.chat-opt-add):not(.chat-opt-add-confirm):not(.chat-opt-next):not(.chat-opt-prev):not(.chat-home-btn):not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn) {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(99, 102, 241, 0.32);
}
button:active:not(:disabled) { transform: translateY(0); }
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* 次级按钮（带 .secondary class）：统一为主色描边风格（对齐「一键生成」按钮） */
button.secondary {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand);
  box-shadow: none;
  font-weight: 600;
  border-radius: 6px;
  background-image: none;
}
button.secondary:hover:not(:disabled) {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: none;
  transform: none;
  background-image: none;
}

/* 按钮操作行 */
.script-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.script-balance-inline {
  margin-top: 4px;
}
.script-balance-inline .hint {
  font-size: 12px;
  color: var(--text-3);
}
.script-balance-row {
  margin: var(--space-sm) 0 2px;
  padding: 6px 0;
}
.script-key-save-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.6;
}

.hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  min-height: 1.2em;
}

/* ---------- 10. 进度条 ---------- */
.script-progress-wrap {
  padding: 10px 18px 0;
}
.script-progress-track {
  height: 6px;
  background: var(--surface-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.script-progress-bar {
  height: 100%;
  background: var(--grad-btn);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.4s ease;
  position: relative;
}
.script-progress-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.script-progress-text {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  margin-bottom: 10px;
}

/* ---------- 11. 标签 / 徽标 ---------- */
.tag,
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}
.tag-done, .tag-green { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.tag-doing, .tag-blue { background: var(--tag-blue-bg); color: var(--tag-blue-fg); }
.tag-wait, .tag-amber { background: var(--tag-amber-bg); color: var(--tag-amber-fg); }
.tag-error, .tag-rose { background: var(--tag-rose-bg); color: var(--tag-rose-fg); }
.tag-info, .tag-purple { background: var(--tag-purple-bg); color: var(--tag-purple-fg); }

/* ---------- 12. 列表类容器（历史/资产/视频） ---------- */
.asset-library-list[hidden] { display: none !important; }
.script-history-list,
.video-gen-list,
.asset-library-list,
.asset-library-card > div:last-child {
  padding: var(--space-sm);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* 空状态 */
.script-history-list.empty,
.video-gen-list.empty,
.asset-library-list.empty,
.asset-library-card > div:last-child.empty {
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 12px;
  padding: 40px var(--space-md);
  text-align: center;
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}

/* 剧本历史卡片 */
/* ---- 剧本历史卡片：两种类名兼容 ---- */
/* 新版结构（history-card / history-top / history-thumb 等） */
.script-history-list:not(.empty) .history-card,
.script-history-list .history-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
}
.script-history-list .history-card:hover {
  border-color: var(--brand);
  background: var(--surface-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

/* 旧版结构（_renderHistory 动态生成的 script-history-card / script-history-title 等） */
.script-history-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.script-history-card:hover {
  border-color: var(--brand);
  background: var(--surface-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.script-history-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.script-history-meta {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-3);
}
.script-history-meta > span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.script-history-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.script-history-rename,
.script-history-delete {
  padding: 4px 10px !important;
  font-size: 11px !important;
  height: 26px !important;
  background: var(--surface-muted) !important;
  color: var(--text-2) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
.script-history-rename:hover,
.script-history-delete:hover {
  color: var(--brand) !important;
  border-color: var(--brand) !important;
  background: var(--brand-soft) !important;
  transform: none !important;
}
.script-history-delete:hover {
  color: var(--err) !important;
  border-color: var(--err) !important;
  background: var(--tag-rose-bg) !important;
}

/* 剧本卡片 · 横屏卡片（左封面 + 右信息） */
.script-history-card.landscape {
  flex-direction: row;
  padding: 0;
  overflow: hidden;
  min-height: 110px;
  align-items: stretch;
  gap: 0;
}
.script-history-card.landscape:hover {
  transform: translateY(-1px);
}
.script-history-cover {
  width: 180px;
  min-width: 180px;
  flex-shrink: 0;
  background: var(--surface-muted);
  overflow: hidden;
  position: relative;
  border-right: 1px solid var(--border);
}
.script-history-cover img {
  width: 100%;
  height: 100%;
  min-height: 110px;
  object-fit: cover;
  display: block;
}
.script-history-cover-placeholder {
  width: 100%;
  height: 100%;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-brand);
}
.script-history-cover-placeholder span {
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  letter-spacing: 2px;
}
.script-history-cover-placeholder {
  flex-direction: column;
  gap: 10px;
}
.script-history-cover-gen {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: background 0.18s;
}
.script-history-cover-gen:hover {
  background: rgba(255, 255, 255, 0.3);
}
.script-history-cover-gen:disabled {
  opacity: 0.7;
  cursor: default;
}
.script-history-body {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.script-history-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.script-history-title-row .script-history-title {
  font-size: 15px;
  -webkit-line-clamp: 1;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.script-history-topic {
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-soft);
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  align-self: flex-start;
}
.script-history-card.landscape .script-history-meta {
  margin-top: auto;
  align-items: center;
  justify-content: flex-start;
}
.script-history-card.landscape .script-history-meta > span:first-child {
  flex: none;
}
.script-history-pill {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.6;
}
.script-history-pill.cost {
  background: var(--tag-amber-bg);
  border-color: transparent;
  color: var(--tag-amber-fg);
  font-weight: 600;
}
@media (max-width: 640px) {
  .script-history-card.landscape {
    flex-direction: column;
    min-height: auto;
  }
  .script-history-cover {
    width: 100%;
    min-width: 0;
    height: 150px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .script-history-cover img,
  .script-history-cover-placeholder {
    min-height: 150px;
  }
}

/* 历史卡片缩略图 + 信息 */
.history-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.history-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--grad-logo);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }

.history-info { flex: 1; min-width: 0; }
.history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-meta {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stat-pill {
  padding: 8px 4px;
  background: var(--surface-muted);
  border-radius: 7px;
  text-align: center;
}
.stat-pill .n {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.stat-pill .l {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
}

.history-progress { margin-top: 10px; }
.history-progress .script-progress-track { height: 5px; }
.history-progress-text {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 5px;
}

/* ---- 详情页 Tabs 下面板的空状态样式 ---- */
.script-empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 0;
  justify-content: center;
}
.script-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.script-empty-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.script-empty-desc {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.6;
}
.script-empty-go {
  margin-top: 6px !important;
  padding: 8px 18px !important;
  font-size: 12px !important;
  height: 34px !important;
}

/* 清空按钮 */
#scriptClearHistoryBtn {
  padding: 5px 11px !important;
  font-size: 11px !important;
}

/* ---------- 13. 剧本详情弹窗（Tab + 卡片式） ---------- */
.script-rename-mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}
.script-rename-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: slideUp 0.25s ease;
}
.script-rename-dialog h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.script-rename-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.script-rename-input:focus { border-color: var(--brand); }
.script-rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.script-rename-actions .secondary { padding: 0 16px; height: 38px; }
.script-rename-ok {
  height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.2s ease;
}
.script-rename-ok:hover { filter: brightness(1.08); }

/* ---------- 13. 剧本详情弹窗（Tab + 卡片式） ---------- */
.notice-dialog {
  position: fixed;
  inset: 0;
  background: var(--mask);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.notice-dialog[hidden] { display: none !important; }

.notice-dialog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 980px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  /* 外层改为 overflow:visible，避免裁剪内部卡片弹出的下拉菜单；滚动由 .script-detail-body 内部承担 */
  overflow: visible;
  animation: slideUp 0.25s ease;
}
/* 剧本详情弹窗需要更宽来展示横向视频卡片（一张一行铺满，画面更舒展） */
.notice-dialog-card.script-detail-card {
  max-width: 1280px;
}
/* 积分充值确认弹窗 */
.recharge-confirm-card {
  max-width: 380px;
}
.recharge-confirm-body {
  padding: 18px 20px 6px;
}
.recharge-confirm-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text);
}
.recharge-confirm-line b {
  color: var(--brand);
  font-size: 16px;
}
.recharge-confirm-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 16px;
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.script-detail-card { }

.script-detail-card .card-head {
  padding: 16px 20px;
  flex-wrap: wrap;
}
.script-detail-card .script-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.script-detail-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
  padding: 0;
}
.script-detail-close:hover {
  color: var(--err);
  background: var(--tag-rose-bg);
  border-color: transparent;
}

/* 详情 Tabs */
.script-detail-tabs {
  display: flex;
  gap: 6px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  overflow-x: auto;
  flex-shrink: 0;
}
.script-detail-tab {
  padding: 15px 6px;
  margin-right: 26px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.script-detail-tab:hover { color: var(--text); }
.script-detail-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
  font-size: 14.5px;
}

.script-detail-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.8;
  font-size: 13px;
  color: var(--text);
}
.script-detail-body h3 {
  font-size: 14px;
  margin: 16px 0 8px;
  color: var(--brand);
  font-weight: 600;
}
.script-detail-body h4 {
  font-size: 13px;
  margin: 12px 0 6px;
  color: var(--text);
}
.script-detail-body p {
  color: var(--text);
  margin: 6px 0;
}
.script-detail-body img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 8px 0;
  cursor: zoom-in;
}
.script-detail-body pre {
  background: var(--surface-muted);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
}
.script-detail-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.script-detail-body th,
.script-detail-body td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.script-detail-body th {
  background: var(--surface-muted);
  color: var(--text-2);
  font-weight: 600;
}

/* ---------- 14. 图片查看器（样式见后方实体卡片区） ---------- */

/* ---------- 15. 设置弹窗 ---------- */
.settings-modal-mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}
.settings-modal-mask[hidden] { display: none !important; }

.settings-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}
.settings-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-modal-head h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  margin: 0;
}
.settings-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding: 0;
  transition: all 0.15s;
}
.settings-modal-close:hover {
  color: var(--err);
  background: var(--tag-rose-bg);
  border-color: transparent;
}
.settings-modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}
.settings-modal-body label {
  margin-top: 12px;
  display: block;
}
.settings-modal-body label:first-child {
  margin-top: 0;
}

/* ---------- 站位图确认框（一键生成/重新识别 弹窗） ---------- */
.script-recover-modal-mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: 1001;
  animation: fadeIn 0.2s ease;
}
.script-recover-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}
.script-recover-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.script-recover-modal-title strong {
  font-size: 16px;
  color: var(--text);
}
.script-recover-modal-close {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-2);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.script-recover-modal-close:hover {
  color: var(--err);
  background: var(--tag-rose-bg);
  border-color: transparent;
}
.script-recover-modal-body {
  padding: 20px;
  overflow-y: auto;
}
.script-recover-modal-tip {
  margin: 0 0 14px 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}
.script-recover-modal-tip strong {
  color: var(--text);
  font-size: 15px;
}
.script-recover-modal-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.script-recover-cancel {
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.script-recover-cancel:hover {
  background: var(--surface-hover);
}
.script-recover-apply {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.script-recover-apply:hover {
  opacity: 0.9;
}

/* ---------- 16. Toast 通知 ---------- */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 80vw;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.toast-info { border-left: 3px solid var(--info); }
.toast.toast-ok { border-left: 3px solid var(--ok); }
.toast.toast-warn { border-left: 3px solid var(--warn); }
.toast.toast-error { border-left: 3px solid var(--err); }

/* ---------- 17. 视频生成特有样式 ---------- */
.video-gen-ref-upload {
  min-height: 120px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface-muted);
  position: relative;
  overflow: hidden;
}
.video-gen-ref-upload:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.video-gen-ref-upload.is-drag {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.01);
}
.video-gen-ref-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
}
.video-gen-ref-placeholder .nav-ic {
  width: 28px;
  height: 28px;
  color: var(--brand);
}

.video-gen-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  width: 100%;
}
.video-gen-ref-grid > div {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}
.video-gen-ref-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-gen-ref-grid span {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.video-gen-ref-grid span:hover { transform: scale(1.1); }

/* 视频生成结果卡片 */
.video-gen-list:not(.empty) .video-card,
.video-gen-list .video-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: all 0.2s;
}
.video-gen-list .video-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.video-gen-list .video-card > div:first-child {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--surface-muted);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-gen-list .video-card video,
.video-gen-list .video-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* video-gen 任务列表：视频播放器自适应（宽度占满，高度按真实比例由 JS 设置，防溢出） */
.video-gen-task-video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9; /* 元数据未加载时兜底，JS 加载后内联覆盖 */
  object-fit: contain;
  background: #000;
  border-radius: var(--radius);
  max-height: 480px;
}
.video-gen-list .video-card .title {
  padding: 10px 12px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-card-meta {
  padding: 4px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.video-card-meta .meta-left {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.video-card-meta .meta-right {
  display: flex;
  gap: 6px;
}
.video-card-meta .meta-right button {
  padding: 4px 10px !important;
  font-size: 11px !important;
}

/* ---------- 18. 资产库特有样式 ---------- */
.asset-library-list {
  display: flex !important;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0 0;
}
.asset-library-list.empty {
  display: flex !important;
}
/* 资产剧本分组块（每个剧本一个 block） */
.asset-script-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: all 0.2s;
}
.asset-script-block:hover {
  border-color: var(--text-3);
  box-shadow: var(--shadow-card);
}
/* 资产剧本头（标题+元信息+空状态提示） */
.asset-script-head {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
.asset-script-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-script-meta {
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
/* 尚未落图空提示 */
.asset-empty-hint {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.8;
}
/* 资产图片网格（当剧本有落图时，在 head 下方显示） */
.asset-grid {
  padding: 12px 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.asset-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  aspect-ratio: 3 / 4;
}
.asset-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.asset-card.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-card);
}
.asset-img-thumb {
  flex: 1;
  background: var(--grad-logo);
  position: relative;
  overflow: hidden;
  min-height: 100px;
}
.asset-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.asset-card-name {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface-muted);
  border-top: 1px solid var(--border);
}

.asset-thumb {
  aspect-ratio: 1;
  background: var(--surface-muted);
  overflow: hidden;
  position: relative;
}
.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.asset-card:hover .asset-thumb img { transform: scale(1.04); }

.asset-body {
  padding: 10px 12px;
  min-width: 0;
  display: grid;
  gap: 4px;
}
.asset-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.asset-remark {
  font-size: 10px;
  color: var(--text-3);
  margin: 2px 0 4px;
  line-height: 1.4;
  max-height: 3em;
  overflow: hidden;
}
.asset-type-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--tag-blue-bg);
  color: var(--tag-blue-fg);
  border-radius: var(--radius-full);
  font-weight: 500;
  width: fit-content;
}

.asset-card .asset-actions {
  padding: 6px 10px 12px;
  display: flex;
  gap: 5px;
}
.asset-card .asset-actions button {
  flex: 1;
  padding: 5px 8px !important;
  font-size: 10px !important;
  min-width: 0;
}
.asset-card .asset-actions .asset-view-btn { }
.asset-card .asset-actions .asset-download-btn { }
.asset-card .asset-actions .asset-delete-btn {
  background: var(--surface-muted) !important;
  color: var(--err) !important;
  border: 1px solid var(--border) !important;
}

/* 主页剧本块内的缩略图条（8 张 +N） */
.asset-thumb-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 14px 14px;
  align-items: stretch;
}
.asset-thumb {
  aspect-ratio: 3 / 4;
  background: var(--surface-muted);
  overflow: hidden;
  position: relative;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.asset-script-block:hover .asset-thumb img { transform: scale(1.04); }
.asset-thumb-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(29, 33, 41, 0.62);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  backdrop-filter: blur(3px);
}
.asset-thumb-more {
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  aspect-ratio: 3 / 4;
}

/* -------- 资产详情 Modal 卡片（与剧本生成弹窗同款 UI 框架，专属 4 Tab） ---------- */
.asset-detail-modal-card {
  max-width: 1180px; /* 比剧本详情更宽，方便铺满角色/场景图片网格 */
  max-height: calc(100vh - 56px);
}
/* Tab 条 */
.asset-detail-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  overflow-x: auto;
  flex-shrink: 0;
}
/* 4 个 Tab 面板（共用 .script-detail-body 的内部滚动） */
.script-detail-body[data-asset-panel-wrap] {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 22px;
}
.asset-tab-panel {
  display: block;
  width: 100%;
}
.asset-tab-panel[hidden] {
  display: none;
}
/* 顶部统计 meta 对齐（顶栏右侧） */
#assetDetailMeta {
  align-self: center;
}

/* -------- 资产详情：4 类内容网格（角色/场景/道具/视频） ---------- */
.asset-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
  align-items: start;
}
.asset-type-grid.empty-grid {
  display: flex;
}
.asset-empty-inline {
  flex: 1;
  text-align: center;
  padding: 56px 16px;
  background: var(--surface-muted);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

/* -------- 单个资产卡片（图片/视频） ---------- */
.asset-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
}
.asset-item-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.asset-item-img {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--grad-logo);
  overflow: hidden;
}
.asset-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.asset-item-card:hover .asset-item-img img { transform: scale(1.05); }
.asset-item-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(29, 33, 41, 0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  backdrop-filter: blur(3px);
}
.asset-item-info {
  padding: 8px 10px 10px;
  display: grid;
  gap: 3px;
}
.asset-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.asset-item-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -------- 视频类资产 ---------- */
.asset-type-grid.videos {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.asset-type-grid.videos .asset-item-img,
.asset-item-card.video-card .asset-item-img {
  aspect-ratio: 16 / 9;
}
.asset-item-img.video {
  background: #0f1115;
}
.asset-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #272A33 0%, #16181E 100%);
}
.asset-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(29, 33, 41, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.14);
}
.asset-video-status {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

/* ---------- 19. 个人中心特有样式 ---------- */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--grad-logo);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.profile-plan {
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
  margin-top: 3px;
}

/* 顶部通栏渐变横幅（头像 + 昵称 + 等级 + 积分） */
.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 26px;
  background: var(--grad-brand);
  color: #fff;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  flex-shrink: 0;
}
.profile-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.profile-hero::before {
  content: "";
  position: absolute;
  left: 30%;
  bottom: -70px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.profile-hero-info {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.profile-hero .profile-avatar {
  width: 60px;
  height: 60px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.profile-hero-meta { min-width: 0; }
.profile-hero .profile-name {
  color: #fff;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-hero .profile-plan {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.18);
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  margin-top: 7px;
  font-weight: 500;
  font-size: 12px;
}
/* 右侧积分区 */
.profile-hero-credit {
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.profile-hero-credit .profile-credit-label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
}
.profile-hero-credit .profile-credit-num {
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: initial;
}
.profile-credit-chip {
  font-size: 11px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
/* 个人中心·退出登录按钮 */
.profile-logout-btn {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin-left: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.profile-logout-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.7);
}
.profile-logout-btn:active {
  transform: translateY(1px);
}
@media (max-width: 720px) {
  .profile-logout-btn { padding: 8px 12px; font-size: 12px; }
}

/* 左栏通用区块（积分充值 / 卡密兑换 / 代理中心子区块） */
.profile-section {
  padding: 0 18px 8px;
}
.profile-section .sub-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 16px 0 10px;
  border-top: 1px solid var(--border);
}
.profile-section .sub-head h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.profile-section .sub-head > span {
  font-size: 11px;
  color: var(--text-3);
}
.profile-section .sub-head > *:last-child:not(h2) {
  margin-left: auto;
}

/* 通用操作按钮（立即充值 / 兑换卡密） */
.profile-action-btn {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--grad-btn);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(91, 97, 240, 0.25);
  flex-shrink: 0;
}
.profile-action-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.profile-action-btn:active {
  transform: translateY(0);
}

/* 退出登录按钮（个人中心，由 AuthGate 渲染） */
.auth-logout-line {
  margin-top: 18px;
}
.auth-logout-btn {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--danger, #f5222d);
  border-radius: var(--radius);
  background: transparent;
  color: var(--danger, #f5222d);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-logout-btn:hover {
  background: var(--danger, #f5222d);
  color: #fff;
}
.auth-logout-btn:active {
  transform: translateY(0);
}

/* 右栏：使用概况 + 代理中心 纵向排列 */
.profile-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: 0;
  overflow: hidden;
}

/* 右栏底部卡片撑满剩余高度 */
.card-grow {
  flex: 1;
  min-height: 0;
}
.card-grow .login-box { flex: 1; }

/* 会员套餐卡片 */
.profile-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 8px 0 12px;
}
.profile-plan-item {
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-muted);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.profile-plan-item:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.profile-plan-item.profile-plan-item-hot {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.profile-plan-item.profile-plan-item-pro { }
.profile-plan-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.profile-plan-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
  margin: 6px 0 4px;
}
.profile-plan-desc {
  font-size: 10px;
  color: var(--text-3);
  line-height: 1.4;
}

#profileUpgradeBtn {
  width: 100%;
  margin-top: 4px;
}

/* 使用统计 */
.profile-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  padding: var(--space-md) 0;
}
.profile-stat {
  padding: var(--space-md) 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-align: center;
}
.profile-stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 3px;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.profile-stat-label {
  font-size: 11px;
  color: var(--text-3);
}

/* 积分充值 */
.profile-credit-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 0;
}
.profile-credit-num {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.profile-credit-label {
  font-size: 12px;
  color: var(--text-3);
}
.profile-recharge-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.profile-recharge-plan {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 11px 4px;
  border: none;
  border-radius: 10px;
  background: var(--grad-btn);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(91, 97, 240, 0.22);
}
.profile-recharge-plan b {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
}
.profile-recharge-plan em {
  font-style: normal;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}
.profile-recharge-plan:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.profile-recharge-plan:active {
  transform: translateY(0);
}
@media (max-width: 860px) {
  .profile-recharge-plans { grid-template-columns: 1fr; }
}

/* 代理中心 */
.profile-referral-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.profile-referral-grid .profile-section { padding: 0; }
.referral-code-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.referral-code-text {
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 12px;
  border: 1px dashed var(--brand);
  border-radius: var(--radius-card);
  background: var(--surface-muted);
  color: var(--brand);
}
.referral-link-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.referral-link-label input {
  flex: 1;
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--text-2);
}
.profile-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.profile-btn:hover {
  background: var(--brand);
  color: #fff;
}
.referral-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: var(--space-sm);
}
.referral-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  font-size: 13px;
}
.referral-item .rf-phone {
  font-weight: 600;
  color: var(--text);
}
.referral-item .rf-time {
  font-size: 11px;
  color: var(--text-3);
}

/* 兑换卡密 */
#profileCardKeyInput {
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  letter-spacing: 0.5px;
}

/* ---------- 20. 响应式：小屏自适应 ---------- */
@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(300px, auto);
  }
  .profile-plan-grid {
    grid-template-columns: 1fr;
  }
  .profile-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
}

@media (max-width: 860px) {
  .glass-nav { width: 64px; }
  .glass-nav-brand { padding: 14px 10px; justify-content: center; }
  .brand-text-block { display: none; }
  .sb-user-card { justify-content: center; padding: 8px; margin: 10px 6px; }
  .sb-user-info { display: none; }
  .sb-group-title { display: none; }
  .glass-nav-menu { padding: 0 6px; }
  .nav-btn { justify-content: center; padding: 10px; }
  .nav-btn span:not(.nav-count) { display: none; }
  .nav-count { margin: 0; }
  .glass-nav-status { flex-direction: column; padding: 8px; gap: 6px; }
  .icon-btn.theme-toggle span { display: none; }
  .status-pill { display: none; }
  .version-badge { display: none; }

  .view > .grid { padding: var(--space-sm); gap: var(--space-sm); }
  .ws-topbar { padding: 0 var(--space-sm); height: 50px; gap: var(--space-sm); }
  .ws-search { display: none; }
  .profile-stat-row { grid-template-columns: 1fr; }
  .profile-referral-grid { grid-template-columns: 1fr; }
  .profile-page { gap: var(--space-sm); }
  .profile-grid { gap: var(--space-sm); }
  .profile-hero { padding: 16px 18px; }
  .profile-hero-credit .profile-credit-num { font-size: 28px; }
  .profile-credit-chip { display: none; }
}

/* ---------- 21. 滚动条美化 ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
  background-clip: padding-box;
  border: 2px solid transparent;
}
::-webkit-scrollbar-corner { background: transparent; }

/* 选择文本颜色 */
::selection {
  background: var(--brand);
  color: #fff;
}

/* ---------- 22. 选题弹窗 ---------- */
.script-topic-picker-mask,
.script-plot-modal-mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}
.script-topic-picker,
.script-plot-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}
.script-plot-modal { max-width: 560px; }

.script-topic-picker-head,
.script-plot-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.script-topic-picker-title,
.script-plot-modal-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.script-topic-picker-title strong,
.script-plot-modal-title strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.script-topic-picker-title span,
.script-plot-modal-title span {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.script-topic-picker-close,
.script-plot-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.script-topic-picker-close:hover,
.script-plot-modal-close:hover {
  color: var(--err);
  background: var(--tag-rose-bg);
  border-color: transparent;
}

.script-topic-picker-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.script-topic-picker-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 40px 0;
  line-height: 1.8;
}
.script-topic-picker-body {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.script-topic-category {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
}
.script-topic-category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  margin: 4px 0 2px;
  background: linear-gradient(90deg, var(--brand-soft) 0%, transparent 100%);
  border-radius: 8px 0 0 8px;
  border-left: 3px solid var(--brand);
}
.script-topic-category-title strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
}
.script-topic-category-title span {
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.script-topic-grid {
  display: grid;
  grid-template-columns: 1fr; /* 一个选项一横：单列占满一行 */
  gap: 8px;
}
.script-topic-option {
  text-align: left;
  box-sizing: border-box;
  padding: 12px 16px;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  font-size: 13px;
  color: var(--text) !important;
  cursor: pointer;
  line-height: 1.65;
  transition: all 0.15s;
  min-height: 44px;
  height: auto;
  width: 100%;
  box-shadow: none !important;
  background-image: none !important;
  letter-spacing: normal !important;
  font-weight: 500;
  white-space: nowrap;      /* 一整行：不折行 */
  overflow: hidden;
  text-overflow: ellipsis; /* 超长省略号，不换行 */
  display: block !important;
}
.script-topic-option:hover {
  border-color: var(--brand) !important;
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.script-topic-picker-foot,
.script-plot-modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface-muted);
}

/* ---------- 23. 剧情编辑弹窗 ---------- */
.script-plot-modal-body {
  padding: 18px 20px 14px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.script-plot-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}
.script-plot-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  outline: none;
  resize: vertical;
  min-height: 180px;
  transition: all 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}
.script-plot-textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: var(--shadow-focus);
}
.script-plot-textarea::placeholder { color: var(--placeholder); }

.script-plot-ai-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.script-plot-ai-btn {
  padding: 8px 16px !important;
  height: 36px !important;
  font-size: 12px !important;
}
.script-plot-ai-hint {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.6;
}
.script-plot-save {
  padding: 9px 20px !important;
  font-size: 13px !important;
}

/* ---------- 24. 详情面板：通用实体卡片组件 ---------- */
/* 空状态（详情 tab 内容为空） */
.script-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.8;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px dashed var(--border);
}

/* 角色/场景工具栏 */
.script-label-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap; /* 空间不足时换行，避免右侧按钮被挤出卡片/视口右缘 */
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.script-label-toolbar-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.script-label-toolbar-info strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.script-label-toolbar-info span {
  font-size: 11px;
  color: var(--text-3);
  white-space: normal;
}
.script-label-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.script-label-toolbar-actions button {
  padding: 6px 12px !important;
  font-size: 11px !important;
  height: 30px !important;
}
/* 视频生成：模型/比例 选择器（一键生成旁），对齐工具栏按钮高度 */
.script-video-model,
.script-video-ratio {
  height: 30px;
  padding: 0 8px !important;
  font-size: 12px !important;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  max-width: 130px;
}
/* 视频生成工具栏：模型/比例 下拉 + 「一键生成」固定横排一行 */
.script-label-toolbar-actions.script-video-actions {
  /* 固定一行不换行：模型/比例/「一键生成」从左到右依次排列（模型在最左、比例其后、按钮最后） */
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
}
.script-label-toolbar.script-video-toolbar {
  flex-wrap: wrap;
  row-gap: 8px;
}
.script-label-toolbar .script-label-toolbar-info {
  flex: 1 1 auto;
  min-width: 0;
}
.script-label-toolbar .script-label-toolbar-info span {
  white-space: normal;
}
/* 若 actions 宽度不足，让「一键生成」按钮允许收缩以保证同行且不溢出 */
.script-video-actions .script-video-gen-all {
  flex: 0 1 auto;
  white-space: nowrap;
  margin-left: auto;
}
.script-video-actions .script-video-model,
.script-video-actions .script-video-ratio {
  flex: 0 0 auto;
}
/* 一键下载按钮：与「一键生成」同行可收缩，不换行 */
.script-video-actions .script-video-download-all {
  flex: 0 1 auto;
  white-space: nowrap;
}
.script-video-actions .script-video-gen-all {
  flex: 0 0 auto;
  white-space: nowrap;
}
.script-label-toolbar-actions .danger.script-label-delete-selected {
  margin-left: auto;
}

/* 添加实体弹窗（角色/场景/道具：AI 解析创建） */
.script-add-entity-mask {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  padding: 20px;
}
.script-add-entity-modal {
  width: 460px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.script-add-entity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.script-add-entity-title strong {
  font-size: 15px;
  color: var(--text);
}
.script-add-entity-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.script-add-entity-close:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.script-add-entity-body {
  padding: 18px;
}
.script-add-entity-tip {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.script-add-entity-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 90px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
}
.script-add-entity-input:focus {
  outline: none;
  border-color: var(--brand-2);
}
.script-add-entity-status {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
}
.script-add-entity-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.script-add-entity-cancel {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.script-add-entity-cancel:hover {
  background: var(--surface-muted);
}
.script-add-entity-apply {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-1));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.script-add-entity-apply:hover {
  opacity: 0.9;
}
button.danger {
  background: linear-gradient(135deg, #EF4444 0%, #F97316 100%) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.22) !important;
}
button.danger:hover:not(:disabled) {
  box-shadow: 0 5px 16px rgba(239, 68, 68, 0.32) !important;
}

/* 通用实体卡片（剧情概要 / 角色 / 场景 共用） */
.script-entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  /* 不再 overflow:hidden，避免裁剪底部导入下拉菜单（卡片内没有 float 清需求） */
  overflow: visible;
  position: relative;
  transition: all 0.2s;
}
.script-entity-card:last-child {
  margin-bottom: 0;
}
.script-entity-card.script-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.script-summary-card {
  margin-bottom: 0;
}
.script-entity-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
/* 自定义复选框 */
.script-select-box {
  position: relative;
  width: 18px;
  height: 18px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.script-select-box input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.script-select-box span {
  display: block;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  transition: all 0.15s;
  position: relative;
}
.script-select-box input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
}
.script-select-box input:checked + span::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.script-entity-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.script-entity-tag {
  padding: 2px 8px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}
.script-entity-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.script-entity-actions button {
  padding: 5px 11px !important;
  font-size: 11px !important;
  height: 28px !important;
}

/* 实体卡片主体：横版（左图 + 右信息） */
.script-entity-main {
  padding: 14px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: stretch;
}
/* 站位图卡片：图片放大显示（站位图多为 16:9 白模图，给足横向空间） */
.script-shotmap-card .script-entity-main {
  grid-template-columns: minmax(260px, 46%) 1fr;
}
.script-shotmap-card .script-entity-img {
  min-height: 190px;
}
.script-summary-card .script-entity-main,
.script-scene-card .script-entity-main {
  /* 剧情概要/场景 不强制两栏布局，根据有无图自适应 */
}
.script-summary-card .script-entity-main {
  grid-template-columns: 1fr;
}
.script-entity-main > .script-entity-img-area {
  grid-column: 1;
  grid-row: 1;
  order: -1;
}
.script-entity-main > .script-card-content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}
/* 字段键值对（角色/场景 通用） */
.script-card-field {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  line-height: 1.6;
}
.script-card-field:last-child {
  border-bottom: none;
}
.script-card-label {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  padding-top: 2px;
}
.script-card-value {
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
/* 剧情概要文字态：无字段，用普通段落 */
.script-summary-card .script-card-content {
  font-size: 13px;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 4px 8px 6px 14px;
}
/* 实体卡配图区（横版：占满第一列，高度撑满右侧信息区） */
.script-entity-img-area {
  min-width: 0;
  display: flex;
  align-items: stretch;
}
.script-entity-img {
  position: relative;
  flex: 1;
  align-self: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  transition: border-color 0.18s;
  min-height: 120px;
}
.script-entity-img:hover {
  border-color: var(--brand);
}
.script-entity-img img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.script-entity-img-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
  z-index: 2;
}
.script-entity-img:hover .script-entity-img-del,
.script-entity-img-del:focus-visible {
  opacity: 1;
}
.script-entity-img-del:hover {
  background: rgba(220, 38, 38, 0.85);
}

/* 底部操作栏（生成图片 / 导入） */
.script-entity-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.script-entity-foot:empty {
  display: none;
}
/* 生成图片按钮 */
.script-gen-img-btn {
  border: 1px solid var(--brand) !important;
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
  border-radius: 6px !important;
  padding: 6px 14px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
}
.script-gen-img-btn:hover {
  background: var(--brand) !important;
  color: #fff !important;
}
.script-gen-img-btn:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}
/* 每张卡片生图进度条 */
.script-img-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}
.script-img-progress[hidden] { display: none; }
.script-img-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.2);
  overflow: hidden;
}
.script-img-progress-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width .4s ease;
}
.script-img-progress-text {
  min-width: 34px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: #3b82f6;
  font-variant-numeric: tabular-nums;
}
/* 导入图片按钮 */
.script-import-img-btn {
  border: 1px solid var(--border-strong) !important;
  background: var(--surface) !important;
  color: var(--text-2) !important;
  border-radius: 6px !important;
  padding: 6px 14px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
}
.script-import-img-btn:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
  border-color: var(--text-3) !important;
}
/* 导入下拉容器 */
.script-import-drop {
  position: relative;
  display: inline-flex;
  /* 强制建立高堆叠上下文，确保子菜单能浮在其它卡片之上 */
  z-index: 1;
}
.script-import-drop:focus-within {
  z-index: 99998;
}
.script-import-drop .script-import-img-btn {
  white-space: nowrap;
}
/* 导入下拉菜单（使用 fixed 定位，彻底避免被任何祖先 overflow/层级裁剪） */
.script-import-menu {
  position: fixed;
  z-index: 9999999 !important;
  min-width: 144px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(30, 41, 59, 0.12), 0 2px 6px rgba(30, 41, 59, 0.06);
  padding: 4px;
  display: none;
  flex-direction: column;
}
.script-import-menu.open {
  display: flex;
}
/* hover 兜底（防止点击事件失效时仍可打开） */
.script-import-drop:hover > .script-import-menu,
.script-import-menu:hover {
  display: flex;
}
.script-import-menu button {
  border: none !important;
  background: transparent !important;
  color: var(--text) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-align: left !important;
  padding: 8px 10px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
}
.script-import-menu button:hover {
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
}

/* 编辑/保存按钮（实体卡 + 镜头卡通用） */
.script-detail-body .script-edit-btn,
.script-detail-body .script-save-btn,
.script-shot-card .script-edit-btn,
.script-shot-card .script-save-btn {
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.18s !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
}
.script-edit-btn {
  background: var(--surface) !important;
  color: var(--text-2) !important;
  border-color: var(--border) !important;
}
.script-edit-btn:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
  border-color: var(--text-3) !important;
}
.script-save-btn {
  background: var(--surface) !important;
  color: var(--ok) !important;
  border-color: var(--tag-green-bg) !important;
}
.script-save-btn:hover {
  background: var(--tag-green-bg) !important;
  color: var(--tag-green-fg) !important;
}

/* 图片放大查看器 */
.script-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.script-image-viewer[hidden] { display: none !important; }

/* 卡片编辑弹窗（浮在剧本详情弹窗之上） */
.script-edit-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--mask);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}
.script-edit-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.script-edit-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.script-edit-modal-title { display: flex; align-items: baseline; gap: 10px; }
.script-edit-modal-title strong { font-size: 16px; color: var(--text); }
.script-edit-modal-title span { font-size: 13px; color: var(--text-3); }
.script-edit-modal-close {
  width: 32px; height: 32px;
  border: none; background: none;
  color: var(--text-3); cursor: pointer;
  border-radius: var(--radius);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.script-edit-modal-close:hover { background: var(--surface-muted); color: var(--text); }
.script-edit-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.script-edit-row { margin-bottom: 14px; }
.script-edit-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.script-edit-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.6;
}
.script-edit-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
}
.script-ai-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.script-ai-run-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.script-ai-run {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.script-ai-run:hover { opacity: 0.9; }
.script-ai-run:disabled { opacity: 0.5; cursor: wait; }
.script-ai-hint { font-size: 12px; color: var(--text-3); }
.script-edit-modal-foot {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.script-edit-save {
  padding: 8px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.script-edit-save:hover { opacity: 0.9; }
.script-edit-ai {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
}
.script-edit-ai:hover { background: var(--surface-muted); }

/* ===== 视频面板 v2（终极版布局：状态点+大标题 / 参考图堆叠 / 提示词折叠 / 按钮权重） ===== */
.script-videos-loading { padding: 40px; text-align: center; color: var(--text-3); font-size: 14px; }
.script-videos-grid {
  display: grid;
  grid-template-columns: 1fr; /* 横版卡片一张一行铺满 */
  gap: 18px;
  padding: 8px 0 24px;
}
/* v2 卡片：呼吸感与分区 */
.script-video-card.v2 {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}
/* 1. 头部：状态点 + 大标题右侧 / 灰色元数据第二行 */
.script-video-card.v2 .v2-header {
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}
.script-video-card.v2 .v2-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.script-video-card.v2 .v2-shot-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: 0.2px;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  white-space: nowrap;
}
.v2-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.v2-status-pill.success,
.v2-status-pill.done,
.v2-status-pill.finished { background: rgba(34,197,94,0.12); color: #16a34a; }
.v2-status-pill.success .v2-status-dot,
.v2-status-pill.done .v2-status-dot,
.v2-status-pill.finished .v2-status-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(34,197,94,0.18); }
.v2-status-pill.running,
.v2-status-pill.pending,
.v2-status-pill.processing,
.v2-status-pill.queued { background: rgba(245,158,11,0.12); color: #d97706; }
.v2-status-pill.running .v2-status-dot,
.v2-status-pill.pending .v2-status-dot,
.v2-status-pill.processing .v2-status-dot,
.v2-status-pill.queued .v2-status-dot { background: #d97706; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); animation: v2-status-pulse 1.2s ease-in-out infinite; }
@keyframes v2-status-pulse { 0%,100%{opacity:1;} 50%{opacity:0.45;} }
.v2-status-pill.failed,
.v2-status-pill.error { background: rgba(239,68,68,0.12); color: #dc2626; }
.v2-status-pill.failed .v2-status-dot,
.v2-status-pill.error .v2-status-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.v2-status-pill.canceled,
.v2-status-pill.cancelled { background: var(--surface-muted); color: var(--text-3); }
.v2-status-pill.canceled .v2-status-dot,
.v2-status-pill.cancelled .v2-status-dot { background: var(--text-3); box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }
.v2-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.v2-meta-dot { opacity: 0.5; }

/* 2. 参考图：横向堆叠（Show 3 张小图，第4张显示"+N"） */
.v2-ref-section { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.v2-ref-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.v2-ref-stack { display: flex; gap: 0; position: relative; }
.v2-ref-item {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: relative;
  margin-left: -12px; /* 堆叠偏移 */
  transition: transform 0.2s;
}
.v2-ref-stack .v2-ref-item:first-child { margin-left: 0; z-index: 3; }
.v2-ref-stack .v2-ref-item:nth-child(2) { z-index: 2; }
.v2-ref-stack .v2-ref-item:nth-child(3) { z-index: 1; }
.v2-ref-stack .v2-ref-item:nth-child(4) { z-index: 0; }
.v2-ref-stack .v2-ref-item:hover { transform: translateY(-3px) scale(1.05); z-index: 10; }
.v2-ref-more {
  background: linear-gradient(135deg, var(--surface-muted), rgba(0,0,0,0.06));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  gap: 1px;
}
.v2-ref-more span { font-weight: 700; color: var(--text); }
.v2-ref-count { font-size: 12px; color: var(--text-3); font-weight: 500; flex-shrink: 0; }

/* 3. 提示词：左侧竖线 + 浅灰底 + 折叠/展开（淡雅版） */
.v2-prompt-section { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.v2-prompt-block {
  position: relative;
  padding: 12px 14px;
  background: var(--surface-muted);
  border-radius: var(--radius);
  border-left: 3px solid var(--brand);
}
.v2-prompt-block.no-prompt { opacity: 0.7; }
.v2-prompt-block.no-collapse { padding-bottom: 12px; }
.v2-prompt-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  word-break: break-all;
}
.v2-prompt-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 淡雅版：折叠按钮更低调，无背景，文字轻 */
.v2-prompt-toggle {
  margin-top: 10px;
  background: none;
  border: none;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s;
  border-radius: 4px;
}
.v2-prompt-toggle:hover { color: var(--brand); background: transparent; }
.v2-prompt-toggle .v2-prompt-arrow {
  opacity: 0.65;
  transition: transform 0.2s, opacity 0.15s;
}
.v2-prompt-toggle:hover .v2-prompt-arrow { opacity: 1; }
.v2-prompt-toggle.expanded .v2-prompt-arrow {
  transform: rotate(180deg);
}

/* 4. 播放器区 */
.v2-player-section { padding: 14px 20px; }
.script-video-player {
  width: 100%;
  display: block;
  max-height: 240px;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius);
}
.script-video-placeholder.v2 {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
  background: var(--surface-muted);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

/* 5. 操作区：左下删除灰色图标 + 右下品牌色实心下载按钮 */
.v2-action-row {
  padding: 12px 20px 18px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.v2-del-icon {
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  opacity: 0.55;
}
.v2-del-icon:hover {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  opacity: 1;
}
.script-video-card.v2 .script-gen-img-btn.primary {
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  padding: 8px 20px;
}
.v2-action-placeholder { flex: 1; }

/* ===== 视频面板 v3（横版卡片：左信息/右视频） ===== */
/* 横版布局：左侧（镜头号+提示词+参考图+操作），右侧（视频播放区） */
.script-video-card.v3 {
  display: flex !important;
  flex-direction: row !important;
  gap: 16px;
  padding: 18px !important;
  min-height: 220px;
}

/* ===== v3.landscape 视频卡片：左视频缩略图 + 右文字/操作（紧凑横屏列表风格） ===== */
.script-video-card.v3.landscape {
  /* 左右互换：结构里 v3-right 是视频区放在前，v3-left 是文字区放在后 */
  flex-direction: row;
  align-items: stretch;
  padding: 0 !important;
  overflow: hidden;
  gap: 0;
  min-height: 180px;
}
.script-video-card.v3.landscape > .v3-right {
  flex: 0 0 300px;
  width: 300px;
  min-width: 300px;
  margin: 0;
  padding: 0;
  background: #000;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;   /* 视频在上、提示文字在下，避免视频被提示文字横向挤压 */
  align-items: stretch;
  overflow: hidden;
}
.script-video-card.v3.landscape > .v3-right .script-video-img,
.script-video-card.v3.landscape > .v3-right .script-video-placeholder.v3 {
  border-radius: 0 !important;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0 !important;
  background: #000;
}
/* 视频容器默认 16:9 兜底（元数据未加载时防塌陷；JS 加载后按真实比例覆盖高度） */
.script-video-card.v3.landscape > .v3-right .script-video-img {
  aspect-ratio: 16 / 9;
}
/* 待生成占位：按 16:9 固定比例，避免卡片塌陷 */
.script-video-card.v3.landscape > .v3-right .script-video-placeholder.v3 {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 视频播放器：填满容器并按真实比例显示（高度由 JS 按视频宽高比动态设置） */
.script-video-card.v3.landscape > .v3-right .script-video-player {
  border-radius: 0 !important;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0 !important;
  display: block;
  object-fit: contain;
  background: #000;
}
.script-video-card.v3.landscape > .v3-left {
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* landscape 下头部更紧凑 */
.script-video-card.v3.landscape .v3-header { gap: 4px; }
.script-video-card.v3.landscape .v3-shot-title { font-size: 15px; margin: 0; }
.script-video-card.v3.landscape .v3-prompt-section .v3-prompt-text {
  font-size: 12.5px;
  line-height: 1.6;
  padding: 8px 12px;
}
.script-video-card.v3.landscape .v3-action-row {
  padding: 8px 0 2px;
  border: none;
  background: transparent;
  margin-top: auto;
}

@media (max-width: 820px) {
  .script-video-card.v3.landscape {
    flex-direction: column;
    min-height: 0;
  }
  .script-video-card.v3.landscape > .v3-right {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .script-video-card.v3.landscape > .v3-right .script-video-player {
    max-height: 220px;
  }
  .script-video-card.v3.landscape > .v3-left {
    padding: 14px 18px 16px;
  }
}
.v3-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.v3-right {
  flex: 0 0 360px;
  width: 360px;
  display: flex;
  align-items: stretch;
}

/* 1. 头部：镜头号标题 + 状态胶囊 + 元数据 */
.v3-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.v3-header-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.v3-shot-title {
  font-size: 16.5px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.2px;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v3-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  white-space: nowrap;
}
.v3-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.v3-status-pill.success,
.v3-status-pill.done,
.v3-status-pill.finished { background: rgba(34,197,94,0.12); color: #16a34a; }
.v3-status-pill.success .v3-status-dot,
.v3-status-pill.done .v3-status-dot,
.v3-status-pill.finished .v3-status-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(34,197,94,0.18); }
.v3-status-pill.running,
.v3-status-pill.pending,
.v3-status-pill.processing,
.v3-status-pill.queued { background: rgba(245,158,11,0.12); color: #d97706; }
.v3-status-pill.running .v3-status-dot,
.v3-status-pill.pending .v3-status-dot,
.v3-status-pill.processing .v3-status-dot,
.v3-status-pill.queued .v3-status-dot { background: #d97706; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); animation: v3-status-pulse 1.2s ease-in-out infinite; }
@keyframes v3-status-pulse { 0%,100%{opacity:1;} 50%{opacity:0.45;} }
.v3-status-pill.failed,
.v3-status-pill.error { background: rgba(239,68,68,0.12); color: #dc2626; }
.v3-status-pill.failed .v3-status-dot,
.v3-status-pill.error .v3-status-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.v3-status-pill.canceled,
.v3-status-pill.cancelled { background: var(--surface-muted); color: var(--text-3); }
.v3-status-pill.canceled .v3-status-dot,
.v3-status-pill.cancelled .v3-status-dot { background: var(--text-3); box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }
.v3-header-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
}
.v3-meta-dot { opacity: 0.5; }

/* 2. 提示词：直接全显示（不折叠），左侧品牌色竖线 + 浅灰底 */
.v3-prompt-block {
  position: relative;
  padding: 11px 13px;
  background: var(--surface-muted);
  border-radius: var(--radius);
  border-left: 3px solid var(--brand);
}
.v3-prompt-block.no-prompt { opacity: 0.7; }
.v3-prompt-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
  font-weight: 600;
}
.v3-prompt-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  word-break: break-all;
}

/* 3. 参考图：横向堆叠（3 张，+N 遮罩） */
.v3-ref-section {
  display: flex;
  align-items: center;
}
.v3-ref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.v3-ref-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  white-space: nowrap;
}
.v3-ref-stack {
  display: flex;
  gap: 0;
  flex: 1;
  min-width: 0;
}
.v3-ref-item {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-left: -10px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.v3-ref-stack .v3-ref-item:first-child { margin-left: 0; z-index: 3; }
.v3-ref-stack .v3-ref-item:nth-child(2) { z-index: 2; }
.v3-ref-stack .v3-ref-item:nth-child(3) { z-index: 1; }
.v3-ref-stack .v3-ref-item:nth-child(4) { z-index: 0; }
.v3-ref-stack .v3-ref-item:hover { transform: translateY(-3px) scale(1.06); z-index: 10; }
.v3-ref-more {
  background: linear-gradient(135deg, var(--surface-muted), rgba(0,0,0,0.06));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  gap: 1px;
}
.v3-ref-more span { font-weight: 700; color: var(--text); }

/* 4. 操作区：左下垃圾桶灰图标 + 右下品牌色实心下载按钮 */
.v3-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: nowrap;
  min-width: 0;
}
.v3-del-icon {
  background: none !important;
  border: none !important;
  padding: 6px !important;
  border-radius: var(--radius-sm);
  color: var(--text-3) !important;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  opacity: 0.55;
  background-image: none !important;
  flex-shrink: 0;
}
.v3-del-icon:hover {
  background: rgba(239,68,68,0.1) !important;
  color: var(--danger) !important;
  opacity: 1;
}
/* 右侧操作按钮组：垃圾桶左侧、按钮组右侧紧贴 */
.v3-action-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
}
/* 所有 v3 卡片按钮统一高度与尺寸 */
.script-video-card.v3 .script-gen-img-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  font-weight: 600;
  padding: 8px 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.script-video-card.v3 .script-gen-img-btn.primary {
  border: 1px solid transparent;
}
/* v3 重新生成按钮（次按钮风格） */
.script-video-card.v3 .script-gen-img-btn.secondary.script-video-regen {
  border: 1px solid var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}
.script-video-card.v3 .script-gen-img-btn.secondary.script-video-regen:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

/* 5. 右栏：视频播放区 */
.v3-right .script-video-img {
  width: 100%;
  height: 100%;
  margin: 0 !important;
}
.v3-right .script-video-player {
  width: 100%;
  height: 100%;
  min-height: 200px;
  max-height: 280px;
  display: block;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius);
}
.script-video-placeholder.v3 {
  width: 100%;
  height: 100%;
  min-height: 200px;
  max-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
  background: var(--surface-muted);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

/* ===== 视频卡片生成进度条（生成中/重新生成中/排队中） ===== */
/* 首次生成：占位区内的进度块 */
.script-video-placeholder.v3.v3-gen-box {
  flex-direction: column;
  gap: 12px;
  border-style: solid;
}
.v3-gen-overlay-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.5px;
}
.v3-gen-overlay-time {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.v3-progress {
  width: 78%;
  max-width: 320px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.v3-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #6EC8FF);
  transition: width 0.6s ease;
}
/* 重新生成中：旧视频上的半透明进度覆盖层 */
.script-video-img.v3-regen-waiting {
  position: relative;
}
.script-video-img.v3-regen-waiting .script-video-player {
  opacity: 0.55;
}
.v3-gen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius);
  background: rgba(12, 14, 28, 0.42);
  backdrop-filter: blur(1px);
}
.v3-gen-overlay .v3-gen-overlay-title { color: #fff; }
.v3-gen-overlay .v3-gen-overlay-time { color: rgba(255, 255, 255, 0.75); }
.v3-gen-overlay .v3-progress { background: rgba(255, 255, 255, 0.25); }

/* v3 视频卡片：提示词 / 参考图可编辑交互 */
.v3-prompt-editable {
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s, box-shadow 0.15s;
}
.v3-prompt-editable:hover {
  background: var(--surface-muted);
  box-shadow: inset 3px 0 0 var(--brand);
}
.v3-prompt-empty {
  color: var(--text-3);
  font-style: italic;
  padding: 6px 10px;
}
.v3-ref-editable {
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.v3-ref-editable:hover { background: var(--surface-muted); }
.v3-ref-add-hint {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  font-size: 12px;
}
.v3-ref-add-hint span { pointer-events: none; }

/* v3 视频提示词编辑弹窗 */
.vp-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.vp-modal {
  width: 640px;
  max-width: 100%;
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* 左右横版弹窗：左提示词 + 右参考图分类 */
.vp-modal-split { width: 1080px; }
.vp-modal-split .vp-modal-body {
  flex-direction: row;
  gap: 24px;
  padding: 20px 24px;
}
.vp-modal-split .vp-left-col {
  flex: 1 1 54%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.vp-modal-split .vp-right-col {
  flex: 1 1 46%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid var(--border);
  padding-left: 24px;
}
.vp-ref-cats {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.vp-ref-cat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vp-ref-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.vp-ref-cat-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding-left: 8px;
  border-left: 3px solid var(--brand);
  line-height: 1.3;
}
.vp-ref-cat-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.vp-ref-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.vp-ref-upload-btn, .vp-ref-lib-btn {
  padding: 6px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.vp-ref-upload-btn:hover, .vp-ref-lib-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
@media (max-width: 860px) {
  .vp-modal-split .vp-modal-body { flex-direction: column; }
  .vp-modal-split .vp-right-col { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; }
}
.vp-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.vp-modal-title { display: flex; align-items: baseline; gap: 10px; }
.vp-modal-title strong { font-size: 16px; color: var(--text); }
.vp-modal-title span { font-size: 13px; color: var(--text-3); }
.vp-modal-close {
  width: 32px; height: 32px;
  border: none; background: none;
  color: var(--text-3); cursor: pointer;
  border-radius: var(--radius);
  font-size: 16px;
}
.vp-modal-close:hover { background: var(--surface-muted); color: var(--text); }
.vp-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.vp-row { display: flex; flex-direction: column; gap: 8px; }
.vp-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.vp-prompt-input, .vp-ai-thoughts {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  font-family: inherit;
}
.vp-prompt-input:focus, .vp-ai-thoughts:focus, .vp-ref-url:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
.vp-ai-panel {
  background: var(--surface-muted);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vp-ai-run-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.vp-ai-run {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.vp-ai-run:hover { opacity: 0.9; }
.vp-ai-run:disabled { opacity: 0.5; cursor: wait; }
.vp-ai-hint { font-size: 12px; color: var(--text-3); }
.vp-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 64px;
  align-items: flex-start;
}
.vp-refs-empty { color: var(--text-3); font-size: 13px; font-style: italic; }
.vp-ref-item {
  position: relative;
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  flex-shrink: 0;
  transition: border-color 0.15s, transform 0.1s;
}
.vp-ref-item:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}
.vp-ref-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 删除按钮：默认隐藏，鼠标悬停图片时显示（半透明白底 + 居中 ✕） */
.vp-ref-del {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.vp-ref-item:hover .vp-ref-del,
.vp-ref-del:focus-visible {
  opacity: 1;
  transform: scale(1);
}
.vp-ref-del:hover {
  background: rgba(220, 38, 38, 0.92);
  box-shadow: 0 1px 6px rgba(220, 38, 38, 0.45);
}
.vp-ref-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.vp-ref-url {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
}
.vp-ref-add-btn, .vp-ref-upload-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.vp-ref-add-btn:hover, .vp-ref-upload-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.vp-modal-foot {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.vp-save {
  padding: 9px 26px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vp-save:hover { opacity: 0.9; }
.vp-cancel.secondary {
  padding: 9px 20px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vp-cancel.secondary:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* v3 素材库选择器（从素材库添加参考图） */
.vp-asset-picker-mask {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.vp-asset-picker {
  width: 860px;
  max-width: 100%;
  max-height: 86vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vp-asset-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.vp-asset-picker-title { display: flex; align-items: baseline; gap: 10px; }
.vp-asset-picker-title strong { font-size: 16px; color: var(--text); }
.vp-asset-picker-title span { font-size: 13px; color: var(--text-3); }
/* 素材库选择器：剧本/个人 滑块（置于标题与关闭按钮之间） */
.vp-asset-mode-switch { margin-left: 0 !important; }
.vp-asset-empty {
  grid-column: 1 / -1;
  padding: 48px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.vp-asset-picker-close {
  width: 32px; height: 32px;
  border: none; background: none;
  color: var(--text-3); cursor: pointer;
  border-radius: var(--radius);
  font-size: 16px;
}
.vp-asset-picker-close:hover { background: var(--surface-muted); color: var(--text); }
.vp-asset-picker-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.vp-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
}
.vp-asset-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-muted);
  transition: border-color 0.15s, transform 0.1s;
}
.vp-asset-card:hover { border-color: var(--text-3); }
.vp-asset-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
.vp-asset-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface-muted);
  overflow: hidden;
}
.vp-asset-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.vp-asset-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.vp-asset-card.selected .vp-asset-check {
  opacity: 1;
  background: var(--brand);
}
.vp-asset-card-name {
  padding: 6px 8px 2px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vp-asset-card-tag {
  display: inline-block;
  margin: 0 8px 8px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface-muted);
  border-radius: 10px;
}
.vp-asset-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
}
.vp-asset-picker-count { font-size: 13px; color: var(--text-2); }
.vp-asset-picker-actions { display: flex; gap: 10px; }
.vp-asset-picker-cancel.secondary {
  padding: 9px 20px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vp-asset-picker-cancel.secondary:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.vp-asset-picker-ok {
  padding: 9px 22px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vp-asset-picker-ok:hover { opacity: 0.9; }
.vp-asset-picker-ok:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 深色模式适配 v3 */
html[data-theme="dark"] .v3-status-pill.success,
html[data-theme="dark"] .v3-status-pill.done,
html[data-theme="dark"] .v3-status-pill.finished { color: #4ade80; }
html[data-theme="dark"] .v3-status-pill.success .v3-status-dot,
html[data-theme="dark"] .v3-status-pill.done .v3-status-dot,
html[data-theme="dark"] .v3-status-pill.finished .v3-status-dot { background: #4ade80; }
html[data-theme="dark"] .v3-status-pill.running,
html[data-theme="dark"] .v3-status-pill.pending,
html[data-theme="dark"] .v3-status-pill.processing,
html[data-theme="dark"] .v3-status-pill.queued { color: #fbbf24; }
html[data-theme="dark"] .v3-status-pill.running .v3-status-dot,
html[data-theme="dark"] .v3-status-pill.pending .v3-status-dot,
html[data-theme="dark"] .v3-status-pill.processing .v3-status-dot,
html[data-theme="dark"] .v3-status-pill.queued .v3-status-dot { background: #fbbf24; }
html[data-theme="dark"] .v3-status-pill.failed,
html[data-theme="dark"] .v3-status-pill.error { color: #f87171; }
html[data-theme="dark"] .v3-status-pill.failed .v3-status-dot,
html[data-theme="dark"] .v3-status-pill.error .v3-status-dot { background: #f87171; }
html[data-theme="dark"] .v3-ref-item { border-color: var(--surface); }
html[data-theme="dark"] .v3-prompt-block { border-left-color: var(--brand); }

/* 响应式：窄屏（<900px）上下堆叠 */
@media (max-width: 900px) {
  .script-video-card.v3 {
    flex-direction: column !important;
  }
  .v3-right {
    flex: 1 1 auto;
    width: 100%;
  }
  .v3-right .script-video-player,
  .script-video-placeholder.v3 {
    min-height: 180px;
    max-height: 320px;
  }
}

/* 深色模式适配 */
html[data-theme="dark"] .v2-status-pill.success,
html[data-theme="dark"] .v2-status-pill.done,
html[data-theme="dark"] .v2-status-pill.finished { color: #4ade80; }
html[data-theme="dark"] .v2-status-pill.success .v2-status-dot,
html[data-theme="dark"] .v2-status-pill.done .v2-status-dot,
html[data-theme="dark"] .v2-status-pill.finished .v2-status-dot { background: #4ade80; }
html[data-theme="dark"] .v2-status-pill.running,
html[data-theme="dark"] .v2-status-pill.pending,
html[data-theme="dark"] .v2-status-pill.processing,
html[data-theme="dark"] .v2-status-pill.queued { color: #fbbf24; }
html[data-theme="dark"] .v2-status-pill.running .v2-status-dot,
html[data-theme="dark"] .v2-status-pill.pending .v2-status-dot,
html[data-theme="dark"] .v2-status-pill.processing .v2-status-dot,
html[data-theme="dark"] .v2-status-pill.queued .v2-status-dot { background: #fbbf24; }
html[data-theme="dark"] .v2-status-pill.failed,
html[data-theme="dark"] .v2-status-pill.error { color: #f87171; }
html[data-theme="dark"] .v2-status-pill.failed .v2-status-dot,
html[data-theme="dark"] .v2-status-pill.error .v2-status-dot { background: #f87171; }
html[data-theme="dark"] .v2-ref-item { border-color: var(--surface); }
html[data-theme="dark"] .v2-prompt-block { border-left-color: var(--brand); }
.script-image-viewer img {
  display: block;
  max-width: 96vw;
  max-height: 96vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}
.script-image-viewer img.zoomed {
  max-width: none;
  max-height: none;
}
.script-image-viewer-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.script-image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 小屏自适应 */
@media (max-width: 640px) {
  .script-entity-main {
    grid-template-columns: 1fr;
  }
  .script-shotmap-card .script-entity-main {
    grid-template-columns: 1fr;
  }
  .script-shotmap-card .script-entity-img {
    min-height: 160px;
  }
  .script-entity-img-area {
    flex: 1 1 100%;
  }
  .script-entity-img {
    min-height: 160px;
  }
  .script-topic-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ---------- 镜头面板（左右布局） ---------- */
.script-shot-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
/* 旧左侧功能栏样式已废弃（布局改为顶部工具栏+底部浮窗），保留但不参与布局 */
.script-shot-toolbar {
  flex: 0 0 30%;
  min-width: 200px;
  max-width: 320px;
  align-self: stretch;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  box-sizing: border-box;
}
.script-shot-toolbar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.script-shot-toolbar-head strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.script-shot-toolbar-head span {
  font-size: 12px;
  color: var(--text-3);
}
.script-shot-tool-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3);
  margin: 0;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
/* 分组容器：带小标题，纵向排列 */
.script-shot-tool-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.script-shot-tool-group-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--text-3);
  padding-left: 2px;
}
/* 按钮分组改为 2 列网格，减少纵向占用，操作更紧凑 */
.script-shot-tool-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.script-shot-tool-action.wide {
  grid-column: 1 / -1;
}
.script-shot-tool-action {
  width: 100%;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  color: var(--text-2) !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
  text-align: left;
  transition: all 0.15s;
}
.script-shot-tool-action:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
  border-color: var(--text-3) !important;
}
.script-shot-tool-action.danger {
  background: var(--tag-rose-bg) !important;
  color: var(--err) !important;
  border-color: var(--tag-rose-bg) !important;
}
.script-shot-tool-action.danger:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}
html[data-theme="dark"] .script-shot-tool-action.danger:hover {
  background: rgba(220, 38, 38, 0.2) !important;
}
.script-shot-tool-save {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.script-shot-savebinds-btn {
  width: 100%;
  border: none !important;
  background: var(--brand) !important;
  color: #fff !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
}
.script-shot-savebinds-btn:hover {
  opacity: 0.9;
}
/* 顶部镜头筛选滑块：未使用 / 已使用 */
.script-shot-topbar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.script-shot-filter-sep {
  color: var(--border-strong);
  margin: 0 2px;
}
.script-shot-filter-labeltext {
  font-size: 11px;
  color: var(--text-3);
}
/* 顶部镜头筛选开关：参考资产库「剧本/个人」切换开关 */
.script-shot-topbar .script-shot-filter-switch {
  user-select: none;
  cursor: pointer;
}
.script-shot-topbar .script-shot-filter-track {
  position: relative;
  display: flex;
  align-items: center;
  width: 150px;
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0;
}
.script-shot-topbar .script-shot-filter-opt {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  z-index: 2;
  cursor: pointer;
  transition: color 0.22s;
  padding: 0 12px;
  border: none;
  background: transparent;
  white-space: nowrap;
}
.script-shot-topbar .script-shot-filter-opt:hover {
  color: var(--text);
}
.script-shot-topbar .script-shot-filter-opt.active {
  color: #fff;
}
/* 滑块 thumb */
.script-shot-topbar .script-shot-filter-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  border-radius: 7px;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  z-index: 1;
}
.script-shot-topbar .script-shot-filter-switch.is-used .script-shot-filter-thumb {
  transform: translateX(100%);
}
.script-shot-topbar .script-shot-filter-switch:hover .script-shot-filter-thumb {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}
/* AI全自动按钮（主操作用主题色） */
.script-shot-ai-auto {
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.25) !important;
}
.script-shot-ai-auto:hover:not(:disabled) {
  box-shadow: 0 5px 16px rgba(99, 102, 241, 0.35) !important;
  opacity: 0.95;
}
/* 底部选中浮窗：选中镜头后出现 */
.script-shot-selection-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
/* display:flex 会覆盖 hidden 属性默认的 display:none，这里强制 hidden 时隐藏 */
.script-shot-selection-bar[hidden] {
  display: none !important;
}
.script-shot-sel-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 0;
}
.script-shot-sel-close:hover {
  color: var(--err);
  background: var(--tag-rose-bg);
  border-color: transparent;
}
.script-shot-sel-count {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-2);
}
.script-shot-sel-count b {
  color: var(--brand);
  font-size: 14px;
}
.script-shot-sel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}
.script-shot-sel-actions button {
  padding: 6px 12px !important;
  font-size: 11px !important;
  height: 30px !important;
}
/* 批量添加文本弹窗 */
.script-batchtext-mask {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.script-batchtext-dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.script-batchtext-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.script-batchtext-close-x:hover {
  color: var(--err);
  background: var(--tag-rose-bg);
  border-color: transparent;
}
.script-batchtext-head strong {
  font-size: 15px;
  color: var(--text);
}
.script-batchtext-head span {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.script-batchtext-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  resize: vertical;
}
.script-batchtext-input:focus {
  outline: none;
  border-color: var(--brand);
}
.script-batchtext-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.script-batchtext-actions button {
  padding: 8px 16px !important;
  font-size: 12px !important;
  height: 34px !important;
}
.script-batchtext-actions .script-batchtext-end {
  background: var(--brand) !important;
  color: #fff !important;
  border: none !important;
}

/* 右侧镜头卡片网格 */
.script-shot-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  align-content: start;
  grid-auto-rows: min-content;
  overflow-y: auto;
  padding-right: 4px;
  box-sizing: border-box;
}
/* 镜头卡片 */
.script-shot-card.shot-prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 0;
  align-self: start;
  box-sizing: border-box;
  transition: all 0.2s;
}
.script-shot-card.shot-prompt-card:hover {
  border-color: var(--text-3);
  box-shadow: var(--shadow-card);
}
.script-shot-card.shot-prompt-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}
.script-shot-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.script-shot-card-top .script-shot-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 已使用/未使用标签 */
.script-shot-used-tag {
  flex-shrink: 0;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-full) !important;
  padding: 2px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
}
.script-shot-used-tag.used {
  background: var(--tag-green-bg) !important;
  color: var(--tag-green-fg) !important;
  border-color: var(--tag-green-bg) !important;
}
.script-shot-used-tag.unused {
  background: var(--surface-muted) !important;
  color: var(--text-3) !important;
  border-color: var(--border) !important;
}
/* 镜头内容 */
.script-shot-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.script-shot-text .script-empty {
  min-height: 0;
  padding: 8px 0;
  color: var(--text-3);
}
/* 绑定参考图缩略图 */
.script-shot-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.script-shot-bind-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.script-shot-bind-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.script-shot-bind-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none !important;
  background: rgba(15, 23, 42, 0.55) !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  line-height: 1 !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.script-shot-bind-remove:hover {
  background: rgba(220, 38, 38, 0.85) !important;
}
/* 镜头卡片底部按钮组 */
.script-shot-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.script-shot-card-actions button {
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  color: var(--text-2) !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
  transition: all 0.15s;
}
.script-shot-card-actions button:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
  border-color: var(--text-3) !important;
}
.script-shot-card-actions .script-shot-save-btn {
  color: var(--ok) !important;
  border-color: var(--tag-green-bg) !important;
}
.script-shot-card-actions .script-shot-del-btn {
  color: var(--err) !important;
  border-color: var(--tag-rose-bg) !important;
  background: var(--tag-rose-bg) !important;
}
.script-shot-card-actions .script-shot-del-btn:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}
html[data-theme="dark"] .script-shot-card-actions .script-shot-del-btn:hover {
  background: rgba(220, 38, 38, 0.2) !important;
}

/* ---------- 站位图面板 ---------- */
.script-shotmap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.script-shotmap-toolbar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.script-shotmap-toolbar-info strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

/* ================================================================
   资产库·图片详情卡片弹窗（左大图 + 右侧工具栏）
   参考：剪映·云素材图片预览右侧信息面板
   ================================================================ */
.asset-img-detail-card {
  position: relative !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  max-width: 1180px !important;
  width: min(1180px, calc(100vw - 64px)) !important;
  max-height: calc(100vh - 56px) !important;
  height: min(760px, calc(100vh - 56px)) !important;
  padding: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}
.asset-img-detail-image-wrap {
  flex: 1 1 auto !important;
  flex-basis: 0 !important;
  min-width: 0 !important;
  width: auto !important;
  height: 100% !important;
  max-height: 100% !important;
  background: #FFFFFF !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 32px !important;
  box-sizing: border-box !important;
  overflow: hidden;
}
.asset-img-detail-image-wrap img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(29, 33, 41, 0.08);
  background: #FFFFFF;
  display: block !important;
}
.asset-img-detail-side {
  position: relative !important;
  width: 320px !important;
  max-width: 320px !important;
  flex: 0 0 320px !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 28px 24px 24px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
/* —— 关闭按钮：卡片右上角绝对定位（与剧本详情按钮一致）—— */
.asset-img-detail-close {
  position: absolute !important;
  top: 14px !important;
  right: 14px !important;
  left: auto !important;
  z-index: 10 !important;
  width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  background: var(--surface) !important;
  color: var(--text-2) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
  cursor: pointer !important;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s !important;
  font-size: 14px !important;
  line-height: 1 !important;
  padding: 0 !important;
}
.asset-img-detail-close:hover {
  background: var(--surface-muted) !important;
  color: var(--text) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}
.asset-img-detail-close:active { transform: scale(0.94); }

/* —— 信息面板（可滚动内容区）—— */
.asset-img-detail-panel {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 4px 0 0;
  scrollbar-width: thin;
}
.asset-img-detail-panel::-webkit-scrollbar { width: 4px; }
.asset-img-detail-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* meta-block：统一信息块（替代原来的 ul/li） */
.meta-block {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  gap: 8px;
}
.meta-block.row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.meta-divider {
  height: 1px;
  background: var(--border);
  opacity: 0.7;
  margin: 2px 0;
}

/* meta-title：标签名（小云雀风·轻灰小标签） */
.meta-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.3px;
  line-height: 1;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

/* meta-input：名字&备注——超轻量输入框（与整体简洁风统一） */
.meta-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.meta-input::placeholder { color: var(--text-3); opacity: 0.65; }
.meta-input:hover {
  background: color-mix(in srgb, var(--surface-muted) 92%, var(--text) 8%);
}
.meta-input:focus {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}
.meta-input.text-lg {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  padding: 12px 14px;
}
.meta-input.textarea {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
  min-height: 96px;
  max-height: 200px;
}
.meta-input[hidden] { display: none !important; }

/* —— 编辑行：文本展示 + 小铅笔按钮 —— */
.meta-edit-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}
.meta-text-lg {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  word-break: break-all;
  min-width: 0;
  padding: 2px 0;
}
.meta-text-note {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-2);
  word-break: break-all;
  min-width: 0;
  padding: 2px 0;
  white-space: pre-wrap;
}
.meta-text-note:empty::before {
  content: "无";
  color: var(--text-3);
  opacity: 0.6;
}
.meta-edit-btn {
  flex-shrink: 0;
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 6px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #1D2129 !important;
  opacity: 0.75;
  cursor: pointer;
  transition: opacity 0.18s;
  padding: 0 !important;
  margin: 0 0 0 auto !important;
}
.meta-edit-btn svg,
.meta-edit-btn .nav-ic {
  width: 13px !important;
  height: 13px !important;
  max-width: 13px !important;
  max-height: 13px !important;
  color: inherit !important;
  stroke: #1D2129 !important;
  stroke-width: 1.8 !important;
  fill: none !important;
  display: inline-block !important;
}
.meta-edit-btn:hover {
  background: transparent !important;
  color: #1D2129 !important;
  opacity: 1;
}
.meta-edit-btn:active { transform: scale(0.95); }

/* meta-chip：分类胶囊（中性灰为主，视觉统一不花哨） */
.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid var(--border);
}
.meta-chip + .meta-chip { margin-left: 6px; }
.meta-chip.brand {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 22%, transparent);
  font-weight: 700;
}
.meta-tags {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
.meta-text {
  font-size: 13.5px;
  color: var(--text-2);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

/* —— 按钮组：底部操作区 —— */
.asset-img-detail-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.asset-img-detail-actions .btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  height: 42px !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: transform 0.1s, opacity 0.15s, background 0.18s, border-color 0.18s, box-shadow 0.18s !important;
  border: 1px solid transparent !important;
  font-family: inherit !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
}
.asset-img-detail-actions .btn:active { transform: scale(0.985); }
.asset-img-detail-actions .btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.asset-img-detail-actions .btn.primary {
  background: var(--brand) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 22%, transparent);
}
.asset-img-detail-actions .btn.primary:hover {
  opacity: 0.92;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 28%, transparent);
}
html[data-theme="dark"] .asset-img-detail-actions .btn.primary {
  background: #000000 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .asset-img-detail-actions .btn.primary:hover {
  opacity: 0.88;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}
.asset-img-detail-actions .btn.ghost {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.asset-img-detail-actions .btn.ghost:hover {
  background: var(--sidebar-hover) !important;
  border-color: var(--border-strong) !important;
}
/* 收藏成功态：明确反馈，提升互动感 */
.asset-img-detail-actions .btn.fav-done {
  background: #16a34a !important;
  color: #fff !important;
  border-color: #16a34a !important;
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.3) !important;
}
.asset-img-detail-actions .btn.fav-done:hover {
  opacity: 0.92;
  background: #16a34a !important;
}
html[data-theme="dark"] .asset-img-detail-actions .btn.fav-done,
html[data-theme="dark"] .asset-img-detail-actions .btn.fav-done:hover {
  background: #16a34a !important;
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.4);
}
@media (max-width: 820px) {
  .asset-img-detail-card { flex-direction: column; height: auto; max-height: calc(100vh - 32px); }
  .asset-img-detail-side { width: 100%; border-left: none; border-top: 1px solid var(--border); }
}
.script-shotmap-toolbar-info span {
  font-size: 12px;
  color: var(--text-3);
}
.script-shotmap-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.script-shotmap-toolbar-actions button {
  padding: 7px 14px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  height: 34px !important;
}
.script-shotmap-genall {
  flex-shrink: 0;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.script-shotmap-genall:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
/* 进度条 */
.script-shotmap-progress {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.script-shotmap-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.script-shotmap-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--grad-btn);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}
.script-shotmap-progress em {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-style: normal;
  color: var(--text-2);
}
/* 提取中动画 */
.script-shotmap-extracting {
  padding: 12px;
}
.script-shotmap-extracting .script-shotmap-progress-bar span {
  animation: script-shotmap-extract-indeterminate 1.4s ease-in-out infinite;
}
@keyframes script-shotmap-extract-indeterminate {
  0% { width: 0; }
  50% { width: 100%; }
  100% { width: 0; }
}
/* 站位图标签 */
.script-shotmap-tag-generate {
  background: var(--brand) !important;
  color: #fff !important;
  border-color: transparent !important;
  padding: 3px 12px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
  border-radius: var(--radius-full) !important;
}
.script-shotmap-tag-skip {
  background: var(--text-3) !important;
  color: #fff !important;
  border-color: transparent !important;
  padding: 3px 12px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  min-height: auto !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.4 !important;
  border-radius: var(--radius-full) !important;
}
/* 站位图重新识别确认弹窗 */
.script-shotmap-clear-modal {
  width: 440px;
}

/* 小屏：镜头面板回单列 */
@media (max-width: 768px) {
  .script-shot-layout {
    flex-direction: column;
  }
  .script-shot-toolbar {
    flex: 0 0 auto;
    max-width: 100%;
  }
  .script-shot-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   全局统一「关闭按钮」样式（以剧本管理卡片 close 为基准）
   覆盖所有卡片/弹窗关闭按钮，保证视觉一致：浅灰底 + 边框 + hover 变红
   ========================================================================== */
.script-detail-close,
.script-detail-close-btn,
.script-topic-picker-close,
.script-plot-modal-close,
.script-edit-modal-close,
.vp-modal-close,
.vp-asset-picker-close,
.script-image-viewer-close,
.script-shot-sel-close,
.script-batchtext-close-x,
.asset-img-detail-close,
.settings-modal-close,
.web-login-close {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  border-radius: 8px !important;
  background: var(--surface-muted) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-2) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  line-height: 1 !important;
  padding: 0 !important;
  transition: all 0.15s !important;
  flex-shrink: 0 !important;
}
.script-detail-close:hover,
.script-detail-close-btn:hover,
.script-topic-picker-close:hover,
.script-plot-modal-close:hover,
.script-edit-modal-close:hover,
.vp-modal-close:hover,
.vp-asset-picker-close:hover,
.script-image-viewer-close:hover,
.script-shot-sel-close:hover,
.script-batchtext-close-x:hover,
.asset-img-detail-close:hover,
.settings-modal-close:hover,
.web-login-close:hover {
  color: var(--err) !important;
  background: var(--tag-rose-bg) !important;
  border-color: transparent !important;
}
.script-detail-close:active,
.script-detail-close-btn:active,
.script-topic-picker-close:active,
.script-plot-modal-close:active,
.script-edit-modal-close:active,
.vp-modal-close:active,
.vp-asset-picker-close:active,
.script-image-viewer-close:active,
.script-shot-sel-close:active,
.script-batchtext-close-x:active,
.asset-img-detail-close:active,
.settings-modal-close:active,
.web-login-close:active {
  transform: scale(0.94);
}

/* ==========================================================================
   科技感「生成剧本」按钮
   ========================================================================== */
#scriptGenBtn {
  position: relative;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #6366F1, #8B5CF6, #06B6D4);
  background-size: 200% 200%;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4),
              0 0 60px rgba(6, 182, 212, 0.15),
              inset 0 1px 0 rgba(255,255,255,0.2);
  animation: scriptGenBtnGradient 3s ease infinite;
  text-shadow: 0 0 8px rgba(255,255,255,0.3);
}
#scriptGenBtn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  background: linear-gradient(135deg, #818CF8, #A78BFA, #22D3EE);
  background-size: 200% 200%;
  z-index: -1;
  animation: scriptGenBtnGradient 3s ease infinite;
  opacity: 0.6;
  filter: blur(4px);
}
#scriptGenBtn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  animation: scriptGenBtnShine 4s ease-in-out infinite;
  pointer-events: none;
}
#scriptGenBtn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.6),
              0 0 80px rgba(6, 182, 212, 0.25),
              inset 0 1px 0 rgba(255,255,255,0.3);
}
#scriptGenBtn:active {
  transform: translateY(0) scale(0.98);
}
#scriptGenBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
  transform: none;
  filter: grayscale(0.5);
}
@keyframes scriptGenBtnGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes scriptGenBtnShine {
  0% { transform: translate(-50%, -50%) rotate(0deg); opacity: 0; }
  50% { transform: translate(-50%, -50%) rotate(180deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(360deg); opacity: 0; }
}

/* ==========================================================================
   一键成片：侧栏子菜单 + 对话式首页
   ========================================================================== */
.nav-parent { position: relative; }
.nav-caret {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-3);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  margin: 0 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.nav-sub-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  margin-top: 2px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.nav-sub-btn:hover { background: var(--sidebar-hover); color: var(--text); }
.nav-sub-btn.nav-sub-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-sub-ic { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2; }

/* 对话式首页 */
.script-chat-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: 100%;
  min-height: 0;
  padding: 20px 24px 24px;
  gap: 18px;
  max-width: 820px;
  margin: 0 auto;
}
/* 聊天消息区：中间可滚动 */
.script-chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px;
}
.script-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}
.script-chat-bot {
  align-self: flex-start;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.script-chat-user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-top-right-radius: 4px;
}
/* 聊天区 Agnes 生图结果内联展示 */
.script-chat-bot .chat-gen-loading {
  color: var(--text-muted);
  font-size: 13px;
}
.script-chat-bot .chat-gen-img-wrap {
  margin-top: 10px;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  max-width: 320px;
}
.script-chat-bot .chat-gen-img {
  display: block;
  width: 100%;
  cursor: zoom-in;
}
.script-chat-bot .chat-gen-actions {
  margin-top: 8px;
}
.script-chat-bot .chat-gen-actions .chat-gen-download {
  display: inline-block;
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
}
.script-chat-bot .chat-gen-actions .chat-gen-download:hover {
  text-decoration: underline;
}
.script-chat-msg b { font-weight: 700; }
.script-chat-msg button:not(.chat-opt-nav):not(.chat-opt-add):not(.chat-opt-add-confirm):not(.chat-opt-next):not(.chat-opt-prev):not(.chat-home-btn):not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn) {
  margin-top: 12px;
  align-self: flex-start;
}
/* 预置选题列表（数字方块 + 内容，选中后方块变深色） */
/* 聊天面板黑白配色变量：浅色主题黑字白底 / 深色主题反色 */
:root { --chat-ink: #23272f; --chat-paper: #fff; }
html[data-theme="dark"] { --chat-ink: #e8eaf0; --chat-paper: #2a2e37; }
/* 深色模式：品牌色描边/文字提亮，保证在深色底上的对比度 */
html[data-theme="dark"] .chat-opt-nav,
html[data-theme="dark"] .chat-opt-add,
html[data-theme="dark"] .chat-opt-add-input,
html[data-theme="dark"] .chat-opt-prev,
html[data-theme="dark"] .chat-home-name,
html[data-theme="dark"] .chat-home-title { color: rgb(124, 130, 255); }
html[data-theme="dark"] .chat-opt-nav,
html[data-theme="dark"] .chat-opt-add,
html[data-theme="dark"] .chat-opt-add-input,
html[data-theme="dark"] .chat-opt-prev { border-color: rgb(124, 130, 255); }
html[data-theme="dark"] .chat-opt-selected { border-color: rgb(124, 130, 255); }
html[data-theme="dark"] .chat-opt-selected .chat-opt-num { background: rgb(124, 130, 255); border-color: rgb(124, 130, 255); }
.script-chat-msg-wide { max-width: min(680px, 96%); width: min(680px, 96%); }
.chat-opt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.chat-opt-q { font-weight: 700; }
.chat-opt-page { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.chat-opt-page-num { font-size: 12px; font-weight: 600; color: var(--text-3); }
.chat-opt-nav {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(91, 97, 240);
  border-radius: 6px;
  background: var(--chat-paper);
  color: rgb(91, 97, 240);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}
.chat-opt-nav:hover:not(:disabled) { background: rgb(91, 97, 240); color: #fff; }
.chat-opt-nav:disabled { opacity: 0.3; cursor: default; }
.chat-opt-list { display: flex; flex-direction: column; gap: 8px; }
.chat-opt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.chat-opt-row:hover {
  border-color: var(--brand);
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.14);
}
html[data-theme="dark"] .chat-opt-row:hover { box-shadow: 0 3px 12px rgba(124, 130, 255, 0.35); }
.chat-opt-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  transition: all 0.18s ease;
}
.chat-opt-selected { border-color: rgb(91, 97, 240); }
.chat-opt-selected .chat-opt-num {
  background: rgb(91, 97, 240);
  border-color: rgb(91, 97, 240);
  color: #fff;
}
.chat-opt-text { font-size: 14px; font-weight: 600; }
.chat-opt-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgb(91, 97, 240);
  border-radius: 999px;
  background: var(--chat-paper);
  color: rgb(91, 97, 240);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.18s ease, color 0.18s ease;
}
.chat-opt-add svg { width: 14px; height: 14px; }
.chat-opt-add:hover { background: rgb(91, 97, 240); color: #fff; }
.chat-opt-add:active { transform: translateY(1px); }
/* 添加选项 → 行内输入框（参考剪映交互） */
.chat-opt-add-row { display: flex; gap: 8px; width: 100%; }
.chat-opt-add-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgb(91, 97, 240);
  border-radius: 999px;
  background: var(--chat-paper);
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.chat-opt-add-input::placeholder { color: var(--text-3); }
.chat-opt-add-confirm {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: rgb(91, 97, 240);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.chat-opt-add-confirm:hover { opacity: 0.88; }
/* ===== 单面板向导：步骤回显标签 + 底部继续按钮 ===== */
.chat-wiz-intro { font-size: 14px; line-height: 1.65; margin-bottom: 10px; }
.chat-wiz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chat-wiz-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}
.chat-wiz-chip b { color: var(--text-3); font-weight: 600; }
.chat-wiz-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.chat-wiz-sel { font-size: 12px; color: var(--text-3); }
.chat-wiz-btns { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chat-opt-prev {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 20px;
  border: 1px solid rgb(91, 97, 240);
  border-radius: 999px;
  background: transparent;
  color: rgb(91, 97, 240);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.chat-opt-prev:hover:not(:disabled) { background: rgb(91, 97, 240); color: #fff; }
.chat-opt-prev:active:not(:disabled) { transform: translateY(1px); }
.chat-opt-prev:disabled { opacity: 0.35; cursor: default; }
.chat-opt-next {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: rgb(91, 97, 240);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.chat-opt-next:hover:not(:disabled) { background: rgb(108, 113, 247); }
.chat-opt-next:active:not(:disabled) { transform: translateY(1px); }
.chat-opt-next:disabled { opacity: 0.35; cursor: default; }
/* ===== 创建项目气泡：标题 + 加载日志 ===== */
.chat-gen-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}
.chat-gen-spinner {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: chatSpin 0.8s linear infinite;
}
@keyframes chatSpin { to { transform: rotate(360deg); } }
.chat-gen-log {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
  padding-left: 2px;
}
.chat-gen-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}
.chat-gen-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.chat-gen-item.err { color: #e5484d; }
.chat-gen-item.err .chat-gen-dot { background: #e5484d; }
/* AI 流式生成气泡：实时思考（折叠）+ 正文打字效果 */
.chat-stream-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 10px;
}
.chat-stream-think {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, rgba(127, 127, 127, 0.06));
  margin-bottom: 10px;
  overflow: hidden;
}
.chat-stream-think-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.chat-stream-think-head:hover { color: var(--brand); }
.chat-stream-think-body {
  display: none;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px 12px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-stream-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 16px;
}
.chat-stream-body::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--brand);
  animation: chatBlink 0.9s steps(1) infinite;
}
@keyframes chatBlink { 50% { opacity: 0; } }
html[data-theme="dark"] .chat-stream-think { background: rgba(255, 255, 255, 0.05); }
/* 视频号短剧技能确认：按钮行 */
.chat-confirm-row { margin-top: 10px; }
/* 短剧管理：生成完成后目标剧本卡片高亮闪烁 */
.script-history-card.flash { animation: cardFlash 2.2s ease; }
@keyframes cardFlash {
  0%, 55% { box-shadow: 0 0 0 3px var(--brand); }
  100% { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
}
.script-chat-hero { text-align: center; }
.script-chat-hero h2 { font-size: 26px; margin: 0 0 8px; }
.script-chat-sub { font-size: 13px; color: var(--text-3); margin: 0; }
/* ===== 首页入口层：三功能按钮 + 输入框，触发后进入聊天 ===== */
.script-chat-home {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 20px 8px;
  overflow-y: auto;
}
.chat-home-head { text-align: center; }
.chat-home-title { font-size: 24px; font-weight: 800; color: rgb(91, 97, 240); letter-spacing: 0.5px; }
.chat-home-sub { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.chat-home-btns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: 640px;
  max-width: 100%;
}
.chat-home-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 20px 12px 16px;
  border: 1px solid rgb(91, 97, 240);
  border-radius: 14px;
  background: var(--chat-paper);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.chat-home-btn:hover:not(:disabled) {
  background: rgba(128, 130, 145, 0.08);
  border-color: rgba(91, 97, 240, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgb(91, 97, 240);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}
.chat-home-btn:active:not(:disabled) { transform: translateY(0); }
html[data-theme="dark"] .chat-home-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.chat-home-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(91, 97, 240, 0.1);
  color: rgb(91, 97, 240);
  transition: background 0.16s ease, color 0.16s ease;
}
.chat-home-btn .nav-ic { width: 20px; height: 20px; }
.chat-home-btn:hover:not(:disabled) .chat-home-ic { background: rgba(91, 97, 240, 0.24); color: rgb(91, 97, 240); }
.chat-home-name { font-size: 14px; font-weight: 700; color: rgb(91, 97, 240); }
.chat-home-desc { font-size: 12px; opacity: 0.62; }
.chat-home-inputbox {
  width: 640px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.chat-home-inputbox textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}
.chat-home-inputbox textarea::placeholder { color: var(--text-3); }
.chat-home-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.chat-home-hint { font-size: 12px; color: var(--text-3); }
/* 豆包式生成模式切换按钮（图片生成 / 视频生成） */
.chat-mode-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chat-mode-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.chat-mode-btn .nav-ic { width: 14px; height: 14px; }
.chat-mode-btn:hover { border-color: rgb(91, 97, 240); color: rgb(91, 97, 240); }
.chat-mode-btn.active {
  background: rgb(91, 97, 240);
  border-color: rgb(91, 97, 240);
  color: #fff;
}
html[data-theme="dark"] .chat-mode-btn.active { background: rgb(124, 130, 255); border-color: rgb(124, 130, 255); }
/* 图片生成模式展开行：模型 / 比例 按钮式下拉（豆包式），紧跟图片生成按钮右侧 */
.chat-mode-bar { flex-wrap: nowrap; }
.chat-mode-options {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding: 0;
  border: none;
  background: transparent;
}
.chat-mode-options[hidden] { display: none !important; }
.cm-dd { position: relative; }
.cm-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgb(91, 97, 240);
  border-radius: 8px;
  background: rgb(91, 97, 240);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cm-dd-btn:hover { background: rgb(108, 113, 247); border-color: rgb(108, 113, 247); transform: none; box-shadow: none; }
html[data-theme="dark"] .cm-dd-btn { background: rgb(124, 130, 255); border-color: rgb(124, 130, 255); }
html[data-theme="dark"] .cm-dd-btn:hover { background: rgb(140, 146, 255); border-color: rgb(140, 146, 255); }
.cm-dd-name { color: rgba(255, 255, 255, 0.85); }
.cm-dd-val { font-weight: 600; }
.cm-dd-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #fff;
  margin-top: 2px;
}
.cm-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1300;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.cm-dd-menu[hidden] { display: none !important; }
.cm-dd-opt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cm-dd-opt:hover { background: rgba(91, 97, 240, 0.08); }
.cm-dd-opt.active { color: rgb(91, 97, 240); font-weight: 600; }
.cm-dd-desc { flex-shrink: 0; font-size: 11px; color: var(--text-3); font-weight: 400; }
html[data-theme="dark"] .cm-dd-opt.active { color: rgb(124, 130, 255); }
.chat-home-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  background: rgb(91, 97, 240);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.chat-home-send:hover:not(:disabled) { background: rgb(108, 113, 247); }
.chat-home-send:active:not(:disabled) { transform: translateY(1px); }
.chat-home-send:disabled { background: #e6e6eb; color: #b0b0bb; cursor: default; }
/* 进入聊天后隐藏首页层 / 首页状态下隐藏聊天层 */
.script-chat-home[hidden] { display: none !important; }
.script-chat-body[hidden] { display: none !important; }
.script-chat-inputbox[hidden] { display: none !important; }
.script-chat-inputbox {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.script-chat-inputbox textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}
.script-chat-inputbox textarea::placeholder { color: var(--text-3); }
.script-chat-inputbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.script-chat-hint { font-size: 12px; color: var(--text-3); }
.script-chat-inputbar button:not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn) {
  padding: 8px 22px;
  border: none;
  border-radius: var(--radius);
  background: rgb(91, 97, 240);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
}
.script-chat-inputbar button:not(.chat-home-send):not(.chat-mode-btn):not(.cm-ratio-btn):hover { background: rgb(108, 113, 247); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,0.3); }

@media (max-width: 640px) {
  .chat-home-btns { gap: 10px; }
  .chat-home-btn { padding: 14px 8px 12px; }
  .chat-home-desc { display: none; }
  .chat-home-title { font-size: 20px; }
}
