:root {
  color-scheme: dark;
  /* 动态视口高度：减少移动端地址栏导致的裁切/双滚动；旧浏览器回退 100vh */
  --app-vh: 100vh;
  --bg: #09090d;
  --panel: #17171a;
  --panel-2: #1d1d21;
  --panel-3: #24242a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f6f6f7;
  --muted: #9b9ba4;
  --soft: #6f707a;
  --accent: #6d5dfc;
  --accent-2: #8a4dff;
  --green: #54d17d;
  /** 左侧一级菜单宽度；略窄以让右侧主内容区更宽（原 88px） */
  --app-sidebar-width: 72px;
}

@supports (height: 100dvh) {
  :root {
    --app-vh: 100dvh;
  }
}

* {
  scrollbar-color: #3b3b43 transparent;
}

.hidden {
  display: none !important;
}

html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  max-width: 100%;
  background:
    radial-gradient(circle at 50% -10%, rgba(109, 93, 252, 0.2), transparent 34rem),
    linear-gradient(180deg, #0b0b10 0%, var(--bg) 42rem);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

/* ========== App shell ========== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-left: var(--app-sidebar-width);
  max-width: calc(100% - var(--app-sidebar-width));
  overflow-x: clip;
  background: rgba(9, 9, 13, 0.74);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.app-header-inner {
  min-width: 0;
}

.app-header-brand {
  flex: 1 1 auto;
}

.brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(135deg, #7c3cff, #2d8cff 52%, #21d6a0);
  box-shadow: 0 12px 38px rgba(109, 93, 252, 0.35);
}

.promo-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(90deg, #5e27ff, #8a4dff 56%, #6a35ff);
  box-shadow: 0 0 24px rgba(109, 93, 252, 0.45);
}

.api-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.api-toolbar input {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 10px;
}

.doc-link {
  color: #b8b3ff;
  font-size: 12px;
  white-space: nowrap;
}
.doc-link:hover { color: white; }

.header-text-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.app-shell {
  display: block;
  padding-left: var(--app-sidebar-width);
  min-height: calc(var(--app-vh) - 64px);
  box-sizing: border-box;
  max-width: 100%;
}

.app-main {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 42px clamp(22px, 3vw, 48px) 48px;
}

/* 图片/视频工作台双栏：行高取较高列，左侧与右侧资源库视觉等高 */
.app-main:not(.workspace-hidden) {
  align-items: stretch;
}

.app-main.workspace-hidden {
  grid-template-columns: minmax(0, min(980px, 100%));
  justify-content: center;
}

/*
 * Home · Seedance：创作区本身是 min(980px) 居中卡片，但若整段 app-main 也限 980px，下方模版灵感库会被迫同宽。
 * 使用 app-main--seedance-home（navigation 在切换 Tab / updateWorkspaceVisibility 时维护），不依赖 :has。
 */
.app-main.workspace-hidden.app-main--seedance-home {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

.app-main.workspace-hidden #workspace-side-slot {
  display: none;
}

.app-main.workspace-hidden .tab-panel {
  width: 100%;
}

.app-main > * {
  margin-top: 0 !important;
}

/* ========== 侧边栏 ========== */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--app-sidebar-width);
  height: var(--app-vh);
  max-height: var(--app-vh);
  padding: 14px 6px 18px;
  overflow-y: auto;
  background: #202025;
  border-right: 1px solid rgba(255, 255, 255, 0.075);
  box-shadow: inset -1px 0 rgba(0, 0, 0, 0.45);
}

.app-sidebar::before {
  content: "";
  display: block;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  margin: 2px auto 26px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, transparent 18%, #202025 18% 31%, transparent 31%),
    linear-gradient(135deg, #fff, #f2f2f5);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.menu-root {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-height: 70px;
  padding: 9px 4px 8px;
  border-radius: 14px;
  color: #adadb6;
  text-align: center;
  font-size: 11px;
  line-height: 1.15;
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

.menu-root-system {
  margin-top: auto;
}

.menu-root-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 7px;
  color: currentColor;
  font-size: 20px;
  line-height: 22px;
}

.menu-root:hover {
  color: white;
  background: rgba(255, 255, 255, 0.055);
  transform: translateY(-1px);
}

.menu-root.active {
  color: white;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.menu-root.active::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 18px;
  width: 3px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(109, 93, 252, 0.8);
}

.app-subnav {
  position: fixed;
  top: var(--subnav-top, 86px);
  left: var(--app-sidebar-width);
  z-index: 35;
  width: max-content;
  min-width: 190px;
  max-width: min(260px, calc(100vw - var(--app-sidebar-width) - 22px));
  height: auto;
  max-height: min(76vh, var(--subnav-max-height, 760px));
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(18, 18, 22, 0.96);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 18px 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transform-origin: 0 0;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0s linear 0.18s;
}

.app-subnav.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0s linear 0s;
}

.subnav-panel {
  display: none;
}

.subnav-panel.active {
  display: block;
  animation: fadeIn 0.16s ease-out;
}

.subnav-title {
  display: none;
}

.subnav-desc {
  display: none;
}

.nav-btn {
  position: relative;
  width: 100%;
  min-height: 40px;
  margin-bottom: 4px;
  padding: 10px 12px 10px 14px;
  border-radius: 12px;
  color: #adadb6;
  text-align: left;
  font-size: 13px;
  line-height: 1.25;
  transition: color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.nav-btn::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 3px;
  height: 0;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--accent);
  transition: height 0.15s;
}

.nav-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.055);
}

.nav-btn.active {
  color: white;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.075);
}

.nav-btn.active::before {
  height: 20px;
}

.app-subnav,
.app-sidebar,
.tab-panel,
textarea.form-input {
  scrollbar-gutter: stable;
}

/* ========== 通用内容 ========== */
.tab-panel {
  grid-column: 1;
  width: 100%;
  min-width: 0;
  /* Grid 子项默认 min-height:auto 会按内容撑满行高，导致 max-height + overflow 不生效、左侧表单被裁切 */
  min-height: 0;
  height: calc(var(--app-vh) - 112px);
  max-height: calc(var(--app-vh) - 112px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 2px 12px 32px 0;
  animation: fadeIn 0.2s ease-out;
}

/* 与 .workspace-side 高度一致；flex 让主表单卡片向下铺满 */
.app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) {
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) > .card {
  flex: 1 1 auto;
  min-height: 0;
}

/* 爆款复刻等：主区为 grid，其后的独立卡片随内容增高，不与上方 grid 对半分包剩余高度 */
.app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) > div.grid ~ .card {
  flex: 0 1 auto;
}

/* 两分栏卡片（例：视频分镜拼图、爆款复刻）：外层 grid 吃满剩余高度，大屏下单行等高 */
.app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) > div.grid:has(> .card) {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

@media (min-width: 1024px) {
  .app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) > div.grid:has(> .card) {
    grid-auto-rows: minmax(0, 1fr);
  }
}

/* ========== 图片/视频工作台：主提交贴底 + 全宽胶囊主按钮 ========== */
.app-main:not(.workspace-hidden) .tab-panel:not(.hidden) .card,
.app-main:not(.workspace-hidden) .tab-panel:not(.hidden) > div.grid > .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.app-main:not(.workspace-hidden) .tab-panel:not(.hidden) .card:has(> form.sub-panel) {
  overflow: hidden;
}

.app-main:not(.workspace-hidden)
  .tab-panel:not(.hidden)
  .card:not(:has(> form.sub-panel)):has(.ws-submit-btn) {
  flex: 1 1 auto;
  overflow-y: auto;
}

.app-main:not(.workspace-hidden)
  .tab-panel:not(.hidden)
  .card
  > form.sub-panel.active {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.app-main:not(.workspace-hidden)
  .tab-panel:not(.hidden)
  .card:not(:has(> form.sub-panel)):has(.ws-submit-btn)
  > *:not(.workspace-submit-shell) {
  flex-shrink: 0;
}

.app-main:not(.workspace-hidden)
  .tab-panel:not(.hidden)
  .workspace-submit-shell.workspace-submit-shell--row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.app-main:not(.workspace-hidden) .tab-panel:not(.hidden) .workspace-submit-shell {
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.app-main:not(.workspace-hidden) .tab-panel:not(.hidden) .workspace-submit-shell--row > .btn-secondary {
  flex: 0 1 auto;
}

.app-main:not(.workspace-hidden) .tab-panel:not(.hidden) .workspace-submit-shell--row > .ws-submit-btn {
  flex: 1 1 min(240px, 100%);
}

.btn-primary.ws-submit-btn {
  box-sizing: border-box;
  width: 100%;
  /* 与全局 .btn-primary 一致：紫渐变、12px 圆角、字号与内边距，仅在此处通栏拉满 */
  min-height: 40px;
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}

/* 首页 Seedance：向下展开的下拉不要被侧栏区域的 overflow 裁切 */
#tab-seedance-replace.tab-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
  max-height: none;
  height: auto;
  /* 与其它 tab 共用 fadeIn 时含 translateY，易被感知为「整块在动」；首页仅淡入即可 */
  animation: fadeInOpacity 0.2s ease-out;
}

/* 与下方模版区分开：表单块居中收窄，模版灵感库横穿整段 Tab 宽度（不因上方表单 max-content 被带窄） */
#tab-seedance-replace .seedance-agent {
  align-self: center;
  flex-shrink: 0;
}

.seedance-home-hero {
  margin: 0 auto clamp(16px, 2.5vw, 28px);
  padding: 0 clamp(8px, 2vw, 16px);
  max-width: min(920px, 100%);
  text-align: center;
  box-sizing: border-box;
}

.seedance-home-hero-title {
  margin: 0;
  font-size: clamp(24px, 3.6vw, 40px);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text);
}

