/* IP短视频智能体 - 主样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #f0f4f8;
  color: #333;
  line-height: 1.4;
  padding: 12px;
  padding-bottom: 20px;
}
.page { max-width: 100%; margin: 0 auto; }

.header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  text-align: center;
}
.header h1 { font-size: 20px; font-weight: 600; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 8px;
  align-items: start;
}
@media (max-width: 768px) {
  .grid { display: flex; flex-direction: column; gap: 12px; }
  .grid > div { width: 100%; }
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 8px 16px 4px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  border: 1px solid #e2e8f0;
  min-width: 0;
  overflow: hidden;
}
.card-step5 {
  z-index: 10;
  overflow: visible;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e3a5f;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-bottom: 2px solid #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}
.label { font-size: 13px; color: #475569; font-weight: 500; margin-bottom: 6px; display: block; }
.video-preview-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.video-preview-row .label { margin-bottom: 0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.video-status-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(248,250,252,0.95); color: #475569; font-size: 14px; font-weight: 500; border-radius: 8px; pointer-events: none; padding: 16px; }
.video-status-msg.status-failed { color: #dc2626; }
.video-status-loading-bar { width: 80%; max-width: 200px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.video-status-loading-bar[aria-hidden="true"] { display: none; }
.video-status-loading-bar[aria-hidden="false"] { display: block; }
.video-status-loading-fill { height: 100%; width: 40%; background: linear-gradient(90deg, #3b82f6, #60a5fa); border-radius: 3px; animation: video-status-loading 1.5s ease-in-out infinite; }
@keyframes video-status-loading {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(350%); }
  100% { transform: translateX(-100%); }
}
.field { margin-bottom: 5px; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 5px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea { min-height: 80px; resize: vertical; }

/* 输入方式：分列式下拉（Split button） */
.input-mode-wrap { margin-bottom: 14px; position: relative; }
.step1-row1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.step1-row1 > .label { margin-bottom: 0; flex-shrink: 0; }
.step1-row1 .split-btn-group { flex-shrink: 0; }
.step1-mode-select { min-width: 140px; flex: 1; max-width: 220px; }
.step1-row2 { margin-bottom: 0; }
.step1-row2 .step1-dynamic-cell { width: 100%; }
.split-btn-group {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  overflow: visible;
  position: relative;
}
.split-btn-main {
  padding: 10px 14px;
  font-size: 14px;
  color: #374151;
  background: #f9fafb;
  border-right: 1px solid #d1d5db;
  border-radius: 8px 0 0 8px;
  min-width: 120px;
}
.split-btn-dropdown {
  padding: 10px 12px;
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.split-btn-dropdown:hover {
  background: #e5e7eb;
  color: #374151;
}
.split-btn-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  padding: 4px 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  list-style: none;
  z-index: 50;
}
.split-btn-menu.show { display: block; }
.split-btn-menu li { margin: 0; }
.split-btn-menu a {
  display: block;
  padding: 10px 14px;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s;
}
.split-btn-menu a:hover {
  background: #f3f4f6;
  color: #111;
}

/* 输入方式：第一行 文本+下拉，第二行 输入框/上传控件 */
.step1-dynamic-cell { min-width: 0; }
.step1-dynamic-inner { width: 100%; }
.step1-dynamic-inner.hidden { display: none !important; }
.step1-dynamic-inner input[type="text"],
.step1-dynamic-inner input[type="file"] {
  width: 100%;
}

