/* 插件全局变量 */
.vwl {
  --vwl-primary: #4f46e5;
  --vwl-primary-hover: #4338ca;
  --vwl-border: #e2e8f0;
  --vwl-bg: #ffffff;
  --vwl-bg-soft: #f8fafc;
  --vwl-text: #1e293b;
  --vwl-text-muted: #64748b;
  --vwl-radius: 14px;
  
  max-width: 1080px;
  margin: 2rem auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border: 1px solid var(--vwl-border);
  border-radius: var(--vwl-radius);
  background: var(--vwl-bg);
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
  overflow: hidden;
  box-sizing: border-box;
}
.vwl *, .vwl *::before, .vwl *::after { box-sizing: border-box; }

/* 头部 */
.vwl__head { padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid #f1f5f9; }
.vwl__title { margin: 0 0 0.4rem; font-size: 1.25rem; font-weight: 700; color: var(--vwl-text); }
.vwl__note { margin: 0; font-size: 0.85rem; color: var(--vwl-text-muted); line-height: 1.5; }

/* 左右分栏 */
.vwl__body {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1.5rem;
  padding: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .vwl__body { grid-template-columns: 1fr; gap: 1.25rem; padding: 1rem; }
}

.vwl__left-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.vwl__right-col { display: flex; flex-direction: column; gap: 1rem; }

/* 上传区 */
.vwl__drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--vwl-border); border-radius: var(--vwl-radius);
  padding: 3rem 1rem; text-align: center; cursor: pointer; transition: all 0.2s ease;
  background: var(--vwl-bg-soft); color: var(--vwl-text-muted); font-size: 0.95rem; font-weight: 500;
}
.vwl__drop:hover, .vwl__drop.is-over { border-color: var(--vwl-primary); background: #eff6ff; color: var(--vwl-primary); }
.vwl__drop input { display: none; }

/* 预览区 */
.vwl__stage { display: none; border-radius: 12px; overflow: hidden; background: #0f172a; position: relative; }
.vwl__stage canvas { display: block; width: 100%; max-height: 500px; object-fit: contain; touch-action: none; }
.vwl__stage canvas.is-draggable { cursor: grab; }
.vwl__stage canvas.is-dragging { cursor: grabbing; }
.vwl__drag-hint {
  position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.6); color: #fff;
  font-size: 0.75rem; padding: 0.25rem 0.6rem; border-radius: 4px; pointer-events: none;
  display: none; backdrop-filter: blur(4px);
}
.vwl__video-src { display: none; }

/* 播放器控制栏 */
.vwl__controls { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; background: #0f172a; }
.vwl__play {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: var(--vwl-primary); color: #fff; cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.vwl__play:hover:not(:disabled) { background: var(--vwl-primary-hover); }
/* 新增：禁用状态 */
.vwl__play:disabled { opacity: 0.4; cursor: not-allowed; }

/* Safari 兼容的进度条 */
.vwl__progress {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 6px; background: #334155; border-radius: 3px;
  outline: none; cursor: pointer; margin: 0;
}
.vwl__progress::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: #818cf8; cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,0.5); transition: transform 0.1s;
}
.vwl__progress::-webkit-slider-thumb:hover { transform: scale(1.2); background: #a5b4fc; }
.vwl__progress::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #818cf8;
  cursor: pointer; border: none; box-shadow: 0 0 4px rgba(0,0,0,0.5);
}
/* 新增：禁用状态 */
.vwl__progress:disabled { opacity: 0.4; cursor: not-allowed; }
.vwl__progress:disabled::-webkit-slider-thumb { cursor: not-allowed; transform: none; background: #64748b; }

.vwl__time { color: #94a3b8; font-size: 0.8rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* 表单区 */
.vwl__form {
  display: flex; flex-direction: column; gap: 1.25rem;
  background: var(--vwl-bg-soft); padding: 1.25rem;
  border-radius: var(--vwl-radius); border: 1px solid var(--vwl-border); transition: opacity 0.3s;
}
.vwl__form.is-disabled { opacity: 0.5; pointer-events: none; }
.vwl__field-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.vwl__field { display: flex; flex-direction: column; gap: 0.5rem; }
.vwl__field--grow { flex: 1; min-width: 120px; }
.vwl__field--sm { flex: none; width: 140px; }
.vwl__field label { font-size: 0.85rem; font-weight: 600; color: var(--vwl-text); }

/* 输入框/下拉框 */
.vwl__input, .vwl__select {
  width: 100%; height: 42px; padding: 0 1rem; font-size: 0.9rem; color: var(--vwl-text);
  background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
  outline: none; transition: all 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.vwl__input:focus, .vwl__select:focus { border-color: var(--vwl-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
.vwl__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
  background-size: 1rem; padding-right: 2.5rem; cursor: pointer;
}

/* 自定义颜色选择器 */
.vwl__color-wrap {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer; transition: transform 0.2s; flex-shrink: 0;
  background-color: #000000;
}
.vwl__color-wrap:hover { transform: scale(1.05); }
.vwl__color-wrap input[type="color"] {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 2; padding: 0; border: none;
}

/* 自定义滑块 */
.vwl__range-header { display: flex; justify-content: space-between; align-items: center; }
.vwl__val {
  font-size: 0.8rem; font-weight: 600; color: var(--vwl-primary);
  background: #e0e7ff; padding: 0.1rem 0.4rem; border-radius: 4px;
}
.vwl__range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: #e2e8f0; outline: none; cursor: pointer;
}
.vwl__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--vwl-primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2); border: 2px solid #fff; transition: transform 0.1s;
}
.vwl__range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.vwl__range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--vwl-primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2); border: 2px solid #fff;
}

/* 自定义图片上传 */
.vwl__file-wrap { display: flex; align-items: center; gap: 1rem; }
.vwl__file-input { display: none; }
.vwl__file-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 1rem; background: #fff;
  border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 0.85rem; font-weight: 500; color: var(--vwl-text); cursor: pointer; transition: all 0.2s;
}
.vwl__file-btn:hover { border-color: var(--vwl-primary); color: var(--vwl-primary); }
.vwl__img-preview {
  display: none; height: 42px; width: auto; border-radius: 6px;
  border: 1px solid var(--vwl-border); object-fit: contain;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, white 0% 50%) 50% / 10px 10px;
}