/*
 * 双栏工作台布局下 .tab-panel 被放在 app-main 第 1 列（约 440px），Seedance + 下方模版区会整段缩在左侧，
 * 右侧只剩空白（资源栏实际在第 2 列）。首页显示 Seedance 时改为通栏，并把 workspace-side-slot 换行铺满，避免「新加载时整坨靠左」。
 * 勿再限定 :not(.workspace-hidden)：首页最终会带 workspace-hidden，通栏规则仍需在双栏切回首页时生效。
 */
.app-main:has(#tab-seedance-replace:not(.hidden)) > #tab-seedance-replace.tab-panel:not(.hidden) {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.app-main:has(#tab-seedance-replace:not(.hidden)) > #workspace-side-slot {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.app-main:has(#tab-seedance-replace:not(.hidden)) #tab-seedance-replace .seedance-agent {
  margin-left: auto;
  margin-right: auto;
}

/* ========== 首页 · 模版灵感库（居中版式 + 渐变网格衬底，对齐侧栏故事板教程） ========== */
#tab-seedance-replace .home-template-hub {
  align-self: stretch;
  flex: 0 1 auto;
  min-height: 0;
  margin-top: clamp(24px, 3.5vw, 40px);
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  /* 整区随 tab 通栏拉满；版心由内层 home-tpl-hub-inner 铺满（不再额外收窄到 1760px） */
  padding: clamp(14px, 2.2vw, 22px) clamp(4px, 0.9vw, 16px) clamp(24px, 3.5vw, 32px);
  border-radius: 12px;
  overflow: hidden;
  border: none;
  background:
    linear-gradient(185deg, rgba(12, 14, 20, 0.97) 0%, rgba(6, 7, 12, 0.98) 55%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 11px,
      rgba(72, 96, 200, 0.06) 11px,
      rgba(72, 96, 200, 0.06) 12px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 11px,
      rgba(72, 96, 200, 0.045) 11px,
      rgba(72, 96, 200, 0.045) 12px
    );
}

#tab-seedance-replace .home-template-hub .home-tpl-card-frame {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #2a2a2a;
}

#tab-seedance-replace .home-template-hub .home-tpl-card-cap {
  color: rgba(255, 255, 255, 0.86);
}

#tab-seedance-replace .home-template-hub .home-tpl-scope-item {
  color: rgba(255, 255, 255, 0.82);
}

.home-template-hub button,
.home-template-hub [role='button'],
.home-template-hub .home-tpl-pill {
  font-family: inherit;
}

.home-tpl-hub-inner {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  contain: layout;
}

.home-tpl-scope-strip {
  display: flex;
  justify-content: center;
  margin: 0 auto 10px;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.home-tpl-scope-track {
  display: inline-flex;
  flex-direction: row;
  gap: clamp(14px, 3vw, 28px);
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 6px max(12px, 2vw) 12px;
  justify-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 100, 110, 0.7) transparent;
}

.home-tpl-scope-track::-webkit-scrollbar {
  height: 6px;
}

.home-tpl-scope-track::-webkit-scrollbar-thumb {
  background: rgba(100, 100, 110, 0.55);
  border-radius: 999px;
}

.home-tpl-scope-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
  border: none;
  padding: 0;
  background: transparent;
  color: rgb(226 232 240);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  opacity: 0.86;
}

.home-tpl-scope-item:hover,
.home-tpl-scope-item:focus-visible {
  opacity: 1;
  outline: none;
}

.home-tpl-scope-item--active {
  opacity: 1;
}

.home-tpl-scope-disk {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--disk, linear-gradient(145deg, #6366f1, #a855f7));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 4px 16px rgba(0, 0, 0, 0.45);
  font-size: 10px;
  color: transparent;
}

.home-tpl-scope-item--active .home-tpl-scope-disk {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 2px #fafafa,
    0 6px 20px rgba(0, 0, 0, 0.5);
}

.home-tpl-scope-label {
  max-width: 76px;
  text-align: center;
  line-height: 1.2;
}

.home-tpl-pill-row {
  display: flex;
  justify-content: center;
  margin: 8px auto 10px;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.home-tpl-pill-track {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 4px max(8px, 1.2vw);
}

.home-tpl-pill {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(248, 250, 252, 0.92);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.home-tpl-pill:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.home-tpl-pill--active {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.95);
  color: #0f1014;
}

.home-tpl-pill-chevron {
  margin-left: 4px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  padding: 0 4px;
  user-select: none;
}

#home-template-hub-sections {
  display: flex;
  flex-direction: column;
  gap: clamp(26px, 4vw, 36px);
  margin-top: 12px;
  width: 100%;
  min-width: 0;
}

.home-tpl-section {
  width: 100%;
  min-width: 0;
}

/* 模版列表加载占位（骨架屏：栅格与缩略图比例与侧栏资源库一致） */
.home-tpl-skeleton {
  display: flex;
  flex-direction: column;
  gap: clamp(26px, 4vw, 36px);
  width: 100%;
  min-width: 0;
  pointer-events: none;
  user-select: none;
}

.home-template-hub--loading .home-tpl-skeleton {
  cursor: wait;
}

.home-tpl-skeleton-block {
  margin: 0;
  padding: 0;
}

.home-tpl-skel-title {
  height: 14px;
  width: min(140px, 40vw);
  margin: 0 0 12px 0;
  margin-inline: max(8px, 1.2vw);
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.14) 45%,
    rgba(255, 255, 255, 0.07) 90%
  );
  background-size: 200% 100%;
  animation: home-tpl-skel-shimmer 1.15s ease-in-out infinite;
}

.home-tpl-skel-rail {
  display: grid;
  gap: clamp(6px, 0.95vw, 11px);
  grid-template-columns: repeat(auto-fill, minmax(min(152px, 100%), 1fr));
  overflow: hidden;
  padding: 8px max(6px, 1vw) 14px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

@media (min-width: 1680px) {
  .home-tpl-skel-rail {
    grid-template-columns: repeat(auto-fill, minmax(min(176px, 100%), 1fr));
  }
}

.home-tpl-skel-card {
  width: 100%;
  min-width: 0;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    90deg,
    rgba(36, 38, 48, 0.95) 0%,
    rgba(48, 50, 62, 0.95) 50%,
    rgba(36, 38, 48, 0.95) 100%
  );
  background-size: 200% 100%;
  animation: home-tpl-skel-shimmer 1.15s ease-in-out infinite;
}

@keyframes home-tpl-skel-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-tpl-skel-title,
  .home-tpl-skel-card {
    animation: none;
    background: rgba(255, 255, 255, 0.08);
  }

  .home-tpl-card .home-tpl-card-frame {
    transition: none;
  }

  .home-tpl-card:hover .home-tpl-card-frame {
    transform: none;
  }
}

/* 与参考图一致：分区标题与下方卡片轨道左缘对齐（与 .home-tpl-rail 水平 padding 一致） */
.home-tpl-section-title {
  margin: 0 0 12px 0;
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  padding-inline: max(8px, 1.2vw);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
}

/*
 * 与右侧「资源库」媒资缩略图一致：.workspace-thumb 使用 aspect-ratio 2/3；列宽随容器自适应。
 */
.home-tpl-rail {
  display: grid;
  gap: clamp(6px, 0.95vw, 11px);
  grid-template-columns: repeat(auto-fill, minmax(min(152px, 100%), 1fr));
  padding: 8px max(6px, 1vw) 14px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

@media (min-width: 1680px) {
  .home-tpl-rail {
    grid-template-columns: repeat(auto-fill, minmax(min(176px, 100%), 1fr));
  }
}

.home-tpl-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .home-tpl-card .home-tpl-card-frame {
    transition:
      border-color 0.18s ease,
      box-shadow 0.18s ease,
      transform 0.18s ease;
  }

  .home-tpl-card:hover .home-tpl-card-frame {
    border-color: rgba(196, 210, 254, 0.38);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
    transform: translateY(-2px);
  }
}

.home-tpl-card:focus-visible {
  outline: 2px solid rgb(165 180 252);
  outline-offset: 3px;
  border-radius: 12px;
}

.home-tpl-card-frame {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(20, 20, 26, 0.9);
}

.home-tpl-card-cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.home-tpl-card-cover--stub {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  font-size: clamp(14px, 4.5vw, 18px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(148, 163, 184, 0.5);
}

.home-tpl-card-cap {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  color: rgb(241 245 249);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-template-hub .home-tpl-empty {
  margin: 20px auto 6px;
  max-width: 36rem;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.home-template-hub .home-tpl-empty--warn {
  color: rgba(251, 191, 36, 0.95);
}

.home-template-hub .home-tpl-filter-empty {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 36rem;
  color: rgba(255, 255, 255, 0.55);
}

.home-tpl-empty {
  margin: 12px 0 6px;
  font-size: 13px;
  color: rgb(148, 163, 184);
}

.home-tpl-empty--warn {
  color: rgb(251, 146, 60);
}

.home-tpl-filter-empty {
  margin: 14px 0 4px;
  font-size: 13px;
  color: rgb(148, 163, 184);
}

/* 首页模版详情弹窗 */
.home-tpl-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.home-tpl-detail-modal.hidden {
  display: none !important;
}

.home-tpl-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.home-tpl-detail-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, calc(100vh - 32px));
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #121214;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.home-tpl-detail-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.home-tpl-detail-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fafafa;
  line-height: 1.35;
  padding-right: 8px;
}

.home-tpl-detail-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.home-tpl-detail-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.home-tpl-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: grid;
  gap: 14px;
}

@media (min-width: 640px) {
  .home-tpl-detail-body {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
  }
}

.home-tpl-detail-media video,
.home-tpl-detail-media img {
  width: 100%;
  max-height: min(420px, 52vh);
  border-radius: 12px;
  display: block;
  object-fit: contain;
  background: #09090b;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.home-tpl-detail-meta {
  font-size: 13px;
  line-height: 1.55;
  color: rgb(203 213 225);
}

.home-tpl-detail-meta dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 12px;
}

.home-tpl-detail-meta dt {
  margin: 0;
  color: rgb(148, 163, 184);
  font-weight: 600;
}

.home-tpl-detail-meta dd {
  margin: 0;
  word-break: break-word;
}

.home-tpl-detail-desc {
  margin: 0 0 12px;
  color: rgb(226 232 240);
}

.home-tpl-detail-params-pre {
  margin: 10px 0 0;
  padding: 10px;
  max-height: 200px;
  overflow: auto;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 11px;
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.home-tpl-detail-loading {
  color: rgb(148, 163, 184);
  font-size: 13px;
}

.home-tpl-detail-error {
  color: rgb(251, 146, 60);
  font-size: 13px;
}

.home-tpl-detail-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(10, 10, 12, 0.6);
}

#workspace-side-slot {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
}

#workspace-side-slot > .workspace-side {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(calc(var(--app-vh) - 112px), 100%);
}

.workspace-side {
  grid-column: 2;
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(var(--app-vh) - 112px);
  max-height: calc(var(--app-vh) - 112px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 20, 23, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.workspace-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  min-height: 58px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.workspace-tab,
.workspace-filter,
.workspace-icon-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  color: #aaaab3;
  background: transparent;
  border: 1px solid transparent;
  font-size: 14px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.workspace-tab.active,
.workspace-filter.active {
  color: white;
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--line-strong);
}

.workspace-icon-btn {
  margin-left: auto;
  width: 36px;
  padding: 0;
  font-size: 18px;
}

.workspace-tab:hover,
.workspace-filter:hover,
.workspace-icon-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.workspace-panel {
  display: none;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.workspace-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.workspace-select {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  color: #d8d8de;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line-strong);
  font-size: 13px;
}

.workspace-select option {
  background: #1c1c22;
}

.workspace-meta {
  flex-shrink: 0;
  min-height: 32px;
  padding: 8px 16px;
  color: var(--soft);
  font-size: 12px;
}

.workspace-grid {
  flex: 1 1 0;
  min-height: 0;
  /* basis=0 才能小于内容高度，出现内部纵向滚动条；勿用 flex:1 1 auto 会按内容撑满 */
  /* 固定 4 列；仅本区域纵向滚动 */
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: min-content;
  align-content: start;
  align-items: start;
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: #3b3b43 transparent;
}

.workspace-grid::-webkit-scrollbar {
  width: 8px;
}

.workspace-grid::-webkit-scrollbar-thumb {
  background: #3b3b43;
  border-radius: 999px;
}

.workspace-grid::-webkit-scrollbar-track {
  background: transparent;
}

/* 无限滚动 / 加载更多：占满一行 */
.workspace-scroll-sentinel {
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
  visibility: hidden;
}

.workspace-load-more-bar {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.btn-workspace-load-more {
  min-height: 38px;
  padding: 0 22px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: #e8e8ee;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-workspace-load-more:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-workspace-load-more:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.workspace-card {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  align-self: start;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.workspace-thumb {
  width: 100%;
  box-sizing: border-box;
  /* 原 4:3 高度再 ×2 → 2:3 竖幅 */
  aspect-ratio: 2 / 3;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #101014;
}

/* 可点击缩略图：块级宽度 + 保持宽高比（避免在 grid/flex 内被压成细条） */
button.workspace-thumb-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  font: inherit;
  cursor: zoom-in;
  border-radius: 0;
  box-sizing: border-box;
  color: inherit;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

button.workspace-thumb-trigger:focus-visible {
  outline: 2px solid rgba(109, 93, 252, 0.85);
  outline-offset: -2px;
}

/* 媒资卡仅缩略图：整卡圆角与图片一致 */
.workspace-card--asset-only > .workspace-thumb-wrap button.workspace-thumb-trigger {
  border-radius: 12px;
}

/* 模版卡：悬停显示套用，点击封面打开详情弹窗 */
.workspace-template-cover-wrap {
  position: relative;
  width: 100%;
  border-radius: 11px 11px 0 0;
  overflow: hidden;
}

.workspace-template-cover-wrap > .workspace-thumb.template-cover {
  border-radius: 11px 11px 0 0;
}

.workspace-template-cover-hit {
  cursor: pointer;
  display: block;
  width: 100%;
}

.workspace-template-cover-hit:focus {
  outline: 2px solid rgba(167, 139, 250, 0.8);
  outline-offset: -2px;
}

.workspace-template-hover-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 8px 10px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.workspace-template-hover-actions button {
  flex: 1;
  max-width: 100%;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: rgba(124, 58, 237, 0.95);
  color: #f5f3ff;
}

.workspace-template-hover-actions button:hover {
  filter: brightness(1.08);
}

.workspace-template-cover-wrap:hover .workspace-template-hover-actions,
.workspace-template-cover-wrap:focus-within .workspace-template-hover-actions {
  opacity: 1;
  pointer-events: auto;
}

.workspace-template-desc {
  font-size: 13px;
  line-height: 1.45;
  color: #64748b;
  margin-top: 6px;
}

.workspace-template-params-details summary {
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}

.workspace-template-params-pre {
  margin-top: 8px;
  padding: 8px;
  font-size: 11px;
  line-height: 1.35;
  border-radius: 8px;
  background: #f1f5f9;
  overflow: auto;
  max-height: 160px;
}

/* 视频缩略图：框内 cover 铺满 */
.workspace-thumb-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* 图片：铺满框（cover） */
.workspace-thumb-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.workspace-thumb-placeholder {
  color: #7d7d86;
  font-size: 11px;
  padding: 6px;
  text-align: center;
}

/* 缩略图区：悬停显示复制 / 打开 */
.workspace-thumb-wrap {
  position: relative;
  width: 100%;
}

.workspace-thumb-hover-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: stretch;
  justify-content: center;
  padding: 8px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.2) 55%, transparent 100%);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.workspace-thumb-wrap:hover .workspace-thumb-hover-actions,
.workspace-thumb-wrap:focus-within .workspace-thumb-hover-actions {
  opacity: 1;
  pointer-events: auto;
}

.workspace-asset-action-btn {
  flex: 1;
  min-width: 52px;
  min-height: 28px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f0f0f4;
  background: rgba(20, 20, 26, 0.78);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.workspace-asset-action-btn:hover {
  background: rgba(109, 93, 252, 0.4);
  border-color: rgba(255, 255, 255, 0.22);
}

.workspace-asset-action-btn--danger:hover {
  background: rgba(185, 28, 28, 0.55);
  border-color: rgba(254, 202, 202, 0.35);
}

.workspace-asset-action-gap {
  flex: 1;
  min-height: 28px;
  pointer-events: none;
}

.workspace-card-body {
  padding: 6px 8px 8px;
}

.workspace-card-title {
  color: #f2f2f4;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.workspace-card-sub {
  margin-top: 3px;
  color: var(--soft);
  font-size: 10px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.workspace-card-actions button,
.workspace-card-actions a {
  flex: 1;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #d6d3ff;
  background: rgba(109, 93, 252, 0.16);
  font-size: 11px;
}

.workspace-card-action-danger {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #fca5a5 !important;
}
.workspace-card-action-danger:hover {
  background: rgba(239, 68, 68, 0.28) !important;
}

.workspace-prompts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-prompt-card {
  min-height: 152px;
}

.workspace-prompt-preview {
  margin-top: 7px;
  min-height: 58px;
  max-height: 84px;
  overflow: hidden;
  color: #d9d9df;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 10.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0.9;
}

.workspace-works-card .workspace-template-cover-wrap {
  width: 100%;
}

.workspace-works-running {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.75);
}

.workspace-works-spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.workspace-works-running-label {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.workspace-works-progress {
  width: 72%;
  max-width: 120px;
  height: 4px;
  margin-top: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.workspace-works-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.55));
  transition: width 0.45s ease;
}

.workspace-works-progress-pct {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.88;
  letter-spacing: 0.03em;
}

.workspace-works-failed {
  color: rgba(248, 113, 113, 0.9);
  font-size: 12px;
}

.workspace-works-card .workspace-thumb-wrap {
  border-radius: 12px;
  overflow: hidden;
}

.workspace-works-card .workspace-thumb-hover-actions {
  padding: 8px 10px;
}

.workspace-works-card .workspace-asset-action-btn {
  flex: 1;
  max-width: 100%;
}

.template-cover {
  background:
    linear-gradient(135deg, rgba(109, 93, 252, 0.9), rgba(33, 214, 160, 0.65)),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.25), transparent 38%);
}

/* ========== 任务详情弹窗（作品库 / 任务管理） ========== */
.task-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 12060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.task-detail-modal.hidden {
  display: none !important;
}

.task-detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
}

.task-detail-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-height: min(900px, calc(var(--app-vh, 100vh) - 32px));
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: #121214;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.task-detail-modal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.task-detail-modal-title {
  margin: 0;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.task-detail-modal-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #d8d8de;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.task-detail-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.task-detail-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.task-detail-modal .task-detail-result.result-card {
  margin-top: 0;
  background: linear-gradient(180deg, #1d1d21, #16161a);
  border-color: var(--line-strong);
  box-shadow: none;
}

/* ========== 工作台侧栏 · 媒资/模版详情弹窗 ========== */
.workspace-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.workspace-detail-modal[hidden] {
  display: none !important;
}

