/* ================================================================
   QD INFINITY — Luminous Ethereality Theme
   Companion CSS for dynamic content generated by main.js
   Static layout handled by Tailwind utility classes in index.html
   ================================================================ */

:root {
  --bg-main: #ECEFF1;
  --bg-card: #ffffff;
  --accent: #0B1320;
  --accent-soft: rgba(11,19,32,0.10);
  --green: #2e7d32;
  --green-soft: rgba(46,125,50,0.1);
  --border: rgba(144,164,174,0.30);
  --text: #0B1320;
  --text-dim: #2C3E50;
  --radius: 16px;
  --font-mono: ui-monospace, Consolas, monospace;
  --surface-low: #ECEFF1;
  --surface-high: #CFD8DC;
  --surface-highest: #CFD8DC;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body { margin: 0; min-height: 100%; font-family: 'Inter', "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }

#dotMatrixCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.vignette-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 80% 70% at 50% 50%,
    transparent 40%,
    rgba(11, 19, 32, 0.06) 75%,
    rgba(11, 19, 32, 0.14) 100%
  );
}

/* ============================================================
   Sidebar nav items (toggled by main.js via is-active class)
   ============================================================ */
.sw-nav-item {
  color: #2C3E50;
  background: transparent;
  border: none;
  font-family: inherit;
  position: relative;
  isolation: isolate;
}
.sw-nav-item:hover {
  color: #0B1320;
  background: #CFD8DC;
  border-radius: 0;
}
/* Active 态：底色 + 点阵均从左到右渐隐，整体长方形无圆角。
   - 底色 linear-gradient: rgba(11,19,32,0.7) → 0，颜色取值对齐
     .glow-border-wrap 的 --card-bg #0B1320（= rgb(11,19,32)），跟积分方块同色系；
     左端 70% 半透明、右端 0% 完全透明，实现"左实右虚"的渐隐块；
   - border-radius: 0 覆盖 button 原本 Tailwind 的 rounded-[3rem]，
     双 class specificity 高于 Tailwind 单 class，不需要 !important；
   - 点阵走 ::before：白点 rgba(255,255,255,0.7) 提高不透明度，5×5 tile 密集分布；
     mask-image linear-gradient 让点阵自身再从左 70% 渐隐到右 0%，
     与底色同向淡出，融合成统一的"从左到右半透明波点"；
   - ::before z-index:0 + 子元素 z-index:1：点阵叠在底色之上、文字/图标之下，
     text 全段可读（不会被 mask 连带变淡）。 */
.sw-nav-item.is-active {
  color: #fff;
  background: linear-gradient(to right, rgba(11,19,32,0.7) 0%, rgba(11,19,32,0) 100%);
  border-radius: 0;
  box-shadow: none;
}
.sw-nav-item.is-active::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.7) 0.9px, transparent 1.4px);
  background-size: 5px 5px;
  background-repeat: repeat;
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
          mask-image: linear-gradient(to right, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
  pointer-events: none;
  z-index: 0;
}
.sw-nav-item.is-active > * {
  position: relative;
  z-index: 1;
}
.sw-nav-item.is-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

/* Billing chip —— 从 glow-border-wrap（边缘彩光跟随 cursor）换成 PixelCard：
   hover / focus 时 canvas 上从中心向外按距离延迟的像素块闪烁动画。
   视觉实现：
     - .pixel-card 是容器，position:relative + overflow:hidden，保证 canvas 不溢出；
     - .pixel-card > .pixel-canvas 绝对定位铺满容器，pointer-events:none
       让点击直接穿透到里面的 <button>（button 仍是实际可点击/可 focus 的目标）；
     - 容器本身的 background 就是积分方块底色 #0B1320（与 .glow-border-wrap 的
       --card-bg 一致），继续保持与品牌深色卡片的同色呼应；
     - 边框用 1px rgba(255,255,255,0.15)，跟原来 glow-border-wrap 的静息态轻边一致；
   像素动画逻辑走 static/modules/pixel_card.js 的 mountPixelCard()，在 main.js
   init 阶段绑定一次。本文件不再需要 .glow-border-* 选择器给积分方块用——
   那三件套仍然服务于剧本输入框 / 项目侧写卡片 / 剪辑操作卡等其他地方，不动。 */
.pixel-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgb(255 255 255 / 15%);
  background: #0B1320;
  user-select: none;
}
.pixel-card > .pixel-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   订阅与积分弹窗（#billingModal）
   ------------------------------------------------------------
   把原先 #pageBilling 的 in-place page 显示升级为全屏浮层：
     - .billing-modal 是外壳，fixed inset 0，z-index 高于 sidebar 和任务面板；
     - .hidden 时 display:none 彻底移出渲染树，避免 tab-focus 或遮挡；
     - .is-open 状态由 main.js 的 openBillingModal() 加，CSS 负责渐入；
     - .billing-modal-backdrop 半透明遮罩 + 模糊，data-billing-close 触发关闭；
     - .billing-modal-dialog 白底卡片，居中，内容区自行滚动（max-h 85vh）。
   文案/交互 hook 都在 static/index.html 的 #billingModal 里标好，JS 通过
   #billingModalClose / data-billing-close / ESC 三路关闭（main.js openBillingModal 内绑定）。
   ============================================================ */
.billing-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 180ms ease-out;
}
.billing-modal.hidden {
  display: none !important;
}
.billing-modal.is-open .billing-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.billing-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 19, 32, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.billing-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 1400px;
  max-height: 90vh;
  overflow-y: auto;
  /* 底色切回工作台基底 #ECEFF1（index.html tailwind config 里的 background），
     让弹窗内嵌的 #billingModalDots canvas 绘制同款波点时视觉与主工作台完全同源；
     原纯白 #ffffff 改成 #ECEFF1 后，与下方套餐卡的深色 + 当前套餐卡的深色形成
     "浅冰灰底 + 深色卡片漂浮"的三层层叠，呼应 DESIGN.md 的 Tonal Nesting 语言。 */
  background: #ECEFF1;
  border: 1px solid rgba(11, 19, 32, 0.06);
  border-radius: 24px;
  box-shadow: 0 24px 60px -12px rgba(11, 19, 32, 0.35);
  padding: 48px 56px;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease-out;
}

/* 工作台点阵 canvas 层（绝对定位铺满 dialog，pointer-events:none 以便点击穿透） */
.billing-modal-dots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* dialog 内容包装层：放在 canvas 上方（z:1），保证所有 UI 元素可交互、可见 */
.billing-modal-inner {
  position: relative;
  z-index: 1;
}

/* 弹窗内部滚动条与 .page-scroll 一致的极简风 */
.billing-modal-dialog::-webkit-scrollbar { width: 4px; }
.billing-modal-dialog::-webkit-scrollbar-thumb { background: rgba(11, 19, 32, 0.12); border-radius: 10px; }
.billing-modal-dialog::-webkit-scrollbar-track { background: transparent; }

/* 打开态下锁住 body 滚动（main.js 会给 body 加 .billing-modal-lock） */
body.billing-modal-lock {
  overflow: hidden;
}

/* ============================================================
   订阅套餐卡片（.plan-card）—— "Luminous Infinity" pricing card
   ------------------------------------------------------------
   视觉参考：/Users/cuize/Downloads/stitch_sleek_ai_video_agent (3)/
     code.html + DESIGN.md 中的 .pricing-card。
   关键视觉：
     - 深色渐变底（Deep Ink Blue 0.95→0.8）+ 8px halftone dot 纹理；
     - 内嵌 .plan-energy-pulse：conic-gradient 旋转极光边，mask 只显示 2px 边框；
     - 价格用 .plan-price-glow：白字 + cyan 双层文字光晕；
     - hover：轻微抬升 + cyan 边框 + 加强阴影；
     - .is-current 变体：cyan 边框 + 更强 pulse + CTA cyan 高亮。
   注意：不改 .billing-modal-dialog 等弹窗外壳（用户明确要求只改卡片样式）。
   click 委托仍沿用 [data-plan-code] 选择器（billing.js 里绑定），data-plan-code
   属性放在 CTA 按钮上，避免整卡 + 按钮双重触发 checkout。
   ============================================================ */
.billing-plans-grid {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 2px 16px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.billing-plans-grid::-webkit-scrollbar { height: 4px; }
.billing-plans-grid::-webkit-scrollbar-thumb { background: rgba(11, 19, 32, 0.15); border-radius: 10px; }
.billing-plans-grid::-webkit-scrollbar-track { background: transparent; }
.billing-plans-grid > .plan-card { scroll-snap-align: start; }

.plan-card {
  position: relative;
  flex: 1 1 260px;
  min-width: 260px;
  max-width: 320px;
  padding: 28px 24px;
  border-radius: 24px;
  overflow: hidden;
  color: #ECEFF1;
  background-color: #0B1320;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0),
    linear-gradient(180deg, rgba(11, 19, 32, 0.95) 0%, rgba(11, 19, 32, 0.8) 100%);
  background-size: 8px 8px, auto;
  background-repeat: repeat, no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1),
              border-color 0.3s ease,
              box-shadow 0.4s ease;
  text-align: left;
  cursor: default;
}
.plan-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 229, 255, 0.55);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.45),
              0 0 40px -8px rgba(0, 229, 255, 0.15);
}
.plan-card.is-current {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: 0 0 40px -10px rgba(0, 229, 255, 0.35);
}

/* 旋转极光边（conic-gradient + mask 保留 2px 外边） */
.plan-energy-pulse {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from 0deg, transparent 0deg, #00E5FF 60deg, transparent 120deg, transparent 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: plan-energy-rotate 6s linear infinite;
  opacity: 0.18;
  pointer-events: none;
}
.plan-card.is-current .plan-energy-pulse { opacity: 0.55; }
@keyframes plan-energy-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 价格文字辉光（白字 + 双层 cyan 光晕） */
.plan-price-glow {
  color: #ffffff;
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.4),
               0 0 50px rgba(0, 229, 255, 0.2);
}

/* 顶角"当前" badge */
.plan-badge-current {
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: #00E5FF;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.4);
  border-radius: 9999px;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.2);
}

/* 价格下的积分提示 chip */
.plan-credits-chip {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(0, 229, 255, 0.1);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ECEFF1;
}

/* 特性列表条目 */
.plan-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(236, 239, 241, 0.75);
}
.plan-feature-item .plan-feature-icon {
  font-size: 16px;
  line-height: 1;
  color: rgba(236, 239, 241, 0.4);
  flex-shrink: 0;
  margin-top: 2px;
}
.plan-feature-item .plan-feature-sub {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 500;
  color: rgba(236, 239, 241, 0.4);
}

/* CTA 按钮 */
.plan-cta {
  width: 100%;
  margin-top: 28px;
  padding: 14px 0;
  background: #ECEFF1;
  color: #0B1320;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  border-radius: 12px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.plan-cta:hover { background: #00E5FF; }
.plan-cta:active { transform: scale(0.98); }
.plan-card.is-current .plan-cta {
  background: #00E5FF;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.35);
}
.plan-cta:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: rgba(236, 239, 241, 0.2);
  color: rgba(236, 239, 241, 0.6);
}

/* ============================================================
   当前套餐状态卡（.plan-current-card）
   ------------------------------------------------------------
   订阅弹窗最上方那一块"当前套餐 + 余额 + 操作"的容器。
   延续 .plan-card 的深色渐变 + halftone + 旋转极光边 视觉语言，
   但更紧凑（padding 20px 而非 28px、垂直间距压到 16px），
   让状态信息不占太多高度，给下方套餐卡片留出更多空间。
   嵌套的 3 个积分小卡走 .plan-balance-cell（半透明白底 + 薄亮边）
   以适配深色背景，不再用原来 bg-surface-container 的浅灰底。
   ============================================================ */