.btn {
  display: inline-block;
  padding: 8px 18px;
  min-width: 100px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  margin-left: 8px;
  margin-bottom: 8px;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.btn-row .btn { margin-left: 0; margin-bottom: 0; }
.btn-row-with-refresh { justify-content: space-between; }
.btn-row-with-refresh .btn-row-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-icon { padding: 6px; min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon svg { display: block; }
.field-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 6px;
}
.field-row .label { margin-bottom: 0; flex-shrink: 0; min-width: auto; margin-right: 2px; }
.field-row input, .field-row select { flex: 1; min-width: 0; }
.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%); box-shadow: 0 3px 10px rgba(37, 99, 235, 0.4); }
.btn-secondary { background: #e5e7eb; color: #333; }
.btn-secondary:hover { background: #d1d5db; }
.btn-upload { background: #f8fafc; border: 1px dashed #cbd5e1; color: #475569;padding: 5px 12px; }
.btn-upload:hover { background: #f1f5f9; border-color: #94a3b8; color: #334155; }
.btn:disabled, .btn-primary:disabled, .btn-secondary:disabled, .btn-publish:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* 文件选择框（与输入框统一圆角） */
input[type="file"] {
  padding: 1px 12px;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 14px;
  width: 100%;
  cursor: pointer;
}
input[type="file"]:hover { background: #f1f5f9; border-color: #cbd5e1; }

.media-box {
  min-height: 120px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 13px;
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
}
.media-box .content-inner { position: relative; z-index: 1; width: 100%; }
.media-box.video-box2 { height: 475px; max-width: 100%; }
.media-box.audio-box { min-height: 120px; }
.media-box video, .media-box audio { max-width: 100%; max-height: 200px; }
.media-box.video-box2 video { max-width: 100%; max-height: 100%; }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2;
}
.loading-overlay.hidden { display: none; }
.loading-overlay-card { border-radius: 14px; }
.loading-spinner-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}
@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}
.progress-bar-wrap {
  width: 100%;
  max-width: 200px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 4px;
  width: 0%;
  transition: width 0.2s ease;
}
.loading-eta { font-size: 12px; color: #6b7280; }

/* 通用“处理中”动态加载条（不显示预计剩余时间） */
.loading-indeterminate-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.loading-indeterminate-bar {
  width: 80%;
  max-width: 200px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.loading-indeterminate-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 3px;
  animation: video-status-loading 1.5s ease-in-out infinite;
}
.loading-indeterminate-text {
  font-size: 13px;
  color: #6b7280;
}

.footer-actions {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid #e5e7eb;
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
/* 发布卡：第一行整行是平台+下拉+信息管理，第二行是发布/退出按钮，避免重叠 */
.footer-actions-publish { flex-direction: column; align-items: stretch; gap: 0; }
.footer-actions-publish .publish-platform-row { width: 100%; flex: 0 0 auto; margin-top: 0; margin-bottom: 0; }
.footer-actions-publish .publish-buttons-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 0; margin-bottom: 0; }
.platforms { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.platforms label { font-size: 14px; cursor: pointer; }
.platforms .btn-platform-cookies { padding: 6px 14px; font-size: 13px; flex-shrink: 0; }
.btn-publish { background: #2563eb; color: #fff; padding: 10px 28px; font-size: 15px; min-width: 120px; }
/* 发布（预览）与退出登录同尺寸，可发布时样式同生成BGM（btn-primary） */
.btn-publish-preview { padding: 10px 28px; font-size: 15px; min-width: 120px; }
.btn-logout { background: #dc2626; color: #fff; padding: 10px 28px; font-size: 15px; min-width: 120px; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
#confirmModal,
#alertModal { z-index: 1100; }
.modal-box { background: #fff; border-radius: 12px; padding: 24px; max-width: 720px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-confirm { max-width: 360px; text-align: center; }
.modal-confirm-message { font-size: 15px; color: #333; margin: 0 0 20px 0; line-height: 1.5; }
.modal-confirm .modal-footer { justify-content: center; }
.modal-alert { max-width: 360px; text-align: center; }
.modal-alert .modal-footer { justify-content: center; }
.modal-alert-message { font-size: 15px; color: #333; margin: 0 0 20px 0; line-height: 1.5; white-space: pre-wrap; }
.modal-box h3 { font-size: 16px; margin-bottom: 16px; text-align: center; color: #333; }
.template-loading { padding: 24px; text-align: center; color: #6b7280; margin-bottom: 16px; }
.template-preset-grid { display: grid; gap: 12px; margin-bottom: 20px; }
.title-style-grid.template-preset-grid { grid-template-columns: repeat(4, 1fr); }
.title-style-grid .template-preset-item .template-placeholder { aspect-ratio: 3/1.5; min-height: 72px; }
.caption-style-grid.template-preset-grid { grid-template-columns: repeat(3, 1fr); }
.caption-style-grid .template-preset-item .template-placeholder { aspect-ratio: 3/1; }
@media (max-width: 520px) { .title-style-grid.template-preset-grid { grid-template-columns: repeat(3, 1fr); } .caption-style-grid.template-preset-grid { grid-template-columns: repeat(2, 1fr); } }
.title-style-item,
.template-preset-item { border-radius: 8px; border: 2px solid #e5e7eb; cursor: pointer; position: relative; overflow: hidden; background: #fff; }
.title-style-item { aspect-ratio: 16/10; background-size: cover; background-position: center; }
.template-preset-item { display: block; }
.template-preset-item .template-placeholder { width: 100%; background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%); border-radius: 6px; flex-shrink: 0; }
.template-preset-item .template-placeholder img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 6px; }
.template-preset-item .template-info { display: none; }
.title-style-item:hover,
.template-preset-item:hover { border-color: #93c5fd; }
.title-style-item.selected,
.template-preset-item.selected { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.3); }
.title-style-item .check,
.template-preset-item .check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; background: #2563eb; color: #fff; border-radius: 50%; display: none; align-items: center; justify-content: center; font-size: 12px; z-index: 2; }
.title-style-item.selected .check,
.template-preset-item.selected .check { display: flex; }
.modal-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; flex-wrap: wrap; }
.modal-footer-left { display: flex; align-items: center; }
.modal-footer-left label { margin-right: 4px; }
.duration-control-wrap { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; }
.duration-control-wrap .duration-label { margin: 0; font-size: 14px; font-weight: 600; color: #334155; }
.duration-control-wrap .duration-input { width: 56px; padding: 8px 10px; font-size: 14px; font-weight: 500; color: #0f172a; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; text-align: center; }
.duration-control-wrap .duration-input:hover { border-color: #94a3b8; }
.duration-control-wrap .duration-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.duration-control-wrap .duration-unit { font-size: 14px; font-weight: 500; color: #64748b; }
.modal-footer-actions { display: flex; gap: 12px; }
.video-title-overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px; background: linear-gradient(transparent, rgba(0,0,0,0.75)); color: #fff; font-size: 18px; font-weight: 600; text-align: center; pointer-events: none; }

/* 05 添加字幕 - 视频首帧上的距顶/距底参考线 */
.subtitle-frame-wrap { overflow: hidden; }
.subtitle-position-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.subtitle-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  margin-top: -1px;
  pointer-events: auto;
  cursor: ns-resize;
  transition: background 0.15s;
}
.subtitle-line-top {
  background: transparent;
  border-top: 3px dashed #2563eb;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
}
.subtitle-line-bottom {
  background: transparent;
  border-top: 3px dashed #dc2626;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
}
.subtitle-line:hover { filter: brightness(1.15); }

/* 05 距顶部/距底部 与左侧蓝/红线对应 */
.subtitle-position-row-top label,
.subtitle-position-row-top .subtitle-position-value { color: #2563eb; }
.subtitle-position-row-top input[type="range"] { accent-color: #2563eb; }
.subtitle-position-row-bottom label,
.subtitle-position-row-bottom .subtitle-position-value { color: #dc2626; }
.subtitle-position-row-bottom input[type="range"] { accent-color: #dc2626; }

/* 05 添加字幕 - 6 行样式面板 */
.step5-style-panel { font-size: 12px; }
.step5-style-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 5px;
  padding: 6px 0;
  border-bottom: 1px solid #e5e7eb;
}
.step5-style-row:last-of-type { border-bottom: none; }
.step5-row-check { cursor: pointer; flex-shrink: 0; }
.step5-row-label { cursor: pointer; margin: 0; min-width: 52px; font-weight: 500; color: #374151; flex-shrink: 0; }
/* 主标题/副标题/三标题/字幕设置 与 字体 紧挨：同一组内小间距 */
.step5-label-font {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.step5-label-font .step5-row-label { min-width: auto; margin-right: 0; }
.step5-label-font .step5-font-wrap { margin-right: 0; margin-left: 0; }
/* 字体：文本 + 点击展开下拉 */
.step5-font-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.step5-font-display {
  cursor: pointer;
  color: #2563eb;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.step5-font-display:hover { background: #eff6ff; border-color: #bfdbfe; }
.step5-font-arrow {
  font-size: 10px; color: #6b7280; margin-left: 2px; pointer-events: none;
}
.step5-font-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  min-width: 140px;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 500;
}
.step5-font-dropdown.hidden { display: none; }
.step5-font-dropdown .step5-font-opt {
  display: block;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  font-size: 12px;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
}
.step5-font-dropdown .step5-font-opt:hover { background: #f3f4f6; }
.step5-color-label { color: #6b7280; flex-shrink: 0; }
/* 自定义颜色控件：点击弹出层内可选「无」或选色 */
.step5-color-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.step5-color-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 4px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  background: #fff;
}
.step5-color-trigger:hover { border-color: #9ca3af; }
.step5-color-swatch {
  display: inline-block;
  width: 18px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
}
.step5-color-swatch.step5-color-none {
  width: auto;
  height: auto;
  min-width: 18px;
  min-height: 16px;
  padding: 0 4px;
  line-height: 16px;
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px dashed #9ca3af;
}
.step5-color-popover {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  padding: 8px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.step5-color-popover.hidden { display: none; }
.step5-color-opt-none {
  padding: 4px 10px;
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  cursor: pointer;
}
.step5-color-opt-none:hover { background: #e5e7eb; }
.step5-color-popover input[type="color"] {
  width: 100%;
  min-height: 28px;
  padding: 2px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
}
.step5-color-input.step5-disabled,
.step5-stroke-color.step5-disabled,
.step5-box-color.step5-disabled { opacity: 0.5; pointer-events: none; }
.step5-none-check { cursor: pointer; margin: 0 0 0 2px; flex-shrink: 0; }
.step5-none-label { cursor: pointer; margin: 0; color: #6b7280; font-size: 11px; flex-shrink: 0; }
.step5-slider-label { color: #6b7280; margin-left: 4px; flex-shrink: 0; }
.step5-ratio-slider { width: 56px; min-width: 56px; flex-shrink: 0; accent-color: #2563eb; }
.step5-ratio-value { min-width: 32px; text-align: right; font-size: 11px; color: #6b7280; flex-shrink: 0; }
.step5-actions-row { display: flex; margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e7eb; }
.step5-actions-row .btn { flex: 1; }

@keyframes spin { to { transform: rotate(360deg); } }

.error-msg { font-size: 12px; color: #dc2626; margin-top: 4px; }
.hidden { display: none !important; }

/* 音频/音乐素材弹窗卡片（图1 样式：白底、椭圆播放钮、第一行播放+标题，第二行时间+细进度条+时长） */
.material-grid-audio {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

/* 视频素材弹窗网格：与音频/音乐一致，随宽度自适应列数 */
.material-grid-video {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
/* 视频素材弹窗内的播放按钮：固定正圆，不被 .btn 的 min-width 拉宽 */
.material-grid-video .material-play-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.material-audio-card {
  padding: 12px 14px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.material-audio-card .material-row1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 0;
}
.material-audio-card .material-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 0;
}
.material-audio-card .material-play-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  border: none;
  cursor: pointer;
}
.material-audio-card .material-play-btn:hover { opacity: 0.95; }
.material-audio-card .material-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: #334155;
}
.material-audio-card .material-time,
.material-audio-card .material-duration {
  font-size: 12px;
  color: #64748b;
  min-width: 38px;
}
.material-audio-card .material-duration { text-align: right; }
.material-audio-card .material-progress-wrap {
  flex: 1;
  min-width: 0;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}
.material-audio-card .material-progress-bar {
  height: 100%;
  background: #2563eb;
  width: 0%;
  border-radius: 2px;
  transition: width 0.15s ease;
}

/* 画中画素材：9:16 小方块网格，封面 + 点击播放 */
.material-grid-video {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  padding: 4px 0;
}
.pip-material-card {
  width: 100%;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.pip-material-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #1a1a1a;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pip-material-preview .pip-material-cover,
.pip-material-preview video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pip-material-preview video {
  display: none;
}
.pip-material-preview.pip-playing .pip-material-cover { display: none; }
.pip-material-preview.pip-playing video { display: block; }
.pip-material-preview .pip-play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.2s;
}
.pip-material-preview.pip-playing .pip-play-icon { opacity: 0; }
.pip-material-card .pip-material-info {
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.pip-material-card .pip-material-name {
  flex: 1 1 100%;
  font-size: 12px;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pip-material-card .pip-material-dur {
  font-size: 11px;
  color: #64748b;
}
.pip-material-card .pip-material-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.pip-btn-use,
.pip-btn-del {
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.pip-btn-use {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
}
.pip-btn-use:hover { opacity: 0.9; }
.pip-btn-del {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}
.pip-btn-del:hover { background: #e2e8f0; }
.pip-btn-del:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