.workspace-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.workspace-detail-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(92vh, 880px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.workspace-detail-body {
  padding: 22px 22px 24px;
  padding-top: 52px;
}

.workspace-detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #e8e8ee;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.workspace-detail-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.workspace-detail-media-inner {
  border-radius: 12px;
  overflow: hidden;
  background: #0c0c10;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.workspace-detail-media-stack {
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.workspace-detail-full {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 720px);
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  vertical-align: middle;
}

video.workspace-detail-full {
  background: #000;
}

.workspace-detail-sample-label {
  padding: 8px 4px 0;
  font-size: 12px;
  color: var(--soft);
}

.workspace-detail-sample-vid {
  max-height: min(50vh, 480px);
}

.workspace-detail-audio {
  width: min(100%, 420px);
  padding: 16px;
}

.workspace-detail-placeholder,
.workspace-detail-loading,
.workspace-detail-error {
  padding: 32px 20px;
  text-align: center;
  color: var(--soft);
  font-size: 14px;
}

.workspace-detail-error {
  color: #ff8a8a;
}

.workspace-detail-file-hint {
  padding: 24px;
  text-align: center;
  font-size: 14px;
}

.workspace-detail-file-hint a {
  color: #b4b0ff;
}

.workspace-detail-title {
  margin: 4px 0 10px;
  font-size: 18px;
  font-weight: 650;
  color: #f2f2f4;
  line-height: 1.35;
}

.workspace-detail-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: #b6b6bf;
  line-height: 1.5;
  white-space: pre-wrap;
}

.workspace-detail-dl {
  margin: 0;
  font-size: 13px;
}

.workspace-detail-dl > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.workspace-detail-dl dt {
  margin: 0;
  color: var(--soft);
}

.workspace-detail-dl dd {
  margin: 0;
  color: #d6d6de;
  word-break: break-word;
}

.workspace-detail-params {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  overflow: auto;
  max-height: 200px;
}

.workspace-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn-workspace-detail-copy,
.btn-workspace-detail-open {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-workspace-detail-copy {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  color: #e8e8ee;
  cursor: pointer;
}

.btn-workspace-detail-open {
  border: 1px solid rgba(109, 93, 252, 0.4);
  background: rgba(109, 93, 252, 0.16);
  color: #d6d3ff;
  text-decoration: none;
}

.btn-workspace-detail-apply {
  min-height: 40px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  color: #0f0f12;
  background: linear-gradient(135deg, #a59cff, #6d5dfc);
}

/* ========== 故事板页（图片 · 二级菜单） ========== */
.storyboard-page {
  width: 100%;
  min-width: 0;
}

.storyboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  max-width: min(640px, 100%);
}

@media (max-width: 1100px) {
  .storyboard-layout {
    max-width: 100%;
  }
}

.storyboard-config.card {
  padding: 18px;
}

.storyboard-label-muted {
  color: var(--soft);
  font-size: 12px;
}

.storyboard-dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.22);
  margin-top: 6px;
  padding: 12px;
}

.storyboard-dropzone--has-file {
  border-style: solid;
  min-height: auto;
}

.storyboard-ref-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.storyboard-ref-hint {
  margin: 0;
  font-size: 11px;
  color: var(--soft);
  line-height: 1.45;
  max-width: 260px;
}

.storyboard-ref-preview-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.storyboard-ref-preview-img {
  max-height: 180px;
  max-width: 100%;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid var(--line-strong);
}

.storyboard-ref-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.storyboard-import-btn--small {
  padding: 6px 14px;
  font-size: 12px;
}

.storyboard-import-btn {
  padding: 8px 20px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.storyboard-import-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------- 视频 · 图生参考图导入区（正方形；边长约原 184px 的 ½ → 面积约 ¼） ---------- */
.video-i2v-drop-root {
  position: relative;
  width: 100%;
  max-width: min(92px, 60vw);
  outline: none;
  overflow: hidden;
  border-radius: 8px;
}

.video-i2v-drop-inner {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  background: rgb(42 43 46);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.video-i2v-drop-root:hover .video-i2v-drop-inner,
.video-i2v-drop-root:focus-within .video-i2v-drop-inner {
  border-color: rgba(226, 232, 240, 0.45);
}

.video-i2v-drop-root.video-i2v-drop-root--drag .video-i2v-drop-inner {
  border-style: dashed;
  border-color: rgba(129, 140, 248, 0.75);
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.25);
}

.video-i2v-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.video-i2v-import-core {
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgb(226 229 231);
  padding: 4px;
  transition: color 0.15s ease;
}

.video-i2v-import-core:hover {
  color: rgb(247 247 247);
}

.video-i2v-import-icon {
  display: flex;
  opacity: 0.92;
}

.video-i2v-import-icon svg {
  width: 14px;
  height: 14px;
}

.video-i2v-import-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.video-i2v-source-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.video-i2v-urls-store {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.video-i2v-thumb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
}

.video-i2v-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 0;
}

.video-i2v-thumb-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(0, 0, 0, 0.35);
}

.video-i2v-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-i2v-thumb-idx {
  position: absolute;
  left: 2px;
  top: 2px;
  font-size: 9px;
  font-weight: 650;
  color: #fafafa;
  background: rgba(0, 0, 0, 0.55);
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  pointer-events: none;
}

.video-i2v-thumb-remove {
  position: absolute;
  right: 1px;
  top: 1px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #f1f5f9;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-i2v-thumb-remove:hover {
  background: rgba(127, 29, 29, 0.9);
}

.video-i2v-thumb-replace-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
  background: #0f0f0f;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.35);
  transform: translateY(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.video-i2v-thumb-wrap:hover .video-i2v-thumb-replace-bar,
.video-i2v-thumb-wrap:focus-within .video-i2v-thumb-replace-bar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.video-i2v-thumb-replace-bar button {
  flex: 1 1 50%;
  margin: 0;
  min-width: 0;
  padding: 5px 4px;
  border: none;
  border-radius: 0;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: rgb(241, 245, 249);
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.video-i2v-thumb-replace-bar button + button {
  border-left: 1px solid rgba(148, 163, 184, 0.35);
}

.video-i2v-thumb-replace-bar button:hover,
.video-i2v-thumb-replace-bar button:focus-visible {
  background: rgb(79, 70, 229);
  color: #fff;
  outline: none;
}

.video-i2v-thumb-empty {
  font-size: 11px;
  color: var(--soft, rgb(148 163 184));
  padding: 4px 2px 0;
}

.video-i2v-clear-all {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.05);
  color: rgb(226 232 240);
  cursor: pointer;
  align-self: center;
}

.video-i2v-clear-all:hover {
  background: rgba(255, 255, 255, 0.1);
}

.video-i2v-library-pill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 5px 6px;
  border-radius: 0 0 8px 8px;
  border: none;
  background: #0f0f0f;
  color: #fafafa;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.video-i2v-library-pill .video-i2v-lib-icon {
  display: flex;
  flex-shrink: 0;
  opacity: 0.95;
}

.video-i2v-library-pill .video-i2v-lib-icon svg {
  width: 12px;
  height: 12px;
}

.video-i2v-drop-root:hover .video-i2v-library-pill,
.video-i2v-drop-root:focus-within .video-i2v-library-pill {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.video-i2v-library-pill:hover {
  background: #1c1c1c;
}

/* 图片编辑 · 参考图 / Mask 导入区 */
.iedit-drop-root {
  max-width: 92px;
}

.iedit-drop-inner {
  min-height: 92px;
}

.iedit-import-core .video-i2v-import-icon svg {
  width: 14px;
  height: 14px;
}

.iedit-import-core .video-i2v-import-label {
  font-size: 10px;
  font-weight: 600;
}

.iedit-thumbs {
  min-height: 44px;
}

/* 视频反推 · 本地视频导入区 */
.va-video-upload-root {
  max-width: none;
  overflow: visible;
  border-radius: 8px;
}

.va-video-drop-inner {
  min-height: 88px;
  aspect-ratio: 16 / 5;
}

.va-video-import-core {
  gap: 4px;
}

.va-video-import-core .video-i2v-import-icon svg {
  width: 20px;
  height: 20px;
}

.va-video-import-core .video-i2v-import-label {
  font-size: 14px;
}

.va-video-preview {
  width: 100%;
  height: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(112px, 160px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
}

.va-video-preview.hidden {
  display: none;
}

.va-video-preview video {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #0b0b0d;
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.va-video-preview-info {
  min-width: 0;
}

.va-video-preview-name {
  color: rgb(241 245 249);
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.va-video-preview-meta {
  margin-top: 4px;
  color: rgb(148 163 184);
  font-size: 12px;
}

.va-video-clear {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgb(226 232 240);
  cursor: pointer;
  font-size: 12px;
  padding: 7px 12px;
}

.va-video-clear:hover {
  background: rgba(127, 29, 29, 0.45);
  border-color: rgba(248, 113, 113, 0.55);
}

.media-sync-btn {
  margin-top: 6px;
  width: fit-content;
}

.media-sync-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.va-video-sync-btn {
  margin-top: -2px;
}

@media (max-width: 720px) {
  .va-video-drop-inner {
    aspect-ratio: auto;
  }

  .va-video-preview {
    grid-template-columns: 1fr;
  }
}

/* 图生视频 · 提示词 @ 引用浮层 */
.video-i2v-prompt-wrap {
  position: relative;
}

.video-i2v-prompt-editor {
  min-height: 96px;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.video-i2v-prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: rgb(148 163 184);
  pointer-events: none;
}

.video-i2v-at-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: min(42vh, 280px);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgb(253 253 255);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
  padding: 6px 0;
}

.video-i2v-at-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgb(100 116 139);
  padding: 6px 12px 4px;
}

.video-i2v-at-muted {
  font-size: 12px;
  color: rgb(148 163 184);
  padding: 10px 12px;
  line-height: 1.4;
}

.video-i2v-at-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: rgb(30 41 59);
}

.video-i2v-at-item:hover,
.video-i2v-at-item.video-i2v-at-item--hi {
  background: rgba(99, 102, 241, 0.1);
}

.video-i2v-at-thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.video-i2v-at-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-i2v-at-thumb--fallback {
  color: rgb(100 116 139);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.video-i2v-at-item-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 650;
  color: rgb(79 70 229);
  flex-shrink: 0;
}

.video-i2v-at-item-meta {
  font-size: 11px;
  color: rgb(100 116 139);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.storyboard-story-area {
  min-height: 180px;
  resize: vertical;
}

.storyboard-advanced summary {
  cursor: pointer;
  font-weight: 650;
  padding: 8px 0;
  color: var(--text);
  list-style-position: inside;
}

.storyboard-advanced-body {
  padding-top: 4px;
}

.storyboard-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.storyboard-seg-btn {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--soft);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.storyboard-seg-btn.active {
  background: rgba(109, 93, 252, 0.22);
  border-color: rgba(109, 93, 252, 0.45);
  color: #e8e8ee;
}

.storyboard-submit-wrap {
  flex-direction: column;
  align-items: stretch !important;
  gap: 6px;
}

.storyboard-cost-hint {
  font-size: 11px;
  color: var(--soft);
  text-align: center;
}

.storyboard-api-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--soft);
  line-height: 1.45;
}

/* 右侧栏故事板「教程」面板（主区已无看板列） */
.workspace-templates-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.workspace-sb-tutorial {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  background:
    linear-gradient(185deg, rgba(12, 14, 20, 0.98) 0%, rgba(6, 7, 12, 1) 55%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 11px,
      rgba(72, 96, 200, 0.06) 11px,
      rgba(72, 96, 200, 0.06) 12px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 11px,
      rgba(72, 96, 200, 0.045) 11px,
      rgba(72, 96, 200, 0.045) 12px
    );
  border-radius: 0 0 10px 10px;
}

.workspace-sb-tutorial-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 12px 28px;
}

.workspace-sb-tutorial-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.workspace-sb-hero-section {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.workspace-sb-hero-heading {
  margin: 0;
  text-align: center;
  font-size: clamp(22px, 4.2vw, 37px);
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
}

.workspace-sb-hero-lead {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.6);
}

.workspace-sb-pipeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  margin-top: 28px;
  width: 100%;
}

.workspace-sb-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.workspace-sb-stage-heading {
  margin-bottom: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.workspace-sb-stage-card {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #2a2a2a;
}

.workspace-sb-stage-card--flush {
  background: rgba(255, 255, 255, 0.04);
}

.workspace-sb-aspect {
  position: relative;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
}

.workspace-sb-aspect--169 {
  aspect-ratio: 16 / 9;
}

.workspace-sb-fill-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.workspace-sb-story-body {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 8px 10px;
}

.workspace-sb-story-label {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.workspace-sb-story-text {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
}

.workspace-sb-video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.workspace-sb-video-frame .workspace-sb-fill-cover {
  position: absolute;
  inset: 0;
}

.workspace-sb-video-mute-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background 0.15s;
}

.workspace-sb-video-mute-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

.workspace-sb-vol-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.workspace-sb-i2v {
  width: 100%;
  margin-top: 22px;
  padding: 14px 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
}

.workspace-sb-i2v-heading {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: #eef0fa;
}

.workspace-sb-i2v-lead {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1.55;
  color: rgba(185, 188, 210, 0.92);
}

.workspace-sb-i2v-label {
  display: block;
  margin: 10px 0 5px;
  font-size: 11px;
  font-weight: 650;
  color: rgba(210, 212, 230, 0.95);
}

.workspace-sb-i2v-field,
.workspace-sb-i2v-select {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e8e8f0;
  font-size: 12px;
}

.workspace-sb-i2v-field::placeholder {
  color: rgba(150, 152, 170, 0.75);
}

.workspace-sb-i2v-textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.45;
}

.workspace-sb-i2v-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.workspace-sb-i2v-fieldgrp {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.workspace-sb-i2v-sub {
  font-size: 10px;
  color: rgba(165, 168, 190, 0.9);
}

.workspace-sb-i2v-submit {
  margin-top: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(109, 93, 252, 0.45);
  background: linear-gradient(135deg, rgba(109, 93, 252, 0.35), rgba(93, 80, 200, 0.25));
  color: #fff;
  font-size: 13px;
  font-weight: 680;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
}

.workspace-sb-i2v-submit:hover:not(:disabled) {
  border-color: rgba(149, 130, 255, 0.65);
}

.workspace-sb-i2v-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.workspace-side .workspace-sb-i2v-result-slot {
  margin-top: 12px;
  max-height: min(420px, 55vh);
  overflow: auto;
  font-size: 12px;
  text-align: left;
}

.workspace-side .workspace-sb-i2v-result-slot.result-card {
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(12, 12, 16, 0.55);
}

.workspace-sb-form-hint {
  margin: 28px 0 0;
  width: 100%;
  max-width: 560px;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(175, 178, 205, 0.95);
}

.workspace-sb-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
}

.storyboard-kf-custom-wrap {
  margin-top: 10px;
}

.storyboard-field-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--soft);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInOpacity {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.panel-title {
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 750;
  line-height: 1.05;
  color: var(--text);
  letter-spacing: 0;
  text-align: center;
}

.panel-sub {
  max-width: 980px;
  margin: 14px auto 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
}

.tab-panel .panel-title {
  display: none;
}

.tab-panel .panel-sub {
  display: none;
}

.tab-panel .card {
  padding: 16px;
  border-radius: 14px;
}

.card,
.result-card {
  background: linear-gradient(180deg, rgba(29, 29, 33, 0.96), rgba(22, 22, 26, 0.96));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.card {
  padding: 22px;
}

.card h3,
.font-medium.text-slate-800,
.font-semibold.text-slate-800,
.text-slate-800 {
  color: var(--text) !important;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  color: #d8d8de;
  font-size: 13px;
  font-weight: 650;
}

.form-input {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.form-input::placeholder {
  color: #6e6e78;
}

.form-input:focus {
  outline: none;
  border-color: rgba(109, 93, 252, 0.9);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.2);
  background: rgba(255, 255, 255, 0.075);
}

select.form-input option {
  color: #f6f6f7;
  background: #1c1c22;
}

/* 媒资归档：卡片式拖放区（与深色 .card 一致） */
.media-archive-upload-wrap .media-archive-dropzone {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  outline: none;
}
.media-archive-upload-wrap .media-archive-dropzone:hover {
  border-color: rgba(139, 92, 246, 0.42);
  background: rgba(109, 93, 252, 0.07);
}
.media-archive-upload-wrap .media-archive-dropzone:focus-visible {
  border-color: rgba(167, 139, 250, 0.75);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.22);
}
.media-archive-upload-wrap .media-archive-dropzone.is-dragover {
  border-color: rgba(192, 181, 255, 0.9);
  background: rgba(109, 93, 252, 0.11);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35);
}

textarea.form-input {
  line-height: 1.55;
  max-height: 42vh;
  overflow-y: auto;
  resize: vertical;
}

/* Seedance reference-input style */
.seedance-studio {
  max-width: 760px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #2b2b2f;
  color: #ececf0;
}

.seedance-field-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #b9b9c1;
  font-size: 14px;
}

.seedance-tip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  color: #d2d2d8;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.seedance-ref-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.seedance-ref-card,
.seedance-import-card {
  position: relative;
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #17171a;
}

.seedance-ref-card video,
.seedance-ref-card img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seedance-ref-card.has-media video,
.seedance-ref-card.has-media img {
  display: block;
}

.seedance-ref-empty {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: #8a8a94;
  font-size: 12px;
}

.seedance-ref-card.has-media .seedance-ref-empty {
  display: none;
}

.seedance-ref-badge {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  padding: 1px 7px;
  border-radius: 5px;
  color: #32d9e8;
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.62);
}

.seedance-ref-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: white;
  line-height: 16px;
  background: rgba(255, 255, 255, 0.28);
}

.seedance-ref-sync {
  position: absolute;
  left: 3px;
  top: 3px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  color: #f5f7ff;
  font-size: 10px;
  line-height: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.seedance-ref-sync:disabled {
  opacity: 0.72;
  cursor: wait;
}

.seedance-ref-actions {
  position: absolute;
  top: 22px;
  left: 3px;
  z-index: 2;
  display: inline-flex;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.seedance-ref-card:hover .seedance-ref-actions,
.seedance-ref-card:focus-within .seedance-ref-actions {
  opacity: 1;
  pointer-events: auto;
}

.seedance-ref-actions button {
  height: 20px;
  min-width: 28px;
  padding: 0 8px;
  margin: 0;
  border: none;
  border-radius: 0;
  color: #f4f4f8;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 18px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.seedance-ref-actions button + button {
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.seedance-ref-actions button:hover,
.seedance-ref-actions button:focus-visible {
  background: rgb(79, 70, 229);
  color: #fff;
  outline: none;
}

.seedance-import-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-style: dashed;
  color: #adadb6;
  background: rgba(255, 255, 255, 0.035);
}

.seedance-import-icon {
  font-size: 24px;
  line-height: 24px;
}

.seedance-import-actions {
  display: flex;
  gap: 8px;
  color: #85858f;
  font-size: 12px;
}

.seedance-import-actions label,
.seedance-import-actions button {
  cursor: pointer;
}

.seedance-url-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.seedance-url-row .form-input {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.seedance-label {
  display: block;
  margin: 12px 0 8px;
  color: #bdbdc5;
  font-size: 14px;
}

.seedance-prompt {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #f3f3f6;
  background: #333337;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
}

.seedance-prompt-editor {
  position: relative;
  overflow-y: auto;
}

.seedance-prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: #8f9aa6;
  pointer-events: none;
}

.seedance-token-chip {
  display: inline-flex;
  max-width: 180px;
  height: 30px;
  align-items: center;
  gap: 7px;
  margin: 0 3px;
  padding: 2px 9px 2px 4px;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #f5f5f8;
  background: #3a3a40;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}

.seedance-token-chip img,
.seedance-token-chip video {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 6px;
  background: #111116;
}

.seedance-token-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.seedance-prompt:focus {
  outline: none;
  border-color: rgba(109, 93, 252, 0.95);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.18);
}

.seedance-token {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 8px;
  border-radius: 6px;
  color: #c9b9ff;
  background: rgba(109, 93, 252, 0.38);
  font-size: 13px;
  line-height: 20px;
  vertical-align: baseline;
}

.seedance-token.image {
  color: #bbfff3;
  background: rgba(33, 214, 160, 0.36);
}

.seedance-settings {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(190px, 0.9fr);
  align-items: center;
  gap: 16px 22px;
  margin-top: 16px;
}

.seedance-settings > label {
  color: #b9b9c1;
  font-size: 14px;
}

.seedance-settings .form-input {
  height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #3b3b40;
}

.seedance-help {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  border: 1px solid #777782;
  border-radius: 999px;
  color: #9f9faa;
  font-size: 10px;
}

.seedance-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 8px 2px 4px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  background: #141416;
}

.seedance-toggle::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #76767f;
}

.seedance-slider-wrap {
  padding-top: 2px;
}

.seedance-slider {
  width: 100%;
  accent-color: #fff;
}

.seedance-slider-marks {
  display: flex;
  justify-content: space-between;
  color: #aaaab3;
  font-size: 12px;
}

.seedance-agent {
  position: relative;
  width: min(980px, 100%);
  /* 下拉向下展开时需可见；勿用 overflow:hidden 以免裁切菜单 */
  overflow: visible;
  padding-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: #18181b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.seedance-agent-tabs {
  display: flex;
  gap: 28px;
  align-items: center;
  height: 45px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.seedance-agent-tabs button {
  height: 100%;
  color: #85858e;
  font-size: 14px;
  white-space: nowrap;
}

.seedance-agent-tabs button.active {
  color: #f4f4f6;
  border-bottom: 2px solid #e8e8ec;
}

/* 首页工作台：AI Video / AI Image 叠在同一网格格内；首屏在模型列表初始化完成前隐藏创作工作台，避免闪动 */
html.app-ui-booting .app-shell {
  pointer-events: none;
}

html.app-ui-booting #tab-seedance-replace .seedance-agent {
  visibility: hidden;
}

.seed-studio-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  position: relative;
  overflow: visible;
}

.seed-studio-stack > .seed-studio-workspace {
  grid-column: 1;
  grid-row: 1;
  position: relative;
}

/* 首页工作台：GPT Image（AI Image 页签） */
.seed-studio-workspace {
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

.seed-studio-workspace.seed-studio-inactive {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.seed-studio-workspace:not(.seed-studio-inactive) {
  z-index: 1;
}

/* AI Video / AI Image：主编辑区同宽（左 112px + 右侧自适应） */
.seedance-input-row,
.seed-img-main-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px 16px 10px;
  box-sizing: border-box;
}

/* AI Image：上传磁贴（与左侧参考格同宽 112px 列） */
.seed-img-upload-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 112px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: #242428;
  color: #9b9ba4;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.seed-img-prompt-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.seed-img-upload-tile:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: #2c2c31;
}

.seed-img-plus {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
  color: #c4c4cc;
}

.seed-img-upload-caption {
  color: #8c8c95;
}

.seed-img-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 12px;
  min-height: 0;
}

.seed-img-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111;
}

.seed-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seed-img-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}


.seed-img-dropdown {
  min-width: 0;
  flex: 0 1 auto;
  max-width: 200px;
  font-size: 14px !important;
  background: #242428 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e8e8ec !important;
}

.seed-img-model-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.seed-img-model-slot .seed-img-dropdown {
  flex: 0 1 auto;
  max-width: 220px;
}

.seed-image-toolbar.seedance-agent-controls,
.seed-video-toolbar.seedance-agent-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 16px 14px;
  /* absolute 下拉必须可见；勿用 overflow-x:auto 否则会裁切 .seedance-model-menu */
  overflow: visible;
  scrollbar-width: thin;
}

.seed-video-toolbar-trailing {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.seed-video-toolbar-trailing .seedance-rating {
  margin-left: 0;
}

.seed-btn-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.seed-btn-slot-video {
  margin-left: 0;
}


.seedance-agent-tabs button span {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #bdbdc6;
  font-size: 11px;
  line-height: 18px;
}


.seedance-agent-body {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  min-height: 116px;
  padding: 16px 16px 6px;
}


.seedance-input-main {
  min-width: 0;
}

.seedance-reference-add {
  display: flex;
  box-sizing: border-box;
  width: 112px;
  height: 112px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #8c8c95;
  background: #242428;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.seedance-reference-add:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: #2c2c31;
}

.seedance-reference-plus {
  color: #9b9ba4;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
}

.seedance-agent-help {
  min-height: 52px;
  color: #8e8e96;
  font-size: 14px;
  line-height: 1.5;
}

.seedance-agent-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.seedance-ref-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.seedance-agent .seedance-ref-card {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  cursor: pointer;
}

.seedance-agent .seedance-ref-badge {
  bottom: 5px;
  font-size: 10px;
  line-height: 16px;
}

.seedance-media-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  color: #aaaab3;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
}

.seedance-agent .seedance-prompt {
  min-height: 112px;
  margin: 0;
  padding: 12px 14px;
  border-color: transparent;
  border-radius: 10px;
  background: #222226;
  font-size: 14px;
  line-height: 1.7;
}

/* AI Image 大文本框：最小高度与左侧上传磁贴 (.seed-img-upload-tile min-height: 112px) 对齐 */
.seedance-agent textarea#seedimg-prompt {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 112px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #222226;
  color: #f3f3f6;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  overflow-y: auto;
  max-height: none;
}

.seedance-agent textarea#seedimg-prompt:focus {
  outline: none;
  border-color: rgba(109, 93, 252, 0.95);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.18);
}

.seedance-agent textarea#seedimg-prompt::placeholder {
  color: #8f9aa6;
}

.seedance-agent .seedance-url-row {
  display: none;
}

.seedance-model-picker {
  position: relative;
  z-index: 5;
  order: -1;
  flex: 0 0 220px !important;
  width: 220px !important;
  max-width: 220px !important;
}

.seedance-model-button {
  box-sizing: border-box;
  display: inline-flex;
  width: 100%;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #e8e8ef;
  background: #242428;
  font-size: 14px;
  font-weight: 500;
}

.seedance-model-button #seedrep-model-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: clip;
}

.seedance-model-button:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: #2a2a2f;
}

/* 大号胶囊（通用）；首页模型行用小号内联 PREMIUM */
.seedance-premium-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 7px;
  color: white;
  background: linear-gradient(90deg, #6f5cff, #b54cff);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}

/* 约一半尺寸，紧跟在「Seedance 2.0」文案后（2.0 与徽标无缝） */
.seedance-premium-badge.seedance-premium-badge-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0 3px;
  padding: 0 5px;
  min-height: 11px;
  border-radius: 3px;
  color: white;
  background: linear-gradient(90deg, #6f5cff, #b54cff);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.1;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.seedance-model-arrow {
  margin-left: auto;
  color: #a6a6af;
}

.seedance-model-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  bottom: auto;
  z-index: 80;
  box-sizing: border-box;
  /* 与上方模型按钮同宽（.seedance-model-picker） */
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #222226;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.seedance-model-option {
  box-sizing: border-box;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #e8e8ef;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
}

.seedance-model-option .seedance-model-option-label {
  display: inline-flex;
  flex: 1;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  min-width: 0;
  overflow: visible;
  line-height: 1.3;
}

.seedance-model-option:hover,
.seedance-model-option.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.065);
}

.seedance-mention-menu {
  position: absolute;
  left: 122px;
  top: 214px;
  z-index: 20;
  min-width: 260px;
  max-width: 360px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: #252529;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

.seedance-mention-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 8px 9px;
  border-radius: 8px;
  color: #e9e9ee;
  text-align: left;
  font-size: 13px;
}

.seedance-mention-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.seedance-mention-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: #111116;
}

.seedance-mention-thumb img,
.seedance-mention-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seedance-mention-meta {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.seedance-mention-menu small {
  min-width: 0;
  overflow: hidden;
  color: #90909a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seedance-agent-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  position: relative;
  z-index: 4;
  overflow: visible;
  padding: 8px 16px 18px;
}

.seedance-agent-controls .form-input {
  width: auto;
  min-width: 96px;
  min-height: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: #dcdcE4;
  background: #242428;
  font-size: 13px;
}

.seedance-agent-controls > select.form-input:not(.seed-img-dropdown) {
  flex: 0 0 124px;
  width: 124px;
  max-width: 124px;
  min-width: 0;
  font-size: 14px;
}

.seedance-agent-controls #seedrep-model {
  display: none;
}

.seedance-rating {
  margin-left: auto;
  color: #aaaab4;
  font-size: 13px;
}

.seedance-generate-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(112, 255, 158, 0.32);
  border-radius: 999px;
  color: #9dffb8;
  background: rgba(37, 177, 86, 0.18);
  font-size: 13px;
  font-weight: 700;
}

.seedance-generate-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary,
.btn-secondary,
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.15s, background 0.15s, border-color 0.15s;
}

.btn-primary {
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, #6d5dfc, #8a4dff);
  box-shadow: 0 12px 28px rgba(109, 93, 252, 0.25);
}
.btn-primary:hover { opacity: 0.94; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary,
.pill-btn {
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  color: #d7d7df;
  background: rgba(255, 255, 255, 0.055);
}
.btn-secondary:hover,
.pill-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.085);
}

.pill-btn {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.pill-btn.active {
  color: white;
  border-color: rgba(109, 93, 252, 0.65);
  background: rgba(109, 93, 252, 0.24);
}

.sub-tab {
  padding: 10px 16px;
  color: var(--soft);
  border-bottom: 2px solid transparent;
  font-size: 13px;
  cursor: pointer;
}
.sub-tab.active {
  color: white;
  border-color: #d7d5ff;
  font-weight: 700;
}
.sub-panel { display: none; }
.sub-panel.active { display: block; }

/* Tailwind utility color corrections inside the static markup */
.text-slate-400,
.text-slate-500,
.text-slate-600,
.text-slate-700 {
  color: var(--muted) !important;
}
.bg-white,
.bg-slate-50,
.bg-slate-100,
.bg-slate-200,
.bg-card {
  background-color: rgba(255, 255, 255, 0.055) !important;
}
.border-slate-100,
.border-slate-200,
.border-slate-300 {
  border-color: var(--line) !important;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

/* ========== 结果卡片 ========== */
.result-card {
  margin-top: 20px;
  overflow: hidden;
}
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}
.result-body { padding: 20px; }

#tab-video-analyze > .card {
  flex: 0 0 auto !important;
  max-height: none !important;
  overflow: visible !important;
}

#result-va {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: min(46vh, 520px);
  min-height: 220px;
}

#result-va .result-header {
  flex: 0 0 auto;
}

#result-va .result-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 14px;
}

#result-va .va-result-block {
  max-height: 220px;
  overflow-y: auto;
}

#result-va .va-result-pre {
  display: block;
  max-height: 170px;
  overflow-y: auto;
  line-height: 1.55;
}

#result-va .font-mono,
#result-va .json-block {
  white-space: pre-wrap;
  word-break: break-word;
}

#tab-swap > .card {
  flex: 0 0 auto !important;
  max-height: none !important;
  overflow: visible !important;
}

#tab-swap #result-iedit {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: min(58vh, 720px);
  min-height: 260px;
}

#tab-swap #result-iedit .result-header {
  flex: 0 0 auto;
}

#tab-swap #result-iedit .result-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 14px;
}

#tab-swap #result-iedit .kv-grid dd {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#tab-swap #result-iedit img {
  max-width: 100%;
  height: auto;
}

.iedit-replace-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.iedit-replace-label {
  flex: 0 0 auto;
  white-space: nowrap;
}
.iedit-type-select {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 360px;
}
.iedit-fill-btn {
  flex: 0 0 auto;
  font-size: 12px !important;
  padding: 6px 16px !important;
}

#tab-video-i2v > .card {
  flex: 0 0 auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* 图生视频 / 图片反推 / 视频复刻参考图：无图上传卡与缩略图同高（92px 档）；缩略图横排 + 紧跟导入卡 */
:is(#tab-video-i2v, #tab-analyze, #tab-video-remix) .video-i2v-i2v-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

/* 车道不产生独立 flex 框，缩略图与上传卡并排；卡始终紧跟缩略区域 */
:is(#tab-video-i2v, #tab-analyze, #tab-video-remix) .video-i2v-thumbs-lane {
  display: contents;
}

:is(#tab-video-i2v, #tab-analyze, #tab-video-remix) .video-i2v-thumbs--i2v-lane {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-end;
  align-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
  box-sizing: border-box;
  max-width: max(0px, calc(100% - min(92px, 60vw) - 10px));
  padding-bottom: 2px;
}

:is(#tab-video-i2v, #tab-analyze, #tab-video-remix) .video-i2v-thumb-wrap {
  width: min(92px, 60vw);
  height: min(92px, 60vw);
  flex-shrink: 0;
  box-sizing: border-box;
}

:is(#tab-video-i2v, #tab-analyze, #tab-video-remix) .video-i2v-drop-root--i2v-slot {
  flex: 0 0 auto;
}

#tab-analyze .iedit-thumbs {
  min-height: 0;
}

#tab-video-i2v #result-video-i2v {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: min(58vh, 720px);
  min-height: 260px;
}

#tab-video-i2v #result-video-i2v .result-header {
  flex: 0 0 auto;
}

#tab-video-i2v #result-video-i2v .result-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 14px;
}

#tab-video-i2v #result-video-i2v .kv-grid dd {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#tab-video-i2v #result-video-i2v img,
#tab-video-i2v #result-video-i2v video {
  max-width: 100%;
  height: auto;
}

/* 视频复刻：主表单不占满 flex，结果区内滚动以免视频被 result-card overflow 裁切 */
#tab-video-remix > .card {
  flex: 0 0 auto !important;
  max-height: none !important;
  overflow: visible !important;
}

#tab-video-remix #result-remix {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 900px);
  min-height: 220px;
  overflow: hidden;
}

#tab-video-remix #result-remix .result-header {
  flex: 0 0 auto;
}

#tab-video-remix #result-remix .result-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 14px;
}

#tab-video-remix #result-remix img,
#tab-video-remix #result-remix video {
  max-width: 100%;
  height: auto;
}

#tab-video-storyboard > .card {
  flex: 0 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

#tab-video-storyboard #result-storyboard {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: min(62vh, 760px);
  min-height: 260px;
}

#tab-video-storyboard #result-storyboard .result-header {
  flex: 0 0 auto;
}

#tab-video-storyboard #result-storyboard .result-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 14px;
}

#tab-video-storyboard #result-storyboard .kv-grid dd {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#tab-video-storyboard #result-storyboard img {
  max-width: 100%;
  height: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: rgba(84, 209, 125, 0.16); color: #84f0a7; }
.badge-error { background: rgba(255, 91, 110, 0.16); color: #ff9aa8; }
.badge-pending { background: rgba(255, 198, 79, 0.16); color: #ffd37a; }
.badge-info { background: rgba(109, 165, 255, 0.16); color: #9bc0ff; }

.kv-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.kv-grid dt { color: var(--muted); }
.kv-grid dd { color: var(--text); word-break: break-all; }

pre.json-block {
  max-height: 400px;
  overflow-x: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #dfe6ff;
  background: #0d0d13;
  font-size: 12px;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.shot-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}
.shot-card img,
.shot-card video {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #111116;
}
.shot-card .shot-meta {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: #d9d9df;
  text-align: left;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.04);
}
table.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
table.data-table tr:hover td {
  background: rgba(109, 93, 252, 0.11);
  color: #f7f7fb;
}

table.data-table tr:hover .text-slate-500,
table.data-table tr:hover .text-slate-400 {
  color: #c6c6d2 !important;
}

.loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #44444e;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 弹窗 ========== */
#media-picker-modal > div:first-child,
#prompt-lib-modal > div:first-child {
  background: rgba(0, 0, 0, 0.68) !important;
  backdrop-filter: blur(8px);
}

#media-picker-modal > div:nth-child(2),
#prompt-lib-modal > div:nth-child(2) {
  background: var(--panel) !important;
  border-color: var(--line-strong) !important;
  color: var(--text);
}

#media-picker-modal h3,
#prompt-lib-modal h3 {
  color: var(--text) !important;
}

#media-picker-modal [data-dismiss-media-picker],
#prompt-lib-modal [data-dismiss-prompt-lib] {
  color: #d7d7df !important;
}