.plan-current-card {
  position: relative;
  padding: 18px 22px;
  border-radius: 20px;
  overflow: hidden;
  color: #ECEFF1;
  background-color: #0B1320;
  /* halftone dot 密度同 .plan-card（8px 8px），但 dot 亮度从 0.05 提到 0.08，
     面积更大也能清晰看出纹理；底色渐变与 .plan-card 保持完全一致。 */
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 0),
    linear-gradient(180deg, rgba(11, 19, 32, 0.95) 0%, rgba(11, 19, 32, 0.8) 100%);
  background-size: 8px 8px, auto;
  background-repeat: repeat, no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 20px;
  /* 常驻阴影：让它在白底弹窗上明显"浮起"，视觉权重类比 .plan-card:hover 时；
     顶部副光用 cyan 极浅色（0.08）暗示跟下方套餐卡同源的能量脉冲语言。 */
  box-shadow: 0 18px 44px -16px rgba(11, 19, 32, 0.55),
              0 0 32px -10px rgba(0, 229, 255, 0.12);
}
/* 极光边对齐 .plan-card 默认值，不再压低，保证顶部卡边框光带清晰可见 */
.plan-current-card .plan-energy-pulse { opacity: 0.22; }

/* 嵌套余额小卡（总积分 / 订阅积分 / 加购积分） */
.plan-balance-cell {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 深色底上的圆角 pill 按钮族（支付方式切换器 / 取消恢复） */
.plan-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
}
.plan-pill-btn {
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(236, 239, 241, 0.75);
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
}
.plan-pill-btn:hover { color: #fff; }
.plan-pill-btn.is-active {
  background: #00E5FF;
  color: #0B1320;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.35);
}
.plan-action-btn {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(236, 239, 241, 0.85);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
}
.plan-action-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* 深色底上的特性 badge（替代原本浅色的 bg-surface-container 版本） */
.plan-feature-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(236, 239, 241, 0.8);
}

/* ============================================================
   订阅套餐板块外壳（.billing-section-glass）—— 透明容器
   ------------------------------------------------------------
   用户要求去掉这一段的背景：原本的毛玻璃外壳去掉之后，
   套餐卡直接浮在 dialog 的点阵 canvas 上，层次变成
   "底层点阵 → 浮起的深色套餐卡 + logo holo"，更直接、更通透。
   只保留布局：padding / margin-bottom / 圆角 + position:relative
   （后者为 .billing-plans-grid 和未来可能的 ::before 副元素保留坐标系）。
   ============================================================ */
.billing-section-glass {
  position: relative;
  padding: 0;
  margin-bottom: 24px;
  border-radius: 20px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}



/* ============================================================
   Page visibility (toggled by main.js via hidden attribute)
   ============================================================ */
.page-scroll[hidden] { display: none !important; }

.page-scroll {
  background: transparent;
}

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

.page-scroll.page-enter-anim {
  animation: pageEnterAnim 0.28s ease-out both;
}

/* Scrollbar styling for page areas */
.page-scroll::-webkit-scrollbar { width: 4px; }
.page-scroll::-webkit-scrollbar-thumb { background: rgba(11,19,32,0.12); border-radius: 10px; }
.page-scroll::-webkit-scrollbar-track { background: transparent; }

.snap-center-custom { scroll-snap-align: center; }

/* ============================================================
   Chat scroll — bottom-anchored like WeChat
   ============================================================ */
#chatMessages {
  display: flex;
  flex-direction: column;
}
#chatMessages > div:first-child {
  margin-top: auto;
}

/* ============================================================
   Chat interface — iMessage style
   ============================================================ */
.chat-msg {
  display: flex; gap: 12px;
  animation: chatSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.chat-msg--user { justify-content: flex-end; }
.chat-msg--ai { justify-content: flex-start; align-items: flex-start; }
.chat-msg--status { justify-content: flex-start; align-items: flex-start; }

.chat-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}

.chat-bubble {
  max-width: 75%; padding: 12px 18px; border-radius: 20px;
  font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
}
.chat-bubble--user {
  background: #0B1320; color: #ECEFF1;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 16px rgba(11,19,32,0.12);
}
.chat-bubble--ai {
  background: white; border: 1px solid rgba(144,164,174,0.12);
  color: var(--text); border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.chat-bubble--status {
  background: transparent; border: none;
  color: var(--text-dim); font-size: 12px; padding: 2px 0;
}
.chat-bubble--status .chat-status-ok { color: var(--green); font-weight: 600; }
.chat-bubble--status .chat-status-err { color: #9f403d; font-weight: 600; }

/* ── Profile page ── */
#pageProfile .profile-msg { display: flex; gap: 20px; align-items: flex-start; animation: chatSlideUp 0.5s cubic-bezier(0.16,1,0.3,1); }
#pageProfile .profile-msg--ai { justify-content: flex-start; }
#pageProfile .profile-msg--user { justify-content: flex-end; }

#pageProfile .profile-msg--ai .profile-text {
  font-size: 17px; font-weight: 300; line-height: 1.75; color: #26353b;
  white-space: pre-wrap; word-break: break-word; max-width: 640px;
}
#pageProfile .profile-msg--user .profile-text {
  background: rgba(255,255,255,0.4); backdrop-filter: blur(20px);
  border: 1px solid rgba(165,180,188,0.1); box-shadow: 0 2px 12px rgba(0,0,0,0.02);
  padding: 18px 28px; border-radius: 2rem; border-top-right-radius: 0;
  font-size: 16px; font-weight: 500; color: #4e525d; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; max-width: 520px; width: fit-content;
}
#pageProfile .profile-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
}
#pageProfile .profile-avatar--ai { background: #5a5e6a; }
#pageProfile .profile-avatar--user { background: #eef5f9; }

.typing-dots { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #90A4AE; animation: typingBounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* Script card within chat */
.script-card {
  transition: box-shadow 0.3s;
}
.script-card:hover {
  box-shadow: 0 8px 40px rgba(11,19,32,0.06);
}

/* ============================================================
   Style Bible sidebar sections
   ============================================================ */
.sb-section {
  padding-bottom: 1.5rem;
}
.sb-section + .sb-section {
  border-top: 1px solid rgba(207,216,220,0.6);
  padding-top: 1.5rem;
}
.sb-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.15em;
  text-transform: uppercase; color: #0B1320;
  margin-bottom: 0.75rem;
}
.sb-field-hint {
  font-size: 9px;
  font-weight: 500;
  color: #90A4AE;
  letter-spacing: 0.05em;
  text-transform: none;
  margin-left: 4px;
}
.sb-editable {
  position: relative;
  display: inline-block;
  cursor: pointer;
  padding: 2px 22px 2px 6px;
  margin: -2px -2px -2px -6px;
  border-radius: 6px;
  transition: background-color 0.18s ease;
}
.sb-editable:hover {
  background-color: rgba(44, 62, 80, 0.06);
}
.sb-editable .sb-edit-icon {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #90A4AE;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sb-editable:hover .sb-edit-icon {
  opacity: 1;
}
.sb-edit-placeholder {
  color: #CFD8DC;
  font-style: italic;
  font-size: 0.9em;
}
.sb-editable-sm {
  font-size: inherit;
}

/* ── Style Bible entrance animation ── */
@keyframes sb-card-slide {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes sb-section-rise {
  from { transform: translateY(18px); opacity: 0; filter: blur(4px); }
  to   { transform: translateY(0);    opacity: 1; filter: blur(0); }
}
@keyframes sb-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.sb-entrance {
  animation: sb-card-slide 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sb-entrance .sb-section {
  opacity: 0;
  animation: sb-section-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#styleBiblePreview { position: relative; }
.sb-entrance #styleBiblePreview::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(124,138,255,0.06) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: sb-shimmer 1.8s ease-out 0.3s both;
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

/* ── Extract progress bar pulse ── */
@keyframes extract-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@keyframes extract-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.extract-bar-pulse {
  animation: extract-pulse 1.8s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    var(--md-sys-color-primary, #5b6abf) 0%,
    rgba(124,138,255,0.6) 50%,
    var(--md-sys-color-primary, #5b6abf) 100%
  ) !important;
  background-size: 200% 100%;
  animation: extract-shimmer 2s ease-in-out infinite, extract-pulse 1.8s ease-in-out infinite;
}

/* ── Asset cards entrance animation ── */
@keyframes asset-fade-up {
  from { transform: translateY(24px); opacity: 0; filter: blur(3px); }
  to   { transform: translateY(0);    opacity: 1; filter: blur(0); }
}
@keyframes asset-section-slide {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.asset-cards-entrance > section {
  opacity: 0;
  animation: asset-section-slide 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.asset-cards-entrance > section:nth-child(1) { animation-delay: 0.08s; }
.asset-cards-entrance > section:nth-child(2) { animation-delay: 0.22s; }
.asset-cards-entrance > section:nth-child(3) { animation-delay: 0.36s; }

.asset-cards-entrance .asset-card {
  opacity: 0;
  animation: asset-fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.asset-cards-entrance .asset-card:nth-child(1)  { animation-delay: 0.15s; }
.asset-cards-entrance .asset-card:nth-child(2)  { animation-delay: 0.22s; }
.asset-cards-entrance .asset-card:nth-child(3)  { animation-delay: 0.29s; }
.asset-cards-entrance .asset-card:nth-child(4)  { animation-delay: 0.36s; }
.asset-cards-entrance .asset-card:nth-child(5)  { animation-delay: 0.43s; }
.asset-cards-entrance .asset-card:nth-child(6)  { animation-delay: 0.50s; }
.asset-cards-entrance .asset-card:nth-child(7)  { animation-delay: 0.57s; }
.asset-cards-entrance .asset-card:nth-child(8)  { animation-delay: 0.64s; }
.asset-cards-entrance .asset-card:nth-child(9)  { animation-delay: 0.71s; }
.asset-cards-entrance .asset-card:nth-child(10) { animation-delay: 0.78s; }
.asset-cards-entrance .asset-card:nth-child(n+11) { animation-delay: 0.85s; }

/* ============================================================
   Shot cards — grid row layout (rendered by renderShotList)
   ============================================================ */
textarea.sc-visual,
textarea.sc-visual:focus {
  background: transparent; border: none; outline: none;
  box-shadow: none; padding: 0; min-height: unset;
  font-size: 0.875rem; line-height: 1.625; color: var(--text);
  resize: none;
}

/* ============================================================
   Storyboard cards (rendered by renderImageGrid)
   ============================================================ */
.sb-sheet-image {
  position: relative; width: 100%; min-height: 120px;
  background: white; border-radius: 0.5rem; overflow: hidden;
}
.sb-sheet-image img { width: 100%; display: block; }
.sb-sheet-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(236,239,241,0.92); z-index: 2; gap: 10px;
  backdrop-filter: blur(4px);
}
.sb-sheet-loading[hidden] { display: none; }
.sb-sheet-loading .tc-spinner { width: 24px; height: 24px; border-width: 2px; }
.sb-sheet-loading span { font-size: 12px; color: #0B1320; font-weight: 600; }
.sb-sheet-error {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,247,246,0.95); z-index: 2;
  font-size: 12px; color: #9f403d; padding: 16px; text-align: center; word-break: break-word;
}
.sb-sheet-error[hidden] { display: none; }

/* ============================================================
   Prompt preview cards (rendered by renderPromptPreviewList)
   ============================================================ */
.prompt-preview-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px; position: relative;
  transition: all 0.3s; box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.prompt-preview-card:hover { box-shadow: 0 4px 24px rgba(11,19,32,0.06); }
.prompt-preview-card.is-done { border-color: var(--green); }
.prompt-preview-card.is-err  { border-color: #9f403d; }
.prompt-preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prompt-preview-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.prompt-preview-scene { font-size: 14px; font-weight: 700; color: #0B1320; }
.prompt-preview-status { margin-left: auto; font-size: 11px; color: var(--text-dim); font-weight: 600; }
.prompt-preview-status.ok   { color: var(--green); }
.prompt-preview-status.err  { color: #9f403d; }
.prompt-preview-status.wait { color: var(--accent); }
.prompt-preview-desc {
  font-size: 13px; color: var(--text-dim); margin-bottom: 10px; line-height: 1.6;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.prompt-preview-prompt {
  background: var(--surface-low); border-radius: 12px; padding: 12px 16px;
  font-size: 13px; color: #2C3E50; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  min-height: 24px; max-height: 140px; overflow-y: auto;
}
.prompt-preview-prompt:empty::before { content: "等待生成"; color: #90A4AE; }
.prompt-preview-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ============================================================
   Video prompt cards (rendered by renderVideoPromptList)
   ============================================================ */
.vp-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; overflow: hidden;
  transition: all 0.3s; box-shadow: 0 0 60px rgba(11,19,32,0.02);
}
.vp-card:hover { box-shadow: 0 6px 30px rgba(11,19,32,0.06); }
.vp-card.is-done { border-color: var(--green); }
.vp-card.is-err  { border-color: #9f403d; }
.vp-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid rgba(144,164,174,0.1);
}
.vp-card-body { padding: 16px 20px; }
.vp-card-thumb--wide {
  width: 100%; height: auto; border-radius: 12px;
  background: var(--surface-low); overflow: hidden; position: relative; margin-bottom: 12px;
}
.vp-card-thumb--wide img { width: 100%; display: block; opacity: 0.85; }
.vp-card-thumb--wide .vp-no-img {
  padding: 28px; text-align: center; color: #90A4AE; font-size: 12px;
}
.vp-card-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.vp-card-scene { font-size: 14px; font-weight: 700; color: #0B1320; }
.vp-card-status { margin-left: auto; font-size: 11px; font-weight: 700; }
.vp-card-status.ok   { color: var(--green); }
.vp-card-status.err  { color: #9f403d; }
.vp-card-status.wait { color: var(--accent); }
.vp-card-tag {
  display: inline-block; padding: 3px 10px; border-radius: 2rem;
  font-size: 10px; font-weight: 700;
}
.vp-card-tag--dur  { background: rgba(46,125,50,0.1); color: #2e7d32; }
.vp-shots-breakdown {
  background: var(--surface-low); border-radius: 12px; padding: 12px 16px;
}
.vp-shots-title {
  font-size: 10px; font-weight: 800; color: var(--text-dim);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em;
}
.vp-shot-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid rgba(144,164,174,0.1); font-size: 12px;
}
.vp-shot-row:last-child { border-bottom: none; }
.vp-shot-time { font-family: var(--font-mono); color: #2e7d32; font-weight: 700; min-width: 56px; flex-shrink: 0; }
.vp-panel-tag {
  background: var(--accent-soft); color: var(--accent);
  font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.vp-shot-type { color: #7c3aed; font-weight: 700; flex-shrink: 0; }
.vp-shot-cam { color: #0B1320; flex-shrink: 0; }
.vp-shot-visual {
  color: var(--text-dim); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vp-card-prompt-area { padding: 0 20px 16px; }
.vp-card-prompt-label {
  font-size: 11px; color: var(--text-dim); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px; font-weight: 700;
}
.vp-card-prompt-label .vp-tag-video {
  font-size: 9px; padding: 2px 8px; border-radius: 2rem;
  background: rgba(159,64,61,0.1); color: #9f403d; font-weight: 700;
}
.vp-card-prompt {
  background: var(--surface-low); border-radius: 12px; padding: 14px 16px;
  font-size: 13px; color: #2C3E50; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  min-height: 40px; max-height: 180px; overflow-y: auto;
}
.vp-card-prompt:empty::before { content: "等待生成"; color: #90A4AE; }
.vp-card-actions { padding: 0 20px 16px; display: flex; gap: 8px; }
.vp-btn-del { color: #9f403d !important; }

/* ============================================================
   Asset cards (rendered by renderAssetGrid with new Tailwind)
   ============================================================ */
.asset-card-loading {
  display: flex; align-items: center; justify-content: center;
  background: rgba(236,239,241,0.9); z-index: 2;
}
.asset-card-loading[hidden] { display: none; }
.asset-card-loading .tc-spinner { width: 20px; height: 20px; border-width: 2px; }
.asset-empty-hint { text-align: center; padding: 24px; color: #90A4AE; font-size: 13px; }

/* ============================================================
   Generic buttons (.btn used by dynamically generated HTML)
   ============================================================ */
.btn {
  border: none; border-radius: 3rem; cursor: pointer;
  font-weight: 700; font-family: inherit; transition: all 0.2s;
}
.btn-primary {
  background: #0B1320; color: #ECEFF1;
  box-shadow: 0 4px 16px rgba(11,19,32,0.15);
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface-low); color: #2C3E50;
  border: 1px solid rgba(144,164,174,0.2);
}
.btn-secondary:hover { background: var(--surface-high); }
.btn-sm { padding: 7px 16px; font-size: 12px; }
.btn-icon {
  background: none; border: none; color: #90A4AE; cursor: pointer;
  font-size: 14px; padding: 4px; border-radius: 50%;
  transition: all 0.2s;
}
.btn-icon:hover { color: #9f403d; background: rgba(159,64,61,0.06); }

/* ============================================================
   Generic form inputs (for dynamic content forms)
   ============================================================ */
.gen-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-dim); text-align: center; }

/* ============================================================
   Task cards (video generation — rendered by main.js)
   ============================================================ */
.task-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px;
  transition: all 0.3s; box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.task-card:hover { box-shadow: 0 4px 24px rgba(11,19,32,0.05); }
.task-card.is-active { border-color: #0B1320; box-shadow: 0 0 0 2px var(--accent-soft); }
.tc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tc-badge {
  flex-shrink: 0; padding: 3px 12px; border-radius: 2rem;
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.tc-badge--submit, .tc-badge--polling { background: var(--accent-soft); color: #0B1320; }
.tc-badge--preparing { background: rgba(124,138,255,0.12); color: #5b6abf; }
.tc-badge--submitting { background: var(--accent-soft); color: #0B1320; }
.tc-badge--fetching { background: var(--green-soft); color: #2e7d32; }
.tc-badge--done { background: var(--green-soft); color: #2e7d32; }
.tc-badge--failed, .tc-badge--timeout { background: rgba(159,64,61,0.1); color: #9f403d; }
.tc-time { font-size: 10px; color: #90A4AE; margin-left: auto; flex-shrink: 0; }
.tc-prompt {
  margin: 0 0 10px; font-size: 13px; color: var(--text-dim); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.tc-preview {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #0B1320; width: 100%; padding-top: 56.25%;
}
.tc-busy {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: #0B1320; z-index: 2;
}
.tc-busy[hidden] { display: none; }
.tc-busy::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(11,19,32,0.12) 0%, transparent 65%);
  animation: tc-glow 3s ease-in-out infinite;
}
@keyframes tc-glow { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.tc-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(11,19,32,0.2); border-top-color: #0B1320;
  border-radius: 50%; animation: tc-spin 0.9s linear infinite; position: relative; z-index: 3;
}
@keyframes tc-spin { to { transform: rotate(360deg); } }
.tc-busy-text { position: relative; z-index: 3; margin-top: 10px; font-size: 12px; color: #90A4AE; }
.tc-video-wrap { position: absolute; inset: 0; }
.tc-video-wrap[hidden] { display: none; }
.tc-video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tc-play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.25); z-index: 4; cursor: pointer;
}
.tc-play-overlay[hidden] { display: none; }
.tc-play-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.9); color: #0B1320;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; padding-left: 3px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15); transition: transform 0.15s;
}
.tc-play-overlay:hover .tc-play-btn { transform: scale(1.1); background: #fff; }
.tc-video-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(236,239,241,0.95); z-index: 6;
}
.tc-video-loading[hidden] { display: none; }
.tc-loading-text { margin-top: 8px; font-size: 12px; color: #0B1320; }
.tc-failed {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(255,247,246,0.95); z-index: 2;
}
.tc-failed[hidden] { display: none; }
.tc-failed-text { font-size: 12px; color: #9f403d; text-align: center; padding: 0 16px; line-height: 1.6; max-width: 90%; word-break: break-word; }
.tc-failed-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: center; }
.tc-failed-btn {
  padding: 7px 16px; border: 1px solid rgba(159,64,61,0.2);
  border-radius: 2rem; background: rgba(159,64,61,0.06); color: #9f403d; font-size: 11px; cursor: pointer;
}
.tc-failed-btn--recover { border-color: #1a73e8; background: rgba(26,115,232,0.08); color: #1a73e8; font-weight: 700; }
.tc-failed-btn--recover:hover { background: rgba(26,115,232,0.18); }
.tc-failed-btn--retry { border-color: #0B1320; background: var(--accent-soft); color: #0B1320; font-weight: 700; }
.tc-failed-btn--retry:hover { background: rgba(11,19,32,0.2); }
.tc-actions { display: flex; gap: 8px; margin-top: 10px; }
.tc-actions[hidden] { display: none; }
.tc-btn {
  flex: 1; padding: 8px 6px; border: 1px solid rgba(144,164,174,0.2); border-radius: 2rem;
  background: #fff; color: var(--text); font-size: 11px; cursor: pointer; font-family: inherit;
  text-align: center; white-space: nowrap; transition: all 0.2s;
}
.tc-btn:hover { border-color: #0B1320; }
.tc-btn--accent { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.tasks-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px; text-align: center;
}
.tasks-empty[hidden] { display: none; }

/* ============================================================
   Batch generation page
   ============================================================ */
.bc-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; overflow: hidden; transition: all 0.3s;
  box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.bc-card:hover { border-color: #0B1320; box-shadow: 0 4px 20px rgba(11,19,32,0.05); }
.bc-card-top { display: flex; gap: 12px; padding: 14px 16px; }
.bc-thumb {
  width: 100px; height: 56px; flex-shrink: 0; border-radius: 10px;
  overflow: hidden; background: var(--surface-high);
}
.bc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bc-no-img { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #90A4AE; font-size: 10px; }
.bc-info { flex: 1; min-width: 0; }
.bc-head { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.bc-dur { font-size: 10px; font-weight: 800; color: #0B1320; background: var(--accent-soft); padding: 3px 10px; border-radius: 2rem; }
.bc-refs { font-size: 10px; color: var(--text-dim); }
.bc-shots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bc-shot-tag { font-size: 9px; color: #0B1320; background: var(--accent-soft); padding: 2px 8px; border-radius: 2rem; white-space: nowrap; }
.bc-prompt {
  font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bc-card-actions { padding: 0 16px 14px; display: flex; gap: 8px; align-items: center; }
.bc-regen-btn {
  font-size: 11px; padding: 6px 16px; border-radius: 2rem;
  background: #0B1320; color: #fff; border: none; cursor: pointer; font-weight: 700;
}
.bc-regen-btn:hover { opacity: 0.85; }
.bc-status { font-size: 10px; padding: 3px 10px; border-radius: 2rem; font-weight: 700; }
.bc-status--fail { color: #9f403d; background: rgba(159,64,61,0.08); }
.bc-status--active { color: #0B1320; background: var(--accent-soft); }
.bc-status--done { color: #2e7d32; background: var(--green-soft); }

/* ============================================================
   Reference frames (video gen page)
   ============================================================ */
.frame-slot { position: relative; min-height: 80px; }
.frame-pick {
  position: absolute; inset: 0; border: 2px dashed rgba(144,164,174,0.3);
  border-radius: 14px; background: var(--surface-low); color: var(--text-dim);
  cursor: pointer; font-size: 18px; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.frame-preview {
  position: absolute; inset: 0; border-radius: 14px;
  background-size: cover; background-position: center;
  border: 2px solid #0B1320; z-index: 2;
}
.frame-clear {
  position: absolute; top: -6px; right: -6px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid rgba(144,164,174,0.2); background: #fff; color: #9f403d;
  cursor: pointer; padding: 0; line-height: 1; font-size: 14px;
}

/* ============================================================
   Config pills and dropdown (video gen page)
   ============================================================ */
.config-pill-btn {
  background: #fff; border: 1px solid rgba(144,164,174,0.2); color: var(--text);
  padding: 8px 16px; border-radius: 2rem; cursor: pointer; font-size: 12px;
  min-width: 100px; text-align: left; transition: all 0.2s;
}
.config-pill-btn:hover, .config-pill-btn.is-open { border-color: #0B1320; }
.dd-panel {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 4px;
  min-width: 130px; max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid rgba(144,164,174,0.2); border-radius: 14px;
  z-index: 50; box-shadow: 0 8px 30px rgba(11,19,32,0.12);
}
.ds-dd-item {
  display: block; width: 100%; padding: 10px 16px;
  border: none; border-bottom: 1px solid rgba(144,164,174,0.1);
  background: transparent; color: var(--text); font-size: 12px; text-align: left; cursor: pointer;
}
.ds-dd-item:last-child { border-bottom: none; }
.ds-dd-item:hover { background: var(--surface-low); }
.ds-dd-item.is-on { color: #0B1320; font-weight: 700; }
.ds-chip {
  flex: 1; padding: 10px; border: 1px solid rgba(144,164,174,0.2); border-radius: 12px;
  background: #fff; color: #90A4AE; font-size: 12px; cursor: pointer; font-weight: 600;
  text-align: center; transition: all 0.2s;
}
.ds-chip.is-on { background: #0B1320; border-color: #0B1320; color: #fff; }

/* ============================================================
   Settings page
   ============================================================ */
.settings-tab {
  padding: 12px 24px; border: none; background: transparent;
  color: var(--text-dim); font-size: 14px; font-weight: 700;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.is-active { color: #0B1320; border-bottom-color: #0B1320; }

.simple-api-card {
  background: white; border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 20px 24px;
  border-left: 4px solid #0B1320; transition: all 0.3s;
  box-shadow: 0 0 40px rgba(11,19,32,0.02);
}
.simple-card-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.simple-card-icon { flex-shrink: 0; margin-top: 2px; }
.simple-card-head-text { flex: 1; min-width: 120px; }
.simple-card-title { font-size: 16px; font-weight: 800; color: #0B1320; margin-bottom: 4px; }
.simple-card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.api-provider-card {
  background: var(--surface-low); border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px;
}
.api-provider-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-provider-name { font-size: 15px; font-weight: 800; color: #0B1320; }
.api-cap-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 3rem; line-height: 1.4;
}
.api-cap-text       { background: rgba(11,19,32,0.1); color: #0B1320; }
.api-cap-multimodal { background: rgba(124,58,237,0.1); color: #7c3aed; }
.api-cap-image      { background: rgba(46,125,50,0.1);  color: #2e7d32; }
.api-cap-video      { background: rgba(159,64,61,0.1);  color: #9f403d; }

.step-card {
  background: var(--surface-low); border: 1px solid rgba(144,164,174,0.15);
  border-radius: 1rem; padding: 16px 20px;
}
.step-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-card-num { font-size: 11px; font-weight: 800; color: #0B1320; background: var(--accent-soft); padding: 3px 12px; border-radius: 2rem; }
.step-card-label { font-size: 15px; font-weight: 800; color: #0B1320; }
.step-card-desc { font-size: 13px; color: var(--text-dim); margin: 8px 0 6px; line-height: 1.6; }
.step-card-rec { font-size: 11px; color: #2e7d32; margin-bottom: 10px; }
.step-card-rec-label { font-weight: 700; }
.step-card-not { color: #9f403d; }
.step-card-fields { display: flex; gap: 10px; align-items: center; }
.step-card-fields select { width: 150px; flex-shrink: 0; }
.step-card-fields input { flex: 1; min-width: 0; }

/* ============================================================
   Project list (dynamically generated)
   ============================================================ */
.plist-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(144,164,174,0.1); gap: 10px;
}
.plist-item:last-child { border-bottom: none; }
.plist-current { background: var(--accent-soft); border-radius: 12px; }
.plist-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.plist-name { font-size: 14px; font-weight: 700; color: #0B1320; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist-date { font-size: 10px; color: #90A4AE; }
.plist-badge { font-size: 10px; color: #0B1320; background: var(--accent-soft); padding: 3px 12px; border-radius: 3rem; font-weight: 700; }

/* ============================================================
   Loading overlays
   ============================================================ */
.loading-overlay {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center;
}
.loading-overlay[hidden] { display: none; }
.loading-overlay .tc-spinner { width: 20px; height: 20px; border-width: 2px; }
.loading-text { font-size: 13px; color: var(--text-dim); }

/* ============================================================
   Overrides for Tailwind form plugin conflicts
   ============================================================ */
[type='text']:focus, [type='url']:focus, [type='password']:focus, textarea:focus, select:focus {
  --tw-ring-color: rgba(11,19,32,0.15);
  border-color: #0B1320;
}

/* ============================================================
   Hide scrollbar but keep scroll functionality
   ============================================================ */
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ============================================================
   Elegant thin scrollbar — visible but minimal
   ============================================================ */
.elegant-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(144,164,174,0.2) transparent;
}
.elegant-scroll:hover {
  scrollbar-color: rgba(144,164,174,0.35) transparent;
}
.elegant-scroll::-webkit-scrollbar { width: 5px; }
.elegant-scroll::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.elegant-scroll::-webkit-scrollbar-thumb {
  background: rgba(144,164,174,0.18);
  border-radius: 10px;
  transition: background 0.2s;
}
.elegant-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(144,164,174,0.4);
}

/* ============================================================
   Pencil texture overlay (for storyboard cards)
   ============================================================ */
.pencil-texture {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.03; pointer-events: none; position: absolute; inset: 0;
}

/* ── Border Glow (adapted from reactbits BorderGlow) ── */
.glow-border-wrap {
  --edge-proximity: 0;
  --cursor-angle: 45deg;
  --edge-sensitivity: 30;
  --color-sensitivity: 50;
  --cone-spread: 25;
  --glow-padding: 40px;
  --card-bg: #0B1320;
  --fill-opacity: 0.5;

  position: relative;
  border-radius: inherit;
  isolation: isolate;
  transform: translate3d(0, 0, 0.01px);
  display: grid;
  border: 1px solid rgb(255 255 255 / 15%);
  background: var(--card-bg);
  overflow: visible;
  box-shadow:
    rgba(0,0,0,0.1) 0 1px 2px,
    rgba(0,0,0,0.1) 0 2px 4px,
    rgba(0,0,0,0.1) 0 4px 8px,
    rgba(0,0,0,0.1) 0 8px 16px;
}

.glow-border-wrap::before,
.glow-border-wrap::after,
.glow-border-wrap > .glow-edge-light {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transition: opacity 0.25s ease-out;
  z-index: -1;
}

.glow-border-wrap:not(:hover):not(.glow-active)::before,
.glow-border-wrap:not(:hover):not(.glow-active)::after,
.glow-border-wrap:not(:hover):not(.glow-active) > .glow-edge-light {
  opacity: 0;
  transition: opacity 0.75s ease-in-out;
}

/* Layer 1: colored mesh-gradient border */
.glow-border-wrap::before {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card-bg) 0 100%) padding-box,
    linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box,
    radial-gradient(at 80% 55%, #c084fc 0px, transparent 50%) border-box,
    radial-gradient(at 69% 34%, #f472b6 0px, transparent 50%) border-box,
    radial-gradient(at 8% 6%,   #38bdf8 0px, transparent 50%) border-box,
    radial-gradient(at 41% 38%, #c084fc 0px, transparent 50%) border-box,
    radial-gradient(at 86% 85%, #f472b6 0px, transparent 50%) border-box,
    radial-gradient(at 82% 18%, #38bdf8 0px, transparent 50%) border-box,
    radial-gradient(at 51% 4%,  #f472b6 0px, transparent 50%) border-box,
    linear-gradient(#c084fc 0 100%) border-box;

  opacity: calc(
    (var(--edge-proximity) - var(--color-sensitivity))
    / (100 - var(--color-sensitivity))
  );

  -webkit-mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black  calc(var(--cone-spread) * 1%),
    transparent calc((var(--cone-spread) + 15) * 1%),
    transparent calc((100 - var(--cone-spread) - 15) * 1%),
    black  calc((100 - var(--cone-spread)) * 1%)
  );
  mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black  calc(var(--cone-spread) * 1%),
    transparent calc((var(--cone-spread) + 15) * 1%),
    transparent calc((100 - var(--cone-spread) - 15) * 1%),
    black  calc((100 - var(--cone-spread)) * 1%)
  );
}

/* Layer 2: colored mesh-gradient background fill near edges */
.glow-border-wrap::after {
  border: 1px solid transparent;
  background:
    radial-gradient(at 80% 55%, #c084fc 0px, transparent 50%) padding-box,
    radial-gradient(at 69% 34%, #f472b6 0px, transparent 50%) padding-box,
    radial-gradient(at 8% 6%,   #38bdf8 0px, transparent 50%) padding-box,
    radial-gradient(at 41% 38%, #c084fc 0px, transparent 50%) padding-box,
    radial-gradient(at 86% 85%, #f472b6 0px, transparent 50%) padding-box,
    radial-gradient(at 82% 18%, #38bdf8 0px, transparent 50%) padding-box,
    radial-gradient(at 51% 4%,  #f472b6 0px, transparent 50%) padding-box,
    linear-gradient(#c084fc 0 100%) padding-box;

  -webkit-mask-image:
    linear-gradient(to bottom, black, black),
    radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%),
    radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%),
    conic-gradient(from var(--cursor-angle) at center, transparent 5%, black 15%, black 85%, transparent 95%);
  mask-image:
    linear-gradient(to bottom, black, black),
    radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%),
    radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%),
    conic-gradient(from var(--cursor-angle) at center, transparent 5%, black 15%, black 85%, transparent 95%);

  -webkit-mask-composite: destination-out, source-over, source-over, source-over, source-over, source-over;
  mask-composite: subtract, add, add, add, add, add;
  opacity: calc(
    var(--fill-opacity) *
    (var(--edge-proximity) - var(--color-sensitivity))
    / (100 - var(--color-sensitivity))
  );
  mix-blend-mode: soft-light;
}

/* Layer 3: outer glow halo */
.glow-border-wrap > .glow-edge-light {
  inset: calc(var(--glow-padding) * -1);
  pointer-events: none;
  z-index: 1;

  -webkit-mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black 2.5%, transparent 10%, transparent 90%, black 97.5%
  );
  mask-image: conic-gradient(
    from var(--cursor-angle) at center,
    black 2.5%, transparent 10%, transparent 90%, black 97.5%
  );

  opacity: calc(
    (var(--edge-proximity) - var(--edge-sensitivity))
    / (100 - var(--edge-sensitivity))
  );
  mix-blend-mode: plus-lighter;
}

.glow-border-wrap > .glow-edge-light::before {
  content: '';
  position: absolute;
  inset: var(--glow-padding);
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px   hsl(40 80% 80% / 100%),
    inset 0 0 1px  0   hsl(40 80% 80% / 60%),
    inset 0 0 3px  0   hsl(40 80% 80% / 50%),
    inset 0 0 6px  0   hsl(40 80% 80% / 40%),
    inset 0 0 15px 0   hsl(40 80% 80% / 30%),
    inset 0 0 25px 2px hsl(40 80% 80% / 20%),
    inset 0 0 50px 2px hsl(40 80% 80% / 10%),
          0 0 1px  0   hsl(40 80% 80% / 60%),
          0 0 3px  0   hsl(40 80% 80% / 50%),
          0 0 6px  0   hsl(40 80% 80% / 40%),
          0 0 15px 0   hsl(40 80% 80% / 30%),
          0 0 25px 2px hsl(40 80% 80% / 20%),
          0 0 50px 2px hsl(40 80% 80% / 10%);
}

/* Inner card */
.glow-border-inner {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: auto;
  z-index: 1;
}

/* Override text colors inside glow cards for dark bg */
.glow-border-inner .ov-step {
  --tw-bg-opacity: 0;
}
.glow-border-inner .ov-step:hover {
  background: rgba(255,255,255,0.06);
}
.glow-border-inner .text-on-surface,
.glow-border-inner .text-on-background {
  color: rgba(255,255,255,0.9) !important;
}
.glow-border-inner .text-on-surface-variant {
  color: rgba(255,255,255,0.5) !important;
}
.glow-border-inner .text-\[\#26353b\] {
  color: rgba(255,255,255,0.9) !important;
}
.glow-border-inner .text-\[\#526168\] {
  color: rgba(255,255,255,0.5) !important;
}
.glow-border-inner .text-\[\#5a5e6a\] {
  color: rgba(255,255,255,0.6) !important;
}
.glow-border-inner .bg-\[\#5a5e6a\]\/10 {
  background: rgba(255,255,255,0.1) !important;
}
.glow-border-inner .bg-white\/60 {
  background: rgba(255,255,255,0.08) !important;
}
.glow-border-inner input.bg-white\/60,
.glow-border-inner input[type="text"] {
  color: rgba(255,255,255,0.85) !important;
  border-color: rgba(255,255,255,0.1) !important;
}
.glow-border-inner input::placeholder {
  color: rgba(255,255,255,0.3) !important;
}

/* ══════ Textarea slim scrollbar ══════ */
.glow-border-inner textarea::-webkit-scrollbar { width: 3px; }
.glow-border-inner textarea::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
.glow-border-inner textarea::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
.glow-border-inner textarea::-webkit-scrollbar-track { background: transparent; }
.glow-border-inner textarea { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }

/* ══════ Edit Action Pill Buttons ══════ */
.edit-action-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 28px 10px 20px;
  border-radius: 999px;
  min-width: 150px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(11, 19, 32, 0.6);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.edit-action-pill:hover:not(:disabled) {
  border-color: var(--pill-accent, #67e8f9);
  box-shadow: 0 0 20px var(--pill-glow, rgba(0,242,255,0.15)), inset 0 0 20px var(--pill-glow, rgba(0,242,255,0.08));
  transform: translateY(-1px);
}
.edit-action-pill:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}
.edit-action-pill:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.edit-action-pill .edit-action-icon {
  transition: transform 0.3s ease;
}
.edit-action-pill:hover:not(:disabled) .edit-action-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px var(--pill-accent, #67e8f9));
}

/* ══════ Edit Action Loading State ══════ */
.edit-action-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 10;
  border-radius: 999px;
  background: rgba(11, 19, 32, 0.88);
  backdrop-filter: blur(8px);
  animation: editLoadFadeIn 0.3s ease-out;
}
@keyframes editLoadFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.edit-action-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--spinner-color, #67e8f9);
  animation: editSpin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes editSpin {
  to { transform: rotate(360deg); }
}
.edit-action-loading .edit-load-text {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.06em;
  white-space: nowrap;
  animation: editLoadPulse 1.8s ease-in-out infinite;
}
.edit-action-loading .edit-load-sub {
  display: none;
}
@keyframes editLoadPulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* ══════ Agent FAB ══════ */
.agent-fab {
  position: fixed;
  right: 4.5rem;
  bottom: 4.5rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #0a0f11;
  color: #f6fafd;
  border: 4px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: agentFloat 4s ease-in-out infinite;
  overflow: hidden;
}
@keyframes agentFloat {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}
.agent-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 14px 50px rgba(0,0,0,0.22);
}
.agent-fab:active { transform: scale(0.90); animation: none; }
.agent-fab-icon { font-size: 30px; position: relative; z-index: 2; }
.agent-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(90,94,106,0.15);
  backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 1;
}
.agent-fab.is-open {
  animation: none;
}
.agent-fab.is-open .agent-fab-icon { display: none; }
.agent-fab.is-open .agent-fab-pulse { display: none; }
.agent-fab.is-open::after {
  content: '✕';
  font-size: 22px;
  font-weight: 300;
  position: relative;
  z-index: 2;
}

/* ══════ Agent Panel ══════ */
.agent-panel {
  position: fixed;
  right: 4.5rem;
  bottom: 8.5rem;
  width: 420px;
  max-height: 70vh;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.12) 100%);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 1.5rem;
  box-shadow: 0 20px 60px rgba(31,38,135,0.08), 0 0 0 1px rgba(255,255,255,0.3) inset;
  z-index: 9997;
  overflow: hidden;
  transform-origin: bottom right;
  animation: agentPanelIn 0.35s ease-out;
}
@keyframes agentPanelIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.agent-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  flex-shrink: 0;
}
.agent-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.agent-panel-body::-webkit-scrollbar { width: 3px; }
.agent-panel-body::-webkit-scrollbar-thumb { background: rgba(144,164,174,0.2); border-radius: 3px; }
.agent-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  flex: 1;
}
.agent-panel-refs {
  padding: 8px 20px;
  border-top: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.agent-panel-input {
  padding: 16px 20px 20px;
  flex-shrink: 0;
}
.agent-input-wrap {
  position: relative;
  background: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.04);
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: background 0.2s, box-shadow 0.2s;
}
.agent-input-wrap:focus-within {
  background: rgba(255,255,255,0.65);
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}
.agent-input-ta {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-size: 13px;
  line-height: 1.6;
  padding: 14px 60px 14px 18px;
  min-height: 52px;
  max-height: 120px;
  color: #26353b;
}
.agent-input-ta:focus { outline: none; box-shadow: none; }
.agent-input-ta::placeholder { color: rgba(82,97,104,0.4); }
.agent-send-btn {
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #0a0f11;
  color: #f6fafd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.agent-send-btn:hover { transform: scale(1.05); }
.agent-send-btn:active { transform: scale(0.92); }
.agent-send-btn:disabled { opacity: 0.3; pointer-events: none; }

/* Agent Messages */
.agent-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}
.agent-msg--user { align-items: flex-end; }
.agent-msg--ai { align-items: flex-start; }
.agent-msg-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(82,97,104,0.4);
  padding: 0 4px;
}
.agent-msg-bubble {
  padding: 14px 18px;
  border-radius: 1rem;
  font-size: 13px;
  line-height: 1.7;
  max-width: 90%;
  word-break: break-word;
}
.agent-msg--ai .agent-msg-bubble {
  background: rgba(221,234,241,0.6);
  color: #26353b;
  border: 1px solid rgba(255,255,255,0.4);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.agent-msg--user .agent-msg-bubble {
  background: #5a5e6a;
  color: #f7f7ff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(90,94,106,0.2);
}
.agent-msg-loading {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: rgba(221,234,241,0.6);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 1rem;
  border-top-left-radius: 4px;
}
.agent-msg-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(90,94,106,0.35);
  animation: agentDotBounce 1.2s ease-in-out infinite;
}
.agent-msg-loading span:nth-child(2) { animation-delay: 0.15s; }
.agent-msg-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes agentDotBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Reference Chips */
.agent-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  color: #0B1320;
  background: rgba(207,216,220,0.5);
  border: 1px solid rgba(144,164,174,0.2);
  border-radius: 999px;
  white-space: nowrap;
  cursor: default;
  letter-spacing: 0.02em;
}
.agent-ref-chip .material-symbols-outlined {
  font-size: 12px;
  opacity: 0.5;
}
.agent-ref-chip .agent-ref-close {
  cursor: pointer;
  opacity: 0.4;
  margin-left: 2px;
  font-size: 12px;
}
.agent-ref-chip .agent-ref-close:hover { opacity: 1; }

/* Action Cards */
.agent-action-card {
  border: 1px solid rgba(144,164,174,0.2);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.7);
  margin-top: 4px;
}
.agent-action-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.agent-action-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #2C3E50;
  background: rgba(207,216,220,0.4);
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.agent-action-preview {
  font-size: 12px;
  color: #2C3E50;
  line-height: 1.6;
  background: rgba(236,239,241,0.5);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  max-height: 80px;
  overflow-y: auto;
}
.agent-action-btns {
  display: flex;
  gap: 6px;
}
.agent-action-btns button {
  padding: 5px 14px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.agent-action-apply {
  background: #0B1320;
  color: #ECEFF1;
}
.agent-action-apply:hover { opacity: 0.85; }
.agent-action-skip {
  background: rgba(207,216,220,0.4);
  color: #2C3E50;
}
.agent-action-skip:hover { background: rgba(207,216,220,0.6); }

/* Cascade reminder */
.agent-cascade-card {
  border: 1px solid #ffcc80;
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fff8e1, #fff3e0);
}
.agent-cascade-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #e65100;
  margin-bottom: 8px;
}
.agent-cascade-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #2C3E50;
  padding: 4px 0;
}
.agent-cascade-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  accent-color: #e65100;
}
.agent-cascade-btns {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.agent-cascade-btns button {
  padding: 5px 14px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.agent-cascade-regen {
  background: #e65100;
  color: white;
}
.agent-cascade-later {
  background: rgba(255,204,128,0.4);
  color: #e65100;
}

/* Card reference hover hint */
.agent-refable {
  position: relative;
}
.agent-refable::after {
  content: '@';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(11,19,32,0.7);
  color: white;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 5;
}
.agent-refable:hover::after {
  opacity: 0.6;
}

/* ── Stale / outdated indicators ── */
.stale-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 9px;
  font-weight: 700;
  color: #e65100;
  background: #fff3e0;
  border: 1px solid #ffcc80;
  border-radius: 999px;
  letter-spacing: 0.03em;
  vertical-align: middle;
  animation: stalePulse 2s ease-in-out infinite;
}
@keyframes stalePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.stale-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #e65100;
  background: linear-gradient(90deg, #fff3e0, #ffe0b2);
  border-bottom: 1px solid #ffcc80;
  border-radius: 12px 12px 0 0;
}
/* ── Script Library Panel ── */
.script-lib-panel {
  position: absolute;
  display: flex; flex-direction: column;
  z-index: 20;
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.script-lib--collapsed {
  width: auto; height: auto; max-height: none;
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  border-radius: 0 14px 14px 0;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 4px 0 16px rgba(0,0,0,0.06), 0 0 0 1px rgba(255,255,255,0.4) inset;
  border: none; padding: 0;
}
.script-lib--collapsed .script-lib-expanded { display: none; }
.script-lib--collapsed .script-lib-collapsed-strip { display: flex; }
.script-lib--expanded {
  width: 353px; max-height: 1060px; height: 80vh;
  left: 0; top: 50%; transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(246,250,253,0.92) 0%, rgba(238,245,249,0.82) 100%);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border-right: 1px solid rgba(255,255,255,0.25);
  border-radius: 0 1.5rem 1.5rem 0;
  box-shadow: 6px 0 40px rgba(90,94,106,0.06);
}
.script-lib--expanded .script-lib-expanded {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
.script-lib--expanded .script-lib-collapsed-strip { display: none; }

.script-lib-collapsed-strip {
  display: none;
  flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; cursor: pointer;
  color: rgba(82,97,104,0.6); transition: all 0.2s;
  writing-mode: horizontal-tb;
}
.script-lib-collapsed-strip:hover { color: #5a5e6a; background: rgba(255,255,255,0.9); border-radius: 0 14px 14px 0; }
.script-lib-badge {
  font-size: 9px; font-weight: 800;
  background: #5a5e6a; color: #fff;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.script-lib-header {
  padding: 24px 20px 6px; flex-shrink: 0;
}
.script-lib-actions { padding: 16px 16px 12px; flex-shrink: 0; }
.script-lib-upload-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px 16px;
  border: none; border-radius: 9999px;
  background: #0B1320; color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(11,19,32,0.12);
}
.script-lib-upload-btn:hover {
  background: #1a2a3d;
  box-shadow: 0 6px 24px rgba(11,19,32,0.18);
  transform: translateY(-1px);
}
.script-lib-upload-btn:active { transform: scale(0.97); }

.script-lib-subtitle {
  font-size: 10px; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; color: rgba(82,97,104,0.5);
  padding: 8px 20px 10px;
}

.script-lib-list {
  flex: 1; overflow-y: auto; padding: 0 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.script-lib-list::-webkit-scrollbar { display: none; }

.script-lib-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 6px 4px; border-radius: 12px; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.script-lib-item:hover { background: rgba(255,255,255,0.5); }
.script-lib-item.is-active { background: rgba(255,255,255,0.7); }

.script-lib-item-thumb {
  width: 36px; height: 46px; border-radius: 8px; flex-shrink: 0;
  background: #fff; border: 1px solid rgba(165,180,188,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  overflow: hidden; position: relative;
}
.script-lib-item-thumb-bar {
  width: 100%; height: 3px;
}
.script-lib-item-thumb-bar--upload { background: #5a5e6a; }
.script-lib-item-thumb-bar--generated { background: #7b1fa2; opacity: 0.4; }
.script-lib-item-thumb-bar--episode { background: #2e7d32; opacity: 0.4; }

.script-lib-item-info { flex: 1; min-width: 0; padding-top: 2px; }
.script-lib-item-name {
  font-size: 13px; font-weight: 600; color: #26353b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.2s;
}
.script-lib-item:hover .script-lib-item-name { color: #5a5e6a; }
.script-lib-item-date {
  font-size: 10px; color: rgba(82,97,104,0.45); margin-top: 3px;
}
.script-lib-item-actions {
  display: flex; gap: 1px; position: absolute; right: 4px; top: 6px;
  opacity: 0; transition: opacity 0.15s;
}
.script-lib-item:hover .script-lib-item-actions { opacity: 1; }
.script-lib-item-btn {
  width: 22px; height: 22px; border-radius: 8px; border: none;
  background: transparent; color: rgba(82,97,104,0.4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.script-lib-item-btn:hover { background: rgba(0,0,0,0.05); color: #5a5e6a; }

.upstream-stale-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  color: #bf360c;
  background: linear-gradient(135deg, #fff3e0, #ffe0b244);
  border: 1px solid #ffcc80;
  border-radius: 12px;
  margin-bottom: 12px;
}
.upstream-stale-banner .material-symbols-outlined { font-size: 18px; color: #e65100; }
.prompt-preview-status.stale-warn {
  color: #e65100;
  background: #fff3e0;
  border-color: #ffcc80;
}

/* ═══════════════════════════════════════════
   Auto Edit Studio
   ═══════════════════════════════════════════ */

/* dark frosted-glass base — organic asymmetric radius from stitch(17), dark-adapted */
.edit-glass-panel {
  background: linear-gradient(180deg, rgba(40, 44, 52, 0.55) 0%, rgba(30, 33, 40, 0.45) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 40px 10px 40px 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

/* scanline overlay for preview monitor */
.edit-scanlines {
  background: linear-gradient(to bottom, rgba(11,19,32,0) 50%, rgba(11,19,32,0.03) 50%);
  background-size: 100% 4px;
  pointer-events: none;
}

/* neural grid pattern for panels */
.edit-neural-grid {
  background-image: radial-gradient(rgba(144,164,174,0.06) 1px, transparent 1px);
  background-size: 12px 12px;
}

/* halftone texture button */
.edit-halftone-btn {
  position: relative; overflow: hidden;
}
.edit-halftone-btn::after {
  content: '';
  position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(0,242,255,0.08) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.3s;
}
.edit-halftone-btn:hover::after { opacity: 1; }

/* playhead red pulse glow */
@keyframes playhead-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,59,48,0.5); }
  50% { box-shadow: 0 0 20px rgba(255,59,48,0.8); }
}
.edit-playhead-glow { animation: playhead-pulse 2s infinite ease-in-out; }

/* hairline accent — top edge only for glass containers */
.edit-hairline-top { border-top: 0.5px solid rgba(144,164,174,0.15); }

/* label font utility */
.edit-label {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13px; font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

/* headline font utility */
.edit-headline {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 500; letter-spacing: -0.02em;
}

/* hide scrollbar utility */
.edit-hide-scrollbar::-webkit-scrollbar { display: none; }
.edit-hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Timeline thin scrollbar — both axes */
#editTimelineScroll::-webkit-scrollbar { width: 4px; height: 4px; }
#editTimelineScroll::-webkit-scrollbar-track { background: transparent; }
#editTimelineScroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12); border-radius: 4px;
}
#editTimelineScroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}
#editTimelineScroll::-webkit-scrollbar-corner { background: transparent; }
#editTimelineScroll { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }
/* segment block — stitch(17) style */
.edit-segment-block {
  flex-shrink: 0; height: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px; overflow: hidden;
  cursor: pointer; position: relative;
  background: rgba(30,42,58,0.75);
  transition: all 0.2s;
}
.edit-segment-block:hover {
  background: rgba(35,48,65,0.85);
}
.edit-segment-block.edit-seg-active {
  box-shadow: 0 0 0 1px rgba(0,242,255,0.4), 0 4px 16px rgba(0,242,255,0.1);
  border-color: rgba(0,242,255,0.3);
}

/* color bar — top accent line */
.edit-seg-color-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px; z-index: 5;
}
.edit-seg-color-bar::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px; background: rgba(0,242,255,0.3);
}

/* filmstrip (fills block background) */
.edit-seg-filmstrip {
  position: absolute; top: 3px; left: 0; right: 0; bottom: 20px;
  display: flex; overflow: hidden;
}
.edit-filmstrip-frame {
  height: 100%; flex-shrink: 0;
  object-fit: cover; opacity: 0.7;
}

/* info overlay on top of filmstrip */
.edit-seg-overlay {
  position: absolute; top: 3px; left: 0; right: 0;
  display: flex; align-items: center; gap: 4px;
  padding: 3px 6px; z-index: 4;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}
.edit-seg-label {
  font-size: 14px; font-weight: 800;
  color: rgba(255,255,255,0.9);
}
.edit-seg-emotion {
  font-size: 12px; color: rgba(255,255,255,0.5);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex: 1;
}
.edit-seg-dur {
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

/* waveform canvas */
.edit-seg-waveform {
  position: absolute; bottom: 0; left: 0;
  height: 20px; z-index: 3;
  pointer-events: none;
}

/* trim handles */
.edit-trim-handle {
  position: absolute; top: 0; bottom: 0;
  width: 6px; z-index: 10;
  cursor: col-resize;
  transition: background 0.15s;
}
.edit-trim-handle:hover,
.edit-trim-handle:active {
  background: rgba(255,255,255,0.6);
}
.edit-trim-left { left: 0; border-radius: 6px 0 0 6px; }
.edit-trim-right { right: 0; border-radius: 0 6px 6px 0; }
.edit-trim-handle::after {
  content: ""; position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 16px;
  background: rgba(255,255,255,0.4);
  border-radius: 1px;
}
.edit-trim-handle:hover::after,
.edit-trim-handle:active::after {
  background: #fff;
  height: 20px;
}

/* transition marker */
.edit-transition-marker {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 800;
  color: rgba(0,242,255,0.3);
  border: 1px dashed rgba(0,242,255,0.2);
  border-radius: 50%; cursor: pointer;
  margin: auto 2px; transition: all 0.2s;
}
.edit-transition-marker:hover {
  background: rgba(0,242,255,0.06);
  color: rgba(0,242,255,0.7);
}

/* time ruler */
.edit-ruler {
  display: block; height: 24px;
  margin-bottom: 2px;
}

/* preloaded video pool */
.edit-pool-video {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain; border-radius: 8px;
  display: none; background: #000;
}

/* BGM track block */
.edit-bgm-block {
  display: flex; align-items: center; gap: 4px;
  height: 100%; padding: 0 8px;
  background: linear-gradient(135deg, #7c3aed30, #6d28d930);
  border: 1px solid #7c3aed40;
  border-radius: 6px; cursor: grab;
  color: #7c3aed; font-size: 10px;
  white-space: nowrap; overflow: hidden;
}
.edit-bgm-block:active { cursor: grabbing; }

/* tag card in right panel — Phase style */
.edit-tag-card {
  padding: 8px 10px; border-radius: 0;
  background: rgba(255,255,255,0.02);
  border: none;
  border-left: 2px solid rgba(144,164,174,0.10);
  font-size: 11px;
  transition: border-color 0.3s;
}
.edit-tag-card:hover { border-left-color: rgba(144,164,174,0.5); }
.edit-tag-card p,
.edit-tag-card .text-on-surface-variant\/70 { color: rgba(207,216,220,0.7) !important; }
.edit-tag-card .text-on-surface-variant\/50,
.edit-tag-card .text-on-surface-variant\/40 { color: rgba(144,164,174,0.6) !important; }
.edit-tag-card .bg-surface-container { background: rgba(255,255,255,0.08) !important; color: rgba(207,216,220,0.6) !important; }

/* ── Media library panel ── */
.edit-media-tab {
  padding: 6px 14px; border-radius: 9999px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(144,164,174,0.5); cursor: pointer;
  border: 1px solid transparent; background: none;
  transition: all 0.2s;
}
.edit-media-tab:hover { color: rgba(207,216,220,0.7); }
.edit-media-tab--active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(144,164,174,0.12);
  color: rgba(207,216,220,0.9);
}

.edit-media-card {
  position: relative; border-radius: 20px;
  overflow: hidden; cursor: grab;
  border: 1px solid rgba(144,164,174,0.08);
  background: rgba(255,255,255,0.03);
  transition: all 0.5s;
}
.edit-media-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  border-color: rgba(144,164,174,0.15);
}
.edit-media-card:active { cursor: grabbing; }
.edit-media-card img,
.edit-media-card video {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover; display: block;
  filter: grayscale(1); opacity: 0.6;
  transition: all 0.7s;
}
.edit-media-card:hover img,
.edit-media-card:hover video {
  filter: grayscale(0); opacity: 1;
}
.edit-media-card-info {
  padding: 4px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.edit-media-card-name {
  font-size: 11px; font-weight: 500;
  font-family: 'Space Grotesk', monospace;
  color: rgba(144,164,174,0.6);
  text-transform: uppercase; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; flex: 1;
}
.edit-media-card-dur {
  font-size: 11px; font-weight: 500;
  font-family: monospace;
  color: rgba(144,164,174,0.6); flex-shrink: 0;
  margin-left: 4px;
}
.edit-media-card-delete {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 12px; cursor: pointer; opacity: 0;
  transition: opacity 0.15s;
}
.edit-media-card:hover .edit-media-card-delete { opacity: 1; }

/* ── Streaming wave animation ── */
@keyframes sw-cursor {
  0%, 100% { opacity: 0.1; transform: scaleY(0.7); }
  50%      { opacity: 0.85; transform: scaleY(1.1); }
}
@keyframes sw-flow {
  0%   { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}
@keyframes sw-border-glow {
  0%, 100% { border-image-source: linear-gradient(90deg, transparent, rgba(124,138,255,0.15), transparent); }
  50%      { border-image-source: linear-gradient(90deg, transparent, rgba(124,138,255,0.45), transparent); }
}

.streaming-wave {
  position: relative;
}
.streaming-wave::after {
  content: '▍';
  display: inline;
  color: #7c8aff;
  font-weight: 100;
  vertical-align: baseline;
  margin-left: 1px;
  animation: sw-cursor 1.2s ease-in-out infinite;
}
.streaming-wave::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    rgba(124,138,255,0.25),
    rgba(139,157,255,0.7),
    rgba(124,138,255,0.25),
    transparent
  );
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: sw-flow 2s ease-in-out infinite;
  pointer-events: none;
  border-radius: 2px;
}

/* ═══════════ 情绪标签可视化 ═══════════ */
.emotion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.emotion-badge--1 { background: #FDE8E8; color: #7C2D2D; }
.emotion-badge--2 { background: #F9BFBF; color: #6B1E1E; }
.emotion-badge--3 { background: #F08080; color: #fff; }
.emotion-badge--4 { background: #DC3545; color: #fff; }
.emotion-badge--5 { background: #8B0000; color: #fff; }

.shot-emotion-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  font-size: 0.7rem;
  opacity: 0.85;
}

/* ─── 右侧情绪标尺 ─── */
.emotion-ruler {
  width: 54px;
  min-width: 54px;
  position: relative;
  margin-left: 6px;
  flex-shrink: 0;
}
.emotion-ruler-seg {
  position: absolute;
  right: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: opacity 0.2s;
  cursor: default;
  overflow: hidden;
}
.emotion-ruler-seg:hover {
  opacity: 0.85;
}
.emotion-ruler-seg .er-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  max-height: 100%;
  overflow: hidden;
}
.emotion-ruler-seg .er-intensity {
  font-size: 0.6rem;
  font-weight: 800;
  margin-top: 2px;
  writing-mode: horizontal-tb;
}
.emotion-ruler-seg .er-pacing {
  font-size: 0.5rem;
  font-weight: 500;
  opacity: 0.8;
  writing-mode: horizontal-tb;
}
.emotion-ruler-seg[data-intensity="1"] { background: #FDE8E8; color: #7C2D2D; }
.emotion-ruler-seg[data-intensity="2"] { background: #F9BFBF; color: #6B1E1E; }
.emotion-ruler-seg[data-intensity="3"] { background: #F08080; color: #fff; }
.emotion-ruler-seg[data-intensity="4"] { background: #DC3545; color: #fff; }
.emotion-ruler-seg[data-intensity="5"] { background: #8B0000; color: #fff; }

.emotion-ruler-seg--editable { cursor: pointer; }
.emotion-ruler-seg--editable:hover { opacity: 1; outline: 2px solid rgba(11, 19, 32, 0.35); outline-offset: 1px; }
.emotion-ruler-seg .er-edit-icon {
  position: absolute;
  top: 4px;
  right: 2px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.emotion-ruler-seg--editable:hover .er-edit-icon { opacity: 0.75; }
.emotion-ruler-seg .er-peak {
  position: absolute;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FFD600;
  box-shadow: 0 0 0 2px rgba(255, 214, 0, 0.25);
  transform: translateY(-50%);
  pointer-events: none;
}
.emotion-ruler-seg .er-peak[data-peak-intensity="5"] { background: #FF6D00; box-shadow: 0 0 0 2px rgba(255, 109, 0, 0.3); }
.emotion-ruler-seg .er-peak[data-peak-intensity="4"] { background: #FF9100; }

/* Emotion segment editor modal */
.es-editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: es-fade-in 0.18s ease both;
}
@keyframes es-fade-in { from { opacity: 0; } to { opacity: 1; } }
.es-editor-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px 28px;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(11, 19, 32, 0.25);
}
.es-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: #0B1320;
  margin-bottom: 4px;
}
.es-editor-header .material-symbols-outlined { font-size: 20px; color: #2C3E50; }
.es-editor-close {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #90A4AE;
}
.es-editor-close:hover { color: #0B1320; }
.es-editor-hint {
  font-size: 12px;
  color: #E65100;
  background: #FFF3E0;
  border-radius: 8px;
  padding: 6px 10px;
  margin: 6px 0 16px;
}
.es-field { margin-bottom: 14px; }
.es-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2C3E50;
  margin-bottom: 6px;
}
.es-field .es-field-hint {
  font-size: 10px;
  color: #90A4AE;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  margin-left: 6px;
}
.es-field .es-int-val { color: #DC3545; font-weight: 800; }
.es-field select,
.es-field textarea,
.es-field input[type="text"],
.es-field input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #CFD8DC;
  border-radius: 8px;
  font-size: 13px;
  color: #0B1320;
  background: #fff;
  font-family: inherit;
}
.es-field input[type="range"] { width: 100%; }
.es-field textarea { resize: vertical; min-height: 44px; }
.es-peaks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.es-peak-row {
  display: grid;
  grid-template-columns: 72px 62px 58px 1fr 28px;
  gap: 6px;
  align-items: center;
}
.es-peak-row .es-peak-label {
  font-size: 11px;
  font-weight: 700;
  color: #2C3E50;
}
.es-peak-row input {
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #CFD8DC;
  border-radius: 6px;
}
.es-peak-del {
  background: transparent;
  border: 1px solid #CFD8DC;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  color: #90A4AE;
  padding: 0;
  height: 28px;
}
.es-peak-del:hover { background: #FDE8E8; color: #7C2D2D; border-color: #F08080; }
.es-peak-add {
  background: transparent;
  border: 1px dashed #CFD8DC;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #2C3E50;
  cursor: pointer;
  width: 100%;
}
.es-peak-add:hover { border-color: #2C3E50; background: rgba(44, 62, 80, 0.04); }
.es-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.es-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.es-btn--cancel { background: #F5F5F5; color: #2C3E50; border-color: #CFD8DC; }
.es-btn--cancel:hover { background: #ECEFF1; }
.es-btn--save { background: #2C3E50; color: #fff; }
.es-btn--save:hover { background: #0B1320; }

/* 连接线：从标尺指向文本区域 */
.emotion-ruler-seg::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
}

/* ── Skeleton loading placeholders ── */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-surface-container, #e8e8e8) 25%,
    var(--color-surface-container-high, #f0f0f0) 50%,
    var(--color-surface-container, #e8e8e8) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}
.skeleton-text  { height: 14px; margin: 6px 0; }
.skeleton-title { height: 28px; width: 60%; margin: 8px 0; }
.skeleton-card  { height: 80px; }
.skeleton-row   { height: 40px; margin: 4px 0; }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Global task panel ── */
.global-task-panel {
  position: fixed;
  left: 288px;
  bottom: 0;
  width: 380px;
  max-height: 60vh;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(40px);
  border: 1px solid rgba(144,164,174,0.12);
  border-bottom: none;
  border-radius: 1rem 1rem 0 0;
  box-shadow: 0 -8px 40px rgba(11,19,32,0.08);
  z-index: 45;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.25s ease;
}
.global-task-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.global-task-panel-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(144,164,174,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.global-task-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
}
.global-task-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: var(--color-error, #B3261E);
  display: none;
}
.global-task-badge.active { display: inline-block; }
.gtp-card,
.global-task-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s;
  cursor: default;
}
.global-task-card { cursor: pointer; }
.gtp-card:hover,
.global-task-card:hover { background: rgba(0,0,0,0.03); }
.gtp-card + .gtp-card,
.global-task-card + .global-task-card { margin-top: 2px; }
.gtp-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.gtp-dot.preparing { background: #90A4AE; animation: gtpPulse 1.5s infinite; }
.gtp-dot.submitting { background: #FFA726; animation: gtpPulse 1.2s infinite; }
.gtp-dot.pending, .gtp-dot.processing { background: var(--color-primary, #0B1320); animation: gtpPulse 1.2s infinite; }
.gtp-dot.done { background: #66BB6A; }
.gtp-dot.failed { background: var(--color-error, #B3261E); }
@keyframes gtpPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* 任务中心圆形进度环
   - run: pending/polling 时持续旋转的不定式进度（没有上游百分比，做视觉反馈）
   - done/failed: 静态图标
   同时服务 .global-task-card（跨项目 + 本项目）和 .gtp-card（本地视频） */
.gtc-ring {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.gtc-ring svg { display: block; }
.gtc-ring-run svg { animation: gtcSpin 1.1s linear infinite; transform-origin: 50% 50%; }
.gtc-ring-done svg { animation: gtcPop 0.35s ease-out; transform-origin: 50% 50%; }
.gtc-ring-failed svg { animation: gtcShake 0.4s ease-out; transform-origin: 50% 50%; }
@keyframes gtcSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes gtcPop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes gtcShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1.5px); }
  75% { transform: translateX(1.5px); }
}

/* ─── 镜头页两栏 + 剧本映射面板 ─── */
/* 让右侧 sticky 生效的关键：两栏容器必须足够高，否则滚动祖先里
   根本触发不到"贴顶"条件。min-height 给左列撑出滚动空间，右列就能跟。 */
.shots-two-col {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  min-height: calc(100vh - 200px);
}
.shots-left-col {
  flex: 3;
  min-width: 0;
}
.shots-right-col {
  flex: 2;
  position: sticky;
  top: 16px;
  align-self: flex-start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(144,164,174,0.15) transparent;
}
.shots-right-col::-webkit-scrollbar { width: 4px; }
.shots-right-col::-webkit-scrollbar-thumb { background: rgba(144,164,174,0.18); border-radius: 2px; }

/* 剧本对照面板：和右侧资产卡一致的毛玻璃风格，文字改深色保证可读。 */
.script-ref-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(144, 164, 174, 0.18);
  box-shadow: 0 4px 24px rgba(11, 19, 32, 0.06);
  border-radius: 16px;
  padding: 20px;
}
.script-ref-body {
  font-size: 13px;
  line-height: 1.9;
  color: #2C3E50;
}
.script-ref-body .sr-para {
  padding: 5px 10px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  margin-bottom: 4px;
}
.script-ref-body .sr-para.script-ref-active {
  background: rgba(11, 19, 32, 0.06);
  border-left-color: #0B1320;
  color: #0B1320;
  font-weight: 500;
}
.script-ref-body .sr-para.script-ref-dim {
  opacity: 0.45;
  color: #90A4AE;
}

/* ─── Toast 排队容器 ─── */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-height: 80vh;
  overflow: hidden;
}
.toast-container > * {
  pointer-events: auto;
}
.toast-item {
  opacity: 0;
  transform: translateY(-12px) scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.35s ease;
  max-height: 200px;
}
.toast-item.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast-item.toast-hiding {
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  overflow: hidden;
}

/* ── Maintenance banner ── */
.maintenance-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  background: linear-gradient(90deg, #fde68a 0%, #fbbf24 50%, #fde68a 100%);
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  animation: mbSlideIn 320ms ease-out;
}
.maintenance-banner[hidden] { display: none; }
.maintenance-banner .material-symbols-outlined {
  font-size: 18px;
  color: #b45309;
}
.maintenance-banner .mb-msg {
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.maintenance-banner .mb-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  color: #78350f;
  background: rgba(255,255,255,0.5);
  padding: 2px 8px;
  border-radius: 999px;
}
.maintenance-banner.mb-urgent {
  background: linear-gradient(90deg, #fecaca 0%, #f87171 50%, #fecaca 100%);
  color: #7f1d1d;
}
.maintenance-banner.mb-urgent .material-symbols-outlined { color: #991b1b; }
.maintenance-banner.mb-urgent .mb-count { color: #7f1d1d; background: rgba(255,255,255,0.6); }
@keyframes mbSlideIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
body.has-maint-banner { padding-top: 42px; }

/* ═══════ Gating Diagnostic Panel（门控诊断折叠块） ═══════ */
.diag-container { width: 100%; }
.diag-container:empty { display: none; }
.diag-block {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  padding: 0;
  overflow: hidden;
  font-size: 12px;
}
.diag-summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.diag-summary::-webkit-details-marker { display: none; }
.diag-summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.2s;
  color: #64748b;
  margin-right: 6px;
}
.diag-block[open] .diag-summary::before { transform: rotate(90deg); }
.diag-summary-count {
  font-size: 10px;
  font-weight: 500;
  color: #64748b;
  background: rgba(100, 116, 139, 0.08);
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0;
}
.diag-body {
  padding: 4px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.diag-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}
.diag-input-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.04);
  font-size: 11px;
}
.diag-input-key { color: #64748b; font-weight: 500; }
.diag-input-val { color: #1e293b; font-weight: 600; text-align: right; word-break: break-all; }
.diag-item {
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  border-left: 3px solid transparent;
}
.diag-activated {
  background: rgba(34, 197, 94, 0.05);
  border-left-color: rgba(34, 197, 94, 0.6);
}
.diag-skipped {
  background: rgba(148, 163, 184, 0.06);
  border-left-color: rgba(148, 163, 184, 0.5);
}
.diag-item-head { font-weight: 600; color: #1e293b; margin-bottom: 2px; }
.diag-skipped .diag-item-head { color: #64748b; }
.diag-item-reason { font-size: 11px; color: #475569; line-height: 1.5; }
.diag-empty {
  font-size: 11px;
  color: #94a3b8;
  padding: 8px 0;
  font-style: italic;
}

/* ============================================================
   套餐卡 Holographic Tilt（订阅弹窗 .plan-card 专用）
   ------------------------------------------------------------
   视觉与结构原型：https://reactbits.dev/components/profile-card
   （ProfileCard.css 的 --pointer-*、sunpillar-*、pc-shine、pc-glare）。
   这里只移植 3 层里的 shine + glare，不再加 pc-behind（与卡片已有的
   .plan-energy-pulse 旋转极光边叠在一起会太"糊"）。

   工作原理（JS 侧见 static/modules/holo_card.js）：
     pointerenter → --card-opacity: 1  + 根据鼠标位置写 --pointer-* / --rotate-*
     pointermove  → rAF 平滑追赶目标坐标
     pointerleave → --card-opacity: 0，angle 归零，rAF 退出省电

   注意事项：
     - shine / glare 两层 pointer-events:none，CTA button 仍可点。
     - 原 .plan-card:hover 的 translateY 在 holo-active 时改成纯 tilt，避免
       translate3d 和 perspective 打架出现跳帧。
     - 降低运动偏好 (prefers-reduced-motion) 下彻底关掉 tilt 与 shine。
   ============================================================ */
.plan-card {
  --pointer-x: 50%;
  --pointer-y: 50%;
  --pointer-from-center: 0;
  --pointer-from-top: 0.5;
  --pointer-from-left: 0.5;
  --background-x: 50%;
  --background-y: 50%;
  --card-opacity: 0;
  --rotate-x: 0deg;
  --rotate-y: 0deg;
  /* Sunpillar 彩虹，取自 ProfileCard.css 同值 */
  --sunpillar-1: hsl(2, 100%, 73%);
  --sunpillar-2: hsl(53, 100%, 69%);
  --sunpillar-3: hsl(93, 100%, 69%);
  --sunpillar-4: hsl(176, 100%, 76%);
  --sunpillar-5: hsl(228, 100%, 74%);
  --sunpillar-6: hsl(283, 100%, 73%);
  /* 给子层一个 3D 空间；perspective 给自身，避免污染 .billing-plans-grid 布局 */
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(var(--rotate-x)) rotateY(var(--rotate-y));
  will-change: transform;
}
/* 进入 holo 后：hover 的 translateY(-6px) 与 perspective 打架，禁掉；
   但保留 border-color + box-shadow 的 hover 变化（更偏配色）。 */
.plan-card.holo-active:hover {
  transform: perspective(1000px) rotateX(var(--rotate-x)) rotateY(var(--rotate-y));
}

/* 彩虹 shine 层：repeating-linear-gradient 叠上 radial "cold spot"，
   color-dodge 混合让下层深色 #0B1320 透出，只有在 --card-opacity=1 才可见 */
.plan-holo-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
  /* 让位给 .plan-holo-logo（logo-mask 主视觉层），这一层只留低亮度环境虹彩 */
  opacity: calc(var(--card-opacity) * 0.22);
  mix-blend-mode: color-dodge;
  background-image:
    repeating-linear-gradient(
      0deg,
      var(--sunpillar-1) 5%,
      var(--sunpillar-2) 10%,
      var(--sunpillar-3) 15%,
      var(--sunpillar-4) 20%,
      var(--sunpillar-5) 25%,
      var(--sunpillar-6) 30%,
      var(--sunpillar-1) 35%
    ),
    repeating-linear-gradient(
      -45deg,
      #0e152e 0%,
      hsl(180, 20%, 60%) 3.8%,
      hsl(180, 29%, 66%) 4.5%,
      hsl(180, 20%, 60%) 5.2%,
      #0e152e 10%,
      #0e152e 12%
    ),
    radial-gradient(
      farthest-corner circle at var(--pointer-x) var(--pointer-y),
      rgba(0, 0, 0, 0.10) 12%,
      rgba(0, 0, 0, 0.15) 20%,
      rgba(0, 0, 0, 0.25) 120%
    );
  background-position:
    0 var(--background-y),
    var(--background-x) var(--background-y),
    center;
  background-size:
    500% 500%,
    300% 300%,
    200% 200%;
  background-blend-mode: color, hard-light;
  filter: brightness(0.88) contrast(1.22) saturate(1.1);
  transition: opacity 300ms ease;
  animation: plan-holo-drift 22s linear infinite;
}

/* 径向 glare：纯跟随鼠标的冷色高光，overlay 混合 */
.plan-holo-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 4;
  opacity: calc(var(--card-opacity) * 0.32);
  mix-blend-mode: overlay;
  background: radial-gradient(
    farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsl(248, 25%, 85%) 10%,
    hsla(207, 40%, 30%, 0.7) 85%
  );
  filter: brightness(1.1) contrast(1.15);
  transition: opacity 300ms ease;
}

@keyframes plan-holo-drift {
  0%   { background-position: 0 var(--background-y), 0 0, center; }
  100% { background-position: 0 var(--background-y), 90% 90%, center; }
}

/* Reduced motion：保留纯视觉叠色但关掉 tilt / drift 动画 */
@media (prefers-reduced-motion: reduce) {
  .plan-card { transform: none !important; }
  .plan-holo-shine { animation: none !important; }
}

/* ============================================================
   Logo-masked holo 主视觉层（.plan-holo-logo）
   ------------------------------------------------------------
   参考：ProfileCard.css 里 pc-shine 用的 `mask-image: var(--icon);
   mask-mode: luminance` —— 让彩虹材质只在 icon 形状里出现。
   我们用 QIDIAN INFINITY 的 logo（/static/logo.png，已在服务器）做 alpha
   mask：PNG 上有像素的地方 = 显示彩虹，透明的地方 = 裁掉。
   配合下层 .plan-holo-shine 的低亮度环境彩虹，得到 "logo 形状里光流
   涌动、整张卡微微泛虹" 的双层 holographic 观感。

   -- 细节：
     * 彩虹材质和 .plan-holo-shine 一套来源（sunpillar repeating-linear-
       gradient + -45deg 金属条 + 径向 pointer highlight），确保两层色温
       一致，动起来像同一个光源下的不同反射。
     * background-position 跟随 --background-x/--background-y 走，鼠标
       一动，logo 里的光会"流动"。
     * mask-position 保持静态 `50% 28%`，让 logo 浮在卡面上半（价格上方）
       不压到 CTA 区域；浏览器兼容同时给 -webkit- 前缀。
     * mix-blend-mode: color-dodge 让 logo 的深色位图在深卡底上变成亮彩，
       不需要额外处理 PNG alpha 通道。
     * z-index: 3 与 .plan-holo-shine 同层，两者都在 .plan-energy-pulse
       之上、.relative.z-10 内容之下，保证标题 / 价格 / CTA 始终可读。
   ============================================================ */
.plan-holo-logo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
  opacity: calc(var(--card-opacity) * 0.95);
  mix-blend-mode: color-dodge;
  background-image:
    repeating-linear-gradient(
      0deg,
      var(--sunpillar-1) 5%,
      var(--sunpillar-2) 10%,
      var(--sunpillar-3) 15%,
      var(--sunpillar-4) 20%,
      var(--sunpillar-5) 25%,
      var(--sunpillar-6) 30%,
      var(--sunpillar-1) 35%
    ),
    repeating-linear-gradient(
      -45deg,
      #0e152e 0%,
      hsl(180, 20%, 60%) 3.8%,
      hsl(180, 29%, 66%) 4.5%,
      hsl(180, 20%, 60%) 5.2%,
      #0e152e 10%,
      #0e152e 12%
    ),
    radial-gradient(
      farthest-corner circle at var(--pointer-x) var(--pointer-y),
      rgba(255, 255, 255, 0.45) 12%,
      rgba(255, 255, 255, 0.18) 45%,
      rgba(0, 0, 0, 0.20) 120%
    );
  background-position:
    0 var(--background-y),
    var(--background-x) var(--background-y),
    center;
  background-size:
    400% 400%,
    260% 260%,
    200% 200%;
  background-blend-mode: color, hard-light;
  filter: brightness(1.12) contrast(1.3) saturate(1.35);
  -webkit-mask-image: url('/static/logo.png');
          mask-image: url('/static/logo.png');
  -webkit-mask-mode: alpha;
          mask-mode: alpha;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-size: 82% auto;
          mask-size: 82% auto;
  -webkit-mask-position: 50% 28%;
          mask-position: 50% 28%;
  transition: opacity 300ms ease;
  animation: plan-holo-drift 18s linear infinite;
}

/* Reduced motion 下已有 .plan-holo-shine 关停动画，这里同步处理 logo 层 */
@media (prefers-reduced-motion: reduce) {
  .plan-holo-logo { animation: none !important; }
}

/* ============================================================
   加购积分板块（.plan-topup-section + .plan-topup-card）
   ------------------------------------------------------------
   与 .plan-current-card 同一视觉语言（深底 #0B1320 + halftone 点阵 + 薄亮
   边 + 顶部 cyan 极浅色副光）。外壳 .plan-topup-section 就是 .plan-current-card
   压扁版；内部每个 topup 档位用 .plan-topup-card（半透明白底 + cyan hover 亮
   边），形成 "深底大卡 → 深底小卡" 的 Tonal Nesting。
   注意：
     - 小卡保持原来的 [data-topup-code] 属性，由 billing.js 的 forEach
       绑定 click 触发 startCheckout('topup', code, _paymentMethod)，这里
       只是换壳，不碰支付逻辑。
     - 积分数字用 cyan #00E5FF 高亮，沿用 .plan-price-glow 的色系，让余额
       变成视觉焦点。
   ============================================================ */
.plan-topup-section {
  position: relative;
  padding: 22px 24px;
  border-radius: 20px;
  overflow: hidden;
  color: #ECEFF1;
  background-color: #0B1320;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 0),
    linear-gradient(180deg, rgba(11, 19, 32, 0.95) 0%, rgba(11, 19, 32, 0.8) 100%);
  background-size: 8px 8px, auto;
  background-repeat: repeat, no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 20px;
  box-shadow: 0 18px 44px -16px rgba(11, 19, 32, 0.55),
              0 0 32px -10px rgba(0, 229, 255, 0.12);
}
.plan-topup-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: rgba(236, 239, 241, 0.5);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.plan-topup-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ECEFF1;
  cursor: pointer;
  transition: background-color 0.2s ease,
              border-color 0.25s ease,
              box-shadow 0.3s ease,
              transform 0.3s ease;
}
.plan-topup-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(0, 229, 255, 0.55);
  box-shadow: 0 0 24px -6px rgba(0, 229, 255, 0.25);
  transform: translateY(-2px);
}
.plan-topup-card .plan-topup-title {
  font-size: 13px;
  font-weight: 700;
  color: #ECEFF1;
  letter-spacing: 0.01em;
}
.plan-topup-card .plan-topup-meta {
  font-size: 11px;
  color: rgba(236, 239, 241, 0.55);
  margin-top: 4px;
}
.plan-topup-card .plan-topup-credits {
  color: #00E5FF;
  font-weight: 700;
}

/* ══════ 剧本咨询：确认生成剧本按钮 ══════
   挂在 AI 气泡下方，点击后触发 /api/script/workflow/consult/confirm 流水线。
   见 static/modules/script.js 的 _appendConfirmDraftButton / _ensureConfirmDraftDelegation。 */
.chat-confirm-draft-wrap { margin-top: 10px; display: flex; }
.btn-confirm-draft {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  background: #0B1320; color: #fff; border: none; border-radius: 10px;
  cursor: pointer; transition: background 0.15s ease, transform 0.1s ease;
}
.btn-confirm-draft:hover:not(:disabled) { background: #1A2332; }
.btn-confirm-draft:active:not(:disabled) { transform: scale(0.97); }
.btn-confirm-draft:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Regen button on timeline segments ── */
.edit-seg-regen-btn {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff; font-size: 14px; line-height: 22px;
  text-align: center; cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
  z-index: 12; padding: 0;
}
.edit-segment-block:hover .edit-seg-regen-btn { opacity: 1; }
.edit-seg-regen-btn:hover { background: rgba(220,53,69,0.85); }
.edit-seg-regen-btn:disabled { cursor: wait; }

/* ── Tag track above video track ── */
.edit-tag-block {
  height: 24px; flex-shrink: 0;
  display: flex; align-items: center; gap: 4px;
  padding: 0 6px;
  overflow: hidden; white-space: nowrap;
  border-bottom: 2px solid #526168;
  background: rgba(255,255,255,0.03);
  border-radius: 4px 4px 0 0;
}
.edit-tag-spacer {
  width: 24px; height: 24px; flex-shrink: 0;
}
.edit-tag-badge {
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px;
  flex-shrink: 0; line-height: 16px;
}
.edit-tag-emotion {
  font-size: 9px; color: rgba(255,255,255,0.5);
  overflow: hidden; text-overflow: ellipsis;
}
