/* video-director.css — 超级编导 v1 面板样式（.vdt-* 前缀）
 *   - 深浅色主题跟随 data-tone（CSS 变量来自 styles.css）
 *   - ≤760px 全屏化；所有可点目标 ≥40px 热区（触屏可用性）
 */
.vg-director-panel.vdt {
  border: 1px solid var(--line, rgba(0,0,0,.08));
  border-radius: 14px;
  background: var(--card, #fff);
  padding: 14px 16px 16px;
  margin-top: 10px;
}

/* ---- 头部 ---- */
.vdt .vg-dir-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.vdt .vg-dir-head > b { font-size: 14px; }
.vdt .vg-dir-meta { display: inline-flex; gap: 6px; margin-left: auto; }
.vdt .vg-dir-pill {
  min-width: 40px; min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 999px;
  background: transparent; color: inherit; font-size: 12px; cursor: pointer;
}
.vdt .vg-dir-pill:hover { border-color: var(--brand, #6c5ce7); color: var(--brand, #6c5ce7); }
.vdt .vg-exit-dir {
  min-height: 32px; padding: 0 10px; border: 0; background: transparent;
  color: var(--muted, #888); font-size: 12px; cursor: pointer; border-radius: 8px;
}
.vdt .vg-exit-dir:hover { color: var(--text, #222); background: rgba(0,0,0,.05); }

/* ---- 方案卡片 ---- */
.vdt-skills { margin: 4px 0 10px; }
.vdt-skills-loading { font-size: 12px; color: var(--muted, #888); padding: 6px 0; }
.vdt-skill-group { margin-bottom: 8px; }
.vdt-skill-group-title { font-size: 11px; color: var(--muted, #999); margin: 2px 0 6px; }
.vdt-skill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.vdt-skill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 4px 12px;
  border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 999px;
  background: transparent; color: inherit; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.vdt-skill:hover { border-color: var(--brand, #6c5ce7); }
.vdt-skill.is-active {
  border-color: var(--brand, #6c5ce7);
  background: color-mix(in srgb, var(--brand, #6c5ce7) 10%, transparent);
  color: var(--brand, #6c5ce7); font-weight: 600;
}
.vdt-skill-ico { display: inline-flex; width: 16px; height: 16px; }
.vdt-skill-ico svg { width: 16px; height: 16px; }
.vdt-skill-name { white-space: nowrap; }

/* ---- 输入 / 灵感词 ---- */
.vdt .vg-dir-input {
  width: 100%; min-height: 64px; resize: vertical;
  border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; line-height: 1.6; background: transparent; color: inherit;
}
.vdt .vg-dir-input:focus { outline: none; border-color: var(--brand, #6c5ce7); }
.vdt .vg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.vdt .vg-chip {
  min-height: 40px; padding: 0 12px;
  border: 1px dashed var(--line, rgba(0,0,0,.14)); border-radius: 999px;
  background: transparent; color: var(--muted, #888); font-size: 12px; cursor: pointer;
}
.vdt .vg-chip:hover { color: var(--brand, #6c5ce7); border-color: var(--brand, #6c5ce7); }

/* ---- 配音开关（置灰：即将上线，仅存值） ---- */
.vdt-audio { margin-top: 8px; font-size: 12px; color: var(--muted, #888); }
.vdt-audio label { display: inline-flex; align-items: center; gap: 6px; cursor: not-allowed; opacity: .65; }
.vdt-audio input[type="checkbox"] { accent-color: var(--brand, #6c5ce7); }
.vdt-audio .vdt-soon {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid currentColor; margin-left: 2px;
}

/* ---- 进行中 / 错误 ---- */
.vdt-state { margin-top: 10px; font-size: 13px; color: var(--muted, #666); }
.vdt-spin {
  display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid var(--line, rgba(0,0,0,.15)); border-top-color: var(--brand, #6c5ce7);
  border-radius: 50%; animation: vdt-rotate .8s linear infinite; vertical-align: -2px;
}
@keyframes vdt-rotate { to { transform: rotate(360deg); } }
.vdt-raw {
  margin: 8px 0 0; max-height: 180px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
  font: 12px/1.6 Consolas, Menlo, monospace;
  color: var(--muted, #777); background: rgba(0,0,0,.03);
  border-radius: 8px; padding: 8px 10px;
}
.vdt-error { color: #d63031; font-size: 13px; }

/* ---- 产出脚本 ---- */
.vg-script .vdt-script-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; margin-bottom: 6px; border-bottom: 1px solid var(--line, rgba(0,0,0,.08));
}
.vg-script .vdt-script-head > b { font-size: 14px; }
.vdt-script-actions { margin-left: auto; display: inline-flex; gap: 8px; }
.vdt-script-tip { font-size: 11px; color: var(--muted, #888); }

/* 产出态：脚本才是主角，把「方案 / 灵感词 / 配音 / 进度」这些一次性控件收起来 */
.vdt.is-result .vdt-skills,
.vdt.is-result .vg-chips,
.vdt.is-result .vdt-audio,
.vdt.is-result .vdt-state { display: none !important; }
.vdt.is-result .vg-dir-input { min-height: 44px; }

/* ---- 可编辑脚本（编导产出后用户可改，再点「应用脚本并生成视频」出片） ---- */
.vdt-script-edit {
  width: 100%; min-height: 240px; margin-top: 8px; resize: vertical;
  font-size: 13px; line-height: 1.7; color: var(--text, #222);
  border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 10px;
  padding: 12px 14px; background: var(--bg, #fff); box-sizing: border-box;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}
.vdt-script-edit:focus {
  outline: none; border-color: var(--brand, #6c5ce7);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #6c5ce7) 15%, transparent);
}
/* 脚本产出后的操作行：复制 / 应用并生成 */
.vdt-script-foot {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.vdt-script-foot .btn { white-space: nowrap; }
.vg-script .vdt-script-tip { flex: 1; min-width: 0; line-height: 1.5; }

/* ---- Markdown 渲染 ---- */
.vdt-md { font-size: 13px; line-height: 1.7; color: var(--text, #222); }
.vdt-md .vdt-h { margin: 10px 0 6px; font-size: 14px; }
.vdt-md .vdt-p { margin: 4px 0; }
.vdt-md .vdt-li { margin: 3px 0 3px 14px; position: relative; }
.vdt-md .vdt-li::before { content: '·'; position: absolute; left: -12px; color: var(--brand, #6c5ce7); }
.vdt-md .vdt-quote {
  margin: 6px 0; padding: 6px 10px; font-size: 12px; color: var(--muted, #777);
  border-left: 3px solid var(--brand, #6c5ce7); background: rgba(0,0,0,.03); border-radius: 0 8px 8px 0;
}
.vdt-md .vdt-mention {
  color: var(--brand, #6c5ce7); font-weight: 600;
  background: color-mix(in srgb, var(--brand, #6c5ce7) 10%, transparent);
  border-radius: 4px; padding: 0 4px;
}
.vdt-table {
  width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px;
}
.vdt-table th, .vdt-table td {
  border: 1px solid var(--line, rgba(0,0,0,.12));
  padding: 6px 8px; text-align: left; vertical-align: top;
}
.vdt-table th { background: rgba(0,0,0,.04); font-weight: 600; white-space: nowrap; }

/* ---- 移动端：≤760px 全屏化 ---- */
@media (max-width: 760px) {
  .vg-director-panel.vdt {
    position: fixed; inset: 0; z-index: 60;
    border-radius: 0; border: 0; margin: 0;
    padding: max(12px, env(safe-area-inset-top)) 16px 16px;
    background: var(--card, #fff);
    overflow: auto;
  }
  .vdt .vg-dir-head > b { font-size: 15px; }
  .vdt .vg-dir-input { min-height: 96px; font-size: 15px; }
  .vdt-skill { min-height: 44px; }
  .vdt .vg-chip { min-height: 44px; }
}

/* ================= v2：工具栏 / 设置弹层 / 语音 / 发送 ================= */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.vdt-composer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line, rgba(0,0,0,.12));
}
.vdt-composer-leading { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.vdt-composer-leading.is-inert { pointer-events: none; opacity: .45; }
.vdt-composer-trailing { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.vdt-settings-wrap { position: relative; }

.vdt-settings-trigger {
  min-height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line, rgba(0,0,0,.1));
  background: transparent; color: inherit; font-size: 12px; cursor: pointer;
}
.vdt-settings-trigger:hover { border-color: var(--brand, #6c5ce7); color: var(--brand, #6c5ce7); }
.vdt-settings-trigger[aria-expanded="true"] { border-color: var(--brand, #6c5ce7); color: var(--brand, #6c5ce7); }

/* placement: top-start —— 相对触发按钮左对齐、向上展开，宽 320px，padding 12/10 */
.vdt-settings-pop {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 40;
  width: 320px; max-width: calc(100vw - 32px);
  padding: 12px 10px; box-sizing: border-box;
  border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 12px;
  background: var(--card, #fff); box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.vdt-pop-title { margin: 0 0 8px; font-size: 12px; color: var(--muted, #888); }
.vdt-lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.vdt-lang-grid button {
  min-height: 34px; padding: 0 6px; border-radius: 8px;
  border: 1px solid var(--line, rgba(0,0,0,.1)); background: transparent;
  color: inherit; font-size: 12px; cursor: pointer;
}
.vdt-lang-grid button:hover { border-color: var(--brand, #6c5ce7); }
.vdt-lang-grid button[data-selected="true"] {
  border-color: var(--brand, #6c5ce7);
  background: color-mix(in srgb, var(--brand, #6c5ce7) 10%, transparent);
  color: var(--brand, #6c5ce7); font-weight: 600;
}
.vdt-dur-row { display: flex; align-items: center; gap: 8px; }
.vdt-dur-end { font-size: 11px; color: var(--muted, #999); white-space: nowrap; }
.vdt-dur-range {
  flex: 1; min-width: 0; height: 4px; border-radius: 2px; margin: 0;
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: linear-gradient(to right,
    var(--brand, #6c5ce7) 0 var(--fill, 37%),
    var(--line, rgba(0,0,0,.14)) var(--fill, 37%) 100%);
}
.vdt-dur-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid var(--card, #fff);
  background: var(--brand, #6c5ce7); box-shadow: 0 0 0 1px var(--brand, #6c5ce7);
}
.vdt-dur-range::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--card, #fff); background: var(--brand, #6c5ce7);
}
.vdt-dur-bubble {
  width: fit-content; margin: 8px 0 0 auto; padding: 1px 8px;
  border-radius: 6px; font-size: 11px; color: var(--brand, #6c5ce7);
  background: color-mix(in srgb, var(--brand, #6c5ce7) 10%, transparent);
}

.vdt-icon-btn, .vdt-send {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer;
}
.vdt-icon-btn svg { width: 18px; height: 18px; }
.vdt-icon-btn:hover { background: rgba(0,0,0,.05); }
.vdt-send { background: var(--text, #222); color: var(--panel, #fff); }
.vdt-send svg { width: 16px; height: 16px; }
.vdt-send:hover { opacity: .88; }
.vdt-send:disabled { opacity: .35; cursor: not-allowed; }
.vdt-send.is-poor { filter: grayscale(1); }
.vdt-credit { font-size: 11px; color: var(--muted, #888); white-space: nowrap; }

/* ---- 语音状态区 ---- */
.vdt-speech {
  order: 2; flex: 1 1 100%; display: flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 4px 8px; border-radius: 10px;
  background: rgba(0,0,0,.03); font-size: 12px;
}
.vdt-speech-view { display: inline-flex; align-items: center; gap: 8px; width: 100%; }
.vdt-speech-label { color: var(--muted, #777); }
.vdt-speech-wave { display: inline-flex; align-items: center; gap: 2px; height: 18px; flex: 1; min-width: 80px; }
.vdt-speech-wave i {
  display: block; width: 2px; min-width: 2px; height: 2px; border-radius: 1px;
  background: var(--brand, #6c5ce7); transition: height .12s linear;
}
.vdt-speech-stop, .vdt-speech-cancel {
  min-height: 28px; padding: 0 10px; border-radius: 8px; font-size: 11px; cursor: pointer;
  border: 1px solid var(--line, rgba(0,0,0,.12)); background: transparent; color: inherit;
}
.vdt-speech-stop { border-color: var(--brand, #6c5ce7); color: var(--brand, #6c5ce7); }
.vdt-speech-cancel:hover { background: rgba(0,0,0,.05); }

@media (max-width: 760px) {
  .vdt-settings-trigger, .vdt-icon-btn, .vdt-send { min-height: 40px; min-width: 40px; }
  .vdt-settings-pop { width: min(320px, calc(100vw - 32px)); }
  .vdt-lang-grid button { min-height: 40px; }
}