/* ========== Scrollbars ========== */
.tab-panel::-webkit-scrollbar,
.app-sidebar::-webkit-scrollbar,
.app-subnav::-webkit-scrollbar,
textarea.form-input::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.tab-panel::-webkit-scrollbar-thumb,
.app-sidebar::-webkit-scrollbar-thumb,
.app-subnav::-webkit-scrollbar-thumb,
textarea.form-input::-webkit-scrollbar-thumb {
  background: #3b3b43;
  border-radius: 999px;
}
.tab-panel::-webkit-scrollbar-track,
.app-sidebar::-webkit-scrollbar-track,
.app-subnav::-webkit-scrollbar-track,
textarea.form-input::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 900px) {
  :root {
    --app-sidebar-width: 60px;
  }

  .app-header {
    margin-left: var(--app-sidebar-width);
    max-width: calc(100% - var(--app-sidebar-width));
  }
  .app-shell {
    display: block;
    padding-left: var(--app-sidebar-width);
  }
  /* 平板/窄窗：双栏最小宽度易横向溢出，改为单列主内容 + 下方资源库 */
  .app-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 24px 14px 36px;
  }
  .app-main.workspace-hidden {
    grid-template-columns: minmax(0, min(980px, 100%));
  }

  /* 与同名的桌面规则一致：≤900px 仍勿把首页模版区压在 980px 版心里 */
  .app-main.workspace-hidden.app-main--seedance-home {
    grid-template-columns: minmax(0, 1fr);
  }

  #workspace-side-slot {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }
  .workspace-side {
    grid-column: 1;
    position: relative;
    top: auto;
    height: auto;
    min-height: 280px;
    max-height: min(calc(var(--app-vh) - 140px), 620px);
  }
  .app-sidebar {
    padding-left: 4px;
    padding-right: 4px;
  }
  .app-subnav {
    position: fixed;
    top: var(--subnav-top, 76px);
    left: var(--app-sidebar-width);
    z-index: 35;
    width: max-content;
    min-width: 176px;
    max-width: calc(100vw - var(--app-sidebar-width) - 16px);
    max-height: min(68vh, var(--subnav-max-height, 480px));
    margin: 0;
    padding: 9px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
  }
  .menu-root {
    min-height: 58px;
    font-size: 10px;
  }
  .menu-root-system {
    margin-top: auto;
  }
  .subnav-panel.active {
    display: block;
  }
  .subnav-title,
  .subnav-desc {
    display: none;
  }
  .subnav-desc {
    margin-bottom: 4px;
  }
  .nav-btn {
    min-height: 38px;
    margin-bottom: 0;
    padding: 9px 10px 9px 13px;
    font-size: 12px;
  }
  .promo-chip,
  .api-toolbar span {
    display: none;
  }
  .api-toolbar input {
    width: min(42vw, 240px);
  }
  .panel-title {
    text-align: left;
  }
  .panel-sub {
    text-align: left;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  body {
    min-width: 0;
    padding-bottom: 0;
  }

  .app-header {
    margin-left: 0;
    max-width: 100%;
  }

  .app-header-inner {
    height: auto;
    min-height: 64px;
    padding: 10px 12px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .app-header-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .api-toolbar {
    width: 100%;
    gap: 8px;
  }

  .api-toolbar input {
    width: 100%;
    min-width: 0;
    flex: 1;
  }

  .doc-link {
    flex: 0 0 auto;
  }

  .app-shell {
    padding-left: 0;
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .app-sidebar {
    top: auto;
    bottom: 0;
    width: 100%;
    height: 70px;
    max-height: 70px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.32);
  }

  .app-sidebar::before {
    display: none;
  }

  .menu-root,
  .menu-root-system {
    min-height: 56px;
    margin-top: 0;
    padding: 7px 2px 5px;
    border-radius: 13px;
    font-size: 10px;
  }

  .menu-root-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 5px;
    font-size: 17px;
  }

  .menu-root.active::after {
    top: auto;
    right: 50%;
    bottom: -6px;
    width: 28px;
    height: 3px;
    transform: translateX(50%);
  }

  .app-subnav {
    top: var(--subnav-top, 64px);
    max-height: min(68vh, var(--subnav-max-height, 480px));
    padding: 9px;
  }

  .subnav-title {
    margin: 4px 2px 2px;
    font-size: 17px;
  }

  .subnav-desc {
    margin: 0 2px 4px;
    font-size: 11px;
  }

  .subnav-panel.active {
    display: block;
  }

  .nav-btn {
    min-height: 36px;
    padding: 8px 9px 8px 12px;
    font-size: 12px;
  }

  .app-main {
    padding: 22px 12px 28px;
  }

  .workspace-side {
    position: relative;
    top: auto;
    height: auto;
    min-height: 260px;
    max-height: min(calc(var(--app-vh) - 200px), 560px);
  }

  .tab-panel {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: 0 0 24px;
  }

  .app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) {
    display: revert;
    flex-direction: revert;
    min-height: unset;
    max-height: none;
  }

  .app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) > .card,
  .app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) > div.grid:has(> .card) {
    flex: unset;
    min-height: unset;
  }

  .app-main:not(.workspace-hidden) > .tab-panel:not(.hidden) > div.grid:has(> .card) {
    grid-auto-rows: revert;
    align-items: revert;
  }

  .app-main:not(.workspace-hidden) .tab-panel:not(.hidden) .workspace-submit-shell {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .btn-primary.ws-submit-btn {
    min-height: 40px;
    border-radius: 12px;
  }

  .panel-title {
    font-size: 30px;
  }

  .panel-sub {
    margin: 10px 0 20px;
    font-size: 13px;
  }

  .card,
  .result-card {
    border-radius: 16px;
  }

  .card {
    padding: 18px;
  }

  .tab-panel .grid,
  .tab-panel .lg\:grid-cols-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .tab-panel .flex {
    min-width: 0;
  }

  .tab-panel .flex.gap-2,
  .tab-panel .flex.gap-3,
  .tab-panel .flex.flex-wrap {
    flex-wrap: wrap;
  }

  .tab-panel .flex.gap-2 > .form-input,
  .tab-panel .flex.gap-3 > .form-input {
    flex-basis: 100%;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 40px;
  }

  .tab-panel .btn-primary,
  .tab-panel .btn-secondary {
    white-space: normal;
  }

  .shot-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .kv-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  table.data-table {
    min-width: 0;
    font-size: 12px;
  }

  table.data-table th,
  table.data-table td {
    padding: 7px 8px;
  }

  .result-card,
  .card {
    overflow-x: auto;
  }

  #media-picker-modal > div:nth-child(2),
  #prompt-lib-modal > div:nth-child(2) {
    inset: 10px !important;
    max-width: none;
  }

  #prompt-lib-modal .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 390px) {
  .app-main {
    display: block;
  }

  .workspace-side {
    position: relative;
    top: auto;
    height: auto;
    min-height: 220px;
    max-height: min(480px, calc(var(--app-vh) - 230px));
    margin-top: 16px;
  }

  .subnav-panel.active {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-title {
    font-size: 27px;
  }

  .card {
    padding: 15px;
  }
}

/* —— Google 登录 / 只读浏览 —— */
.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-auth-login {
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #f5f3ff;
  border: none;
  cursor: pointer;
}

.btn-auth-login:hover {
  filter: brightness(1.08);
}

.auth-user-email {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  color: #c4b5fd;
}

#btn-auth-logout {
  font-size: 0.7rem;
  color: #94a3b8;
}

#btn-auth-logout:hover {
  color: #e2e8f0;
}

body.auth-readonly .app-main,
body.auth-readonly .workspace-side {
  pointer-events: none;
  user-select: none;
  opacity: 0.9;
}

body.auth-readonly .app-header,
body.auth-readonly .app-sidebar,
body.auth-readonly .app-subnav,
body.auth-readonly #auth-modal {
  pointer-events: auto;
  user-select: auto;
  opacity: 1;
}

#auth-modal {
  display: none;
}

#auth-modal.auth-modal-open {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 20000;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.auth-modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 420px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #1e293b;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
}

.auth-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
}

.auth-modal-close:hover {
  color: #f1f5f9;
}

.auth-modal-body {
  padding: 1.25rem;
}

.auth-login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.auth-login-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.auth-login-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #020617;
  color: #f8fafc;
  font-size: 0.9rem;
}

.auth-login-form input:focus {
  outline: none;
  border-color: #6366f1;
}

.auth-login-submit {
  margin-top: 0.25rem;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.auth-login-submit:hover:not(:disabled) {
  filter: brightness(1.06);
}

.auth-login-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-login-error {
  font-size: 0.8rem;
  color: #f87171;
  min-height: 1.2em;
}

.auth-oauth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: #64748b;
  font-size: 0.75rem;
}

.auth-oauth-divider::before,
.auth-oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #334155;
}

.auth-google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-google-btn:hover {
  background: #273549;
}

.auth-google-btn svg {
  flex-shrink: 0;
}

.auth-modal-foot {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
}

/* —— 视频压缩：卡片式上传 —— */
.vcompress-upload-card {
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.35);
  padding: 1.75rem 1.25rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.vcompress-upload-card:hover,
.vcompress-upload-card:focus-visible {
  border-color: rgba(167, 139, 250, 0.65);
  background: rgba(30, 27, 75, 0.25);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.vcompress-upload-card--drag {
  border-color: rgba(167, 139, 250, 0.95);
  background: rgba(76, 29, 149, 0.18);
}

.vcompress-upload-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  pointer-events: none;
}

.vcompress-upload-icon {
  color: rgba(196, 181, 253, 0.85);
  margin-bottom: 0.25rem;
}

.vcompress-upload-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
}

.vcompress-upload-filename {
  font-size: 0.75rem;
  color: #94a3b8;
  word-break: break-all;
  max-width: 100%;
  padding: 0 0.5rem;
}

.vcompress-upload-filename--ok {
  color: #c4b5fd;
}

/* ===== TTS 音色弹窗 ===== */
.voice-picker-shell.hidden {
  display: none !important;
}
.voice-picker-tab--on {
  position: relative;
}
.voice-picker-card--sel {
  border-color: rgba(109, 93, 252, 0.65) !important;
  box-shadow: 0 0 0 1px rgba(109, 93, 252, 0.32), 0 10px 36px rgba(0, 0, 0, 0.45);
  background: rgba(109, 93, 252, 0.09);
}
.voice-picker-mini-select,
.voice-picker-mini-input {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  min-width: 120px;
}
.voice-picker-mini-input:focus,
.voice-picker-mini-select:focus {
  outline: none;
  border-color: rgba(109, 93, 252, 0.55);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.18);
}
.voice-picker-mini-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.voice-picker-mini-btn:hover {
  background: rgba(255, 255, 255, 0.11);
}
.voice-picker-accent-btn {
  flex-shrink: 0;
  background: linear-gradient(135deg, #5e47ff 0%, #6d5dfc 48%, #2d8cff 100%);
  color: #fff;
  border: none;
  box-shadow: 0 12px 28px rgba(109, 93, 252, 0.32);
}
.voice-clone-drop--active {
  border-color: rgba(167, 139, 250, 0.65) !important;
  background: rgba(76, 29, 149, 0.22);
}
.voice-picker-star[data-on="1"] {
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.5) !important;
}

/* ─── 图生视频 AI 脚本助手（复用全局 card / sub-tab / btn-*） ─── */
#video-i2v-script-card.card {
  padding: 0;
}
#video-i2v-script-card .sub-tab {
  border: none;
  background: transparent;
}

/* ─── 数据字典通用弹窗 ─── */
.dict-modal {
  position: fixed;
  inset: 0;
  z-index: 18000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dict-modal.hidden { display: none; }

.dict-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.dict-modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 40px -8px rgba(0,0,0,0.22);
  margin: 1rem;
  overflow: hidden;
}
.dict-modal-panel--wide {
  max-width: 860px;
}

.dict-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.dict-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.dict-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.dict-modal-close:hover { background: #f1f5f9; color: #475569; }