/* 按钮区 */
.vwl__actions { display: flex; gap: 1rem; }
.vwl__btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.vwl__btn--primary {
  flex: 1; background: var(--vwl-primary); color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}
.vwl__btn--primary:hover:not(:disabled) {
  background: var(--vwl-primary-hover); transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}
.vwl__btn--primary:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }
.vwl__btn--ghost { padding: 0 1.5rem; background: #fff; border: 1px solid #cbd5e1; color: var(--vwl-text); }
.vwl__btn--ghost:hover:not(:disabled) { background: #f8fafc; }
.vwl__btn--ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* 渲染进度条 */
.vwl__render-box {
  display: none; flex-direction: column; gap: 0.6rem;
  padding: 1rem; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
}
.vwl__render-bar-wrap { width: 100%; height: 8px; background: #dbeafe; border-radius: 4px; overflow: hidden; }
.vwl__render-bar { width: 0%; height: 100%; background: var(--vwl-primary); border-radius: 4px; transition: width 0.2s linear; }
.vwl__render-text { font-size: 0.85rem; font-weight: 500; color: #1d4ed8; text-align: center; }

/* 状态与下载 */
.vwl__status { min-height: 1.2em; font-size: 0.85rem; color: var(--vwl-text-muted); text-align: center; }
.vwl__error {
  color: #dc2626; background: #fef2f2; border: 1px solid #fecaca;
  padding: 0.75rem; border-radius: 8px; font-size: 0.85rem; display: none; text-align: center;
}
.vwl__dl {
  display: none; padding: 1.25rem; background: #ecfdf5;
  border: 1px solid #a7f3d0; border-radius: 12px; text-align: center;
}
.vwl__dl a {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 1.5rem; background: #059669; color: #fff;
  text-decoration: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; transition: background 0.2s;
}
.vwl__dl a:hover { background: #047857; }
.vwl__dl p { margin: 0.75rem 0 0; font-size: 0.8rem; color: #065f46; }

/* 手机端 */
@media (max-width: 600px) {
  .vwl__field-row { flex-direction: column; gap: 1rem; }
  .vwl__field--sm { width: 100%; }
  .vwl__actions { flex-direction: column; }
}