/* ══════════════════════════════════════════════════════════
   视频剪辑工具 · 样式表
   ══════════════════════════════════════════════════════════ */

:root {
  --bg:        #0d0f14;
  --bg-2:      #14171f;
  --bg-3:      #1b1f2a;
  --bg-4:      #222735;
  --line:      #262c3a;
  --line-2:    #333b4f;
  --fg:        #e8ecf4;
  --fg-2:      #9aa4b8;
  --fg-3:      #6b7488;
  --accent:    #4d8dff;
  --accent-2:  #7b5cff;
  --ok:        #34d399;
  --warn:      #fbbf24;
  --danger:    #f87171;
  --radius:    10px;
  --radius-sm: 7px;
  --shadow:    0 8px 28px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

/* 必须放在最前面：本页大量元素用 display:flex/grid，
   会盖掉 UA 样式表里 [hidden] 的 display:none，所以这里强制一下 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
b { font-weight: 600; }
svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #47506a; }

/* ─────────── 顶栏 ─────────── */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.logo {
  width: 30px; height: 30px;
  color: var(--accent);
  background: linear-gradient(140deg, rgba(77,141,255,.18), rgba(123,92,255,.18));
  border: 1px solid rgba(77,141,255,.35);
  border-radius: 9px;
  padding: 5px;
}
.brand-text h1 { font-size: 14px; font-weight: 600; letter-spacing: .2px; }
.brand-text p { font-size: 11px; color: var(--fg-3); }

.src-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow: hidden;
  max-height: 46px;
}
.src-name {
  max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; font-size: 12.5px;
}
.chip {
  padding: 2px 8px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11px;
  color: var(--fg-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip.hl { color: var(--accent); border-color: rgba(77,141,255,.4); background: rgba(77,141,255,.09); }

.topbar-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--fg-2);
  white-space: nowrap;
  cursor: default;
}
.status-chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(251,191,36,.15);
  animation: pulse 1.4s ease-in-out infinite;
}
.status-chip.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.15); animation: none; }
.status-chip.err .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(248,113,113,.15); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* ─────────── 按钮 ─────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--fg);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .13s, border-color .13s, opacity .13s, transform .06s;
  -webkit-user-select: none; user-select: none;
}
.btn:hover:not(:disabled) { background: var(--bg-4); border-color: #3f4a63; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 3px 14px rgba(77,141,255,.28);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.09); }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--bg-3); }
.btn.tiny { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.btn.danger:hover:not(:disabled) { background: rgba(248,113,113,.15); }
.btn.block { width: 100%; padding: 10px; font-size: 13.5px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: 0 0 auto;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg-2);
  cursor: pointer;
  transition: background .13s, color .13s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--bg-4); color: var(--fg); }
.icon-btn.big { width: 40px; height: 40px; color: var(--fg); background: var(--accent); border-color: transparent; }
.icon-btn.big:hover { background: #5f9bff; color: #fff; }
.icon-btn.big svg { width: 20px; height: 20px; }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn.sm svg { width: 14px; height: 14px; }

.link {
  background: none; border: none; padding: 0;
  color: var(--accent); cursor: pointer; font-size: inherit;
  text-decoration: underline; text-underline-offset: 3px;
}
.link:hover { color: #7aaaff; }

/* ─────────── 拖放区 ─────────── */
.dropzone {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  padding: 30px;
  overflow: auto;
}
.dropzone.dragover .dz-inner {
  border-color: var(--accent);
  background: rgba(77,141,255,.07);
  transform: scale(1.012);
}
.dz-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: min(620px, 100%);
  padding: 62px 40px;
  border: 2px dashed var(--line-2);
  border-radius: 18px;
  background: var(--bg-2);
  text-align: center;
  transition: border-color .16s, background .16s, transform .16s;
}
.dz-icon { width: 50px; height: 50px; color: var(--accent); margin-bottom: 4px; }
.dz-inner h2 { font-size: 19px; font-weight: 600; }
.dz-inner p { color: var(--fg-2); font-size: 13px; }
.dz-hint { font-size: 11.5px !important; color: var(--fg-3) !important; margin-top: 8px; line-height: 1.7; }

/* ─────────── 工作区布局 ─────────── */
.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}
.col-left, .col-right { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.col-right { overflow-y: auto; overflow-x: hidden; padding-right: 2px; }

/* ─────────── 面板 ─────────── */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel.grow { flex: 0 0 auto; }
.panel-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  min-height: 43px;
}
.panel-title { font-size: 12.5px; font-weight: 600; letter-spacing: .3px; color: var(--fg); flex: 0 0 auto; }
.panel-body { padding: 13px; display: flex; flex-direction: column; gap: 17px; }

/* ─────────── 预览 / 裁切 ─────────── */
.preview-panel { flex: 1 1 auto; min-height: 210px; }

.aspect-bar { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.aspect-bar button {
  padding: 3px 9px;
  font-size: 11.5px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg-2);
  cursor: pointer;
  transition: all .12s;
  font-variant-numeric: tabular-nums;
}
.aspect-bar button:hover { background: var(--bg-4); color: var(--fg); }
.aspect-bar button.on {
  background: rgba(77,141,255,.16);
  border-color: rgba(77,141,255,.55);
  color: #9dc2ff;
  font-weight: 600;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #06070a;
  overflow: hidden;
  display: grid;
  place-items: center;
}
/* 注意：不能用 max-width/max-height:100%。
   在 grid 容器里百分比 max-height 不一定能解析，视频会按固有宽高比撑高、
   溢出到舞台上被 overflow:hidden 裁掉，底部裁切手柄就点不到了。
   让 video 铺满整个舞台、用 object-fit:contain 做等比内缩，几何关系最稳定。 */
.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  outline: none;
}
.crop-layer {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}
.crop-layer[hidden] { display: none; }

.crop-box {
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(4, 6, 10, .62);
  outline: 1.5px solid rgba(255, 255, 255, .92);
  cursor: move;
  pointer-events: auto;
  touch-action: none;
}
.crop-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.24) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.24) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
  background-position: -1px -1px;
  pointer-events: none;
}
/* 手柄内嵌在裁切框里，避免贴边时被 .crop-layer 的 overflow:hidden 裁掉 */
.ch {
  position: absolute;
  width: 13px; height: 13px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.5);
  border-radius: 3px;
  pointer-events: auto;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: transform .1s;
}
.ch:hover { transform: scale(1.18); }
.ch[data-h="nw"] { left: 0;   top: 0;    cursor: nwse-resize; }
.ch[data-h="n"]  { left: 50%; top: 0;    margin-left: -6px; cursor: ns-resize; }
.ch[data-h="ne"] { right: 0;  top: 0;    cursor: nesw-resize; }
.ch[data-h="e"]  { right: 0;  top: 50%;  margin-top: -6px;  cursor: ew-resize; }
.ch[data-h="se"] { right: 0;  bottom: 0; cursor: nwse-resize; }
.ch[data-h="s"]  { left: 50%; bottom: 0; margin-left: -6px; cursor: ns-resize; }
.ch[data-h="sw"] { left: 0;   bottom: 0; cursor: nesw-resize; }
.ch[data-h="w"]  { left: 0;   top: 50%;  margin-top: -6px;  cursor: ew-resize; }

.crop-badge {
  position: absolute;
  left: 50%; bottom: 6px;
  transform: translateX(-50%);
  padding: 2px 9px;
  background: rgba(0,0,0,.72);
  border-radius: 20px;
  font-size: 11px;
  color: #fff;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.stage-tip {
  position: absolute;
  left: 50%; top: 10px;
  transform: translateX(-50%);
  padding: 3px 12px;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  font-size: 11.5px;
  color: rgba(255,255,255,.75);
  pointer-events: none;
  transition: opacity .3s;
  z-index: 4;
}
.stage-tip.off { opacity: 0; }
.stage-tip.dim { opacity: .34; }

/* ─────────── 播放条 ─────────── */
.player-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.spacer { flex: 1 1 auto; }
.time-readout {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--fg-3);
  margin-left: 4px;
}
.time-readout b { color: var(--fg); font-size: 13.5px; }
.time-readout .sep { color: var(--line-2); }

.mini-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--fg-2);
  cursor: pointer;
  white-space: nowrap;
  -webkit-user-select: none; user-select: none;
}
.mini-check.block { margin-top: 8px; white-space: normal; line-height: 1.5; }
.mini-check input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; margin: 0; flex: 0 0 auto; }
.mini-check:hover { color: var(--fg); }

/* ─────────── 时间轴 ─────────── */
.timeline-panel { flex: 0 0 auto; }
.tl-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tl-zoom { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; }
.zoom-label {
  font-size: 11px; color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  min-width: 62px; text-align: center;
}

.overview {
  position: relative;
  height: 22px;
  margin: 10px 13px 0;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  overflow: hidden;
}
.ov-sel {
  position: absolute; top: 0; bottom: 0;
  background: rgba(77,141,255,.34);
  border-left: 1px solid rgba(77,141,255,.8);
  border-right: 1px solid rgba(77,141,255,.8);
  pointer-events: none;
}
.ov-win {
  position: absolute; top: 0; bottom: 0;
  border: 1.5px solid rgba(255,255,255,.6);
  border-radius: 4px;
  background: rgba(255,255,255,.07);
  pointer-events: none;
}

.tl-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 8px 13px 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  position: relative;
  height: 98px;
}
.tl-content { position: relative; height: 100%; will-change: transform; }
.tl-canvas {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  display: block;
  pointer-events: none;
}
.tl-dim {
  position: absolute; top: 0; bottom: 0;
  background: rgba(9, 11, 16, .72);
  pointer-events: none;
  z-index: 1;
}
.tl-sel {
  position: absolute; top: 24px; bottom: 0;
  border-top: 2px solid var(--accent);
  box-shadow: inset 0 0 0 1px rgba(77,141,255,.35);
  background: rgba(77,141,255,.07);
  pointer-events: none;
  z-index: 2;
}
.tl-grip {
  position: absolute;
  left: 0; right: 0; top: -2px;
  height: 15px;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  background: linear-gradient(180deg, rgba(77,141,255,.22), transparent);
}
.tl-grip:hover { background: linear-gradient(180deg, rgba(77,141,255,.42), transparent); }
.tl-grip:active { cursor: grabbing; }

.tl-h {
  position: absolute;
  top: -2px; bottom: 0;
  width: 15px;
  pointer-events: auto;
  cursor: ew-resize;
  touch-action: none;
}
.tl-h::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 6px;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(77,141,255,.75);
}
.tl-h::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 3px;
  width: 9px; height: 9px;
  background: var(--accent);
  border-radius: 2px;
}
.tl-h:hover::before { background: #7aaaff; }
.tl-h-l { left: -7px; }
.tl-h-r { right: -7px; }

.tl-playhead {
  position: absolute; top: 20px; bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #ff5f6d;
  box-shadow: 0 0 8px rgba(255,95,109,.85);
  pointer-events: none;
  z-index: 3;
}
.tl-playhead::before {
  content: '';
  position: absolute;
  top: -5px; left: -5px;
  width: 12px; height: 12px;
  background: #ff5f6d;
  border-radius: 2px;
  transform: rotate(45deg);
}

.tl-times {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 13px 12px;
  flex-wrap: wrap;
}
.field { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--fg-3); }
.field input {
  width: 104px;
  padding: 5px 9px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  outline: none;
  transition: border-color .13s;
}
.field input:focus { border-color: var(--accent); background: var(--bg-4); }
.sel-summary {
  margin-left: auto;
  display: flex; align-items: center; gap: 14px;
  font-size: 12px; color: var(--fg-2);
}
.sel-summary b { color: var(--fg); font-variant-numeric: tabular-nums; }
.sel-summary .muted { color: var(--fg-3); }

/* ─────────── 设置表单 ─────────── */
.group { display: flex; flex-direction: column; gap: 9px; }
.group-label {
  font-size: 11.5px; font-weight: 600; color: var(--fg-2);
  text-transform: none; letter-spacing: .3px;
  display: flex; align-items: baseline; gap: 8px;
}
.gl-note { font-weight: 400; font-size: 10.5px; color: var(--fg-3); }

.field-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.field-row .lbl { flex: 0 0 76px; color: var(--fg-3); font-size: 11.5px; }
.field-row .unit { color: var(--fg-3); font-size: 11px; white-space: nowrap; }
.field-row .times { color: var(--fg-3); }
.row { display: flex; align-items: center; gap: 8px; }

.num, .sel {
  padding: 6px 9px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font-size: 12.5px;
  outline: none;
  transition: border-color .13s, background .13s;
  min-width: 0;
}
.num { font-variant-numeric: tabular-nums; }
.num:focus, .sel:focus { border-color: var(--accent); background: var(--bg-4); }
.num:disabled, .sel:disabled { opacity: .42; cursor: not-allowed; }
.grow { flex: 1 1 auto; }
.sel {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
  cursor: pointer;
}
.sel option { background: var(--bg-3); color: var(--fg); }

.range { accent-color: var(--accent); height: 4px; cursor: pointer; }

/* 模式选择卡片 */
.mode-list { display: flex; flex-direction: column; gap: 8px; }
.mode {
  display: flex; gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-3);
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.mode:hover { background: var(--bg-4); }
.mode input { margin: 3px 0 0; accent-color: var(--accent); flex: 0 0 auto; width: 14px; height: 14px; cursor: pointer; }
.mode-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mode-title { font-size: 12.5px; font-weight: 600; }
.mode-title em {
  font-style: normal; font-weight: 500; font-size: 10.5px;
  color: var(--accent);
  background: rgba(77,141,255,.13);
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: 5px;
  white-space: nowrap;
}
.mode-desc { font-size: 11px; color: var(--fg-3); line-height: 1.65; }
.mode-desc b { color: var(--fg-2); font-weight: 600; }
.mode.on { border-color: rgba(77,141,255,.55); background: rgba(77,141,255,.08); }
.mode.on .mode-title { color: #9dc2ff; }
.mode.disabled { opacity: .45; pointer-events: none; }

.hint-warn {
  font-size: 11px;
  color: var(--warn);
  background: rgba(251,191,36,.09);
  border: 1px solid rgba(251,191,36,.25);
  border-radius: 7px;
  padding: 7px 10px;
  line-height: 1.6;
}

/* ─────────── 体积预估 ─────────── */
.estimate-panel { flex: 0 0 auto; padding: 13px; gap: 10px; display: flex; flex-direction: column; }
.est-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 12px; color: var(--fg-3);
}
.est-head b { font-size: 19px; color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.est-bar {
  position: relative;
  height: 7px;
  background: var(--bg-4);
  border-radius: 5px;
  overflow: hidden;
}
.est-fill {
  height: 100%;
  width: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .22s ease, background .22s;
}
.est-fill.over { background: linear-gradient(90deg, #f59e0b, var(--danger)); }
.est-cap { position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.35); }
.est-note { font-size: 11px; color: var(--fg-3); line-height: 1.6; min-height: 17px; }
.est-note b { color: var(--fg-2); }
.est-note.ok b { color: var(--ok); }
.est-note.warn b { color: var(--warn); }

/* ─────────── 进度 ─────────── */
.progress { display: flex; flex-direction: column; gap: 7px; }
.progress[hidden] { display: none; }
.p-bar { height: 6px; background: var(--bg-4); border-radius: 5px; overflow: hidden; }
.p-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 5px;
  transition: width .18s linear;
}
.p-meta {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11px; color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.p-meta #pPct { color: var(--fg); font-weight: 600; }

/* ─────────── 结果 ─────────── */
.result { display: flex; flex-direction: column; gap: 10px; }
.result[hidden] { display: none; }
.res-head { font-size: 13px; font-weight: 600; color: var(--ok); display: flex; align-items: center; gap: 7px; }
.res-head::before { content: '✓'; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: rgba(52,211,153,.16); font-size: 11px; }
.res-head.warn { color: var(--warn); }
.res-head.warn::before { content: '!'; background: rgba(251,191,36,.16); }
.res-compare {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.res-compare > div { display: flex; flex-direction: column; gap: 2px; }
.res-compare span { font-size: 10.5px; color: var(--fg-3); }
.res-compare b { font-size: 15px; font-variant-numeric: tabular-nums; }
.res-compare .arrow { color: var(--fg-3); font-size: 15px; }
.res-delta { font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.res-delta.down { color: var(--ok); }
.res-delta.up { color: var(--danger); }
.res-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px;
  font-size: 11px; color: var(--fg-3);
  padding: 9px 11px;
  background: var(--bg-3);
  border-radius: 8px;
}
.res-stats span { color: var(--fg-2); font-variant-numeric: tabular-nums; }

/* ─────────── Toast ─────────── */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  padding: 10px 20px;
  background: var(--bg-4);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  z-index: 999;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 76vw;
  text-align: center;
}
.toast[hidden] { display: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(248,113,113,.5); color: #ffb4b4; }
.toast.ok { border-color: rgba(52,211,153,.5); color: #8ef0c8; }

/* ─────────── 响应式 ─────────── */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 940px) {
  /* 关键：小屏改为整页滚动。
     如果 body 仍是 height:100%，grid 行会被 flex 高度压扁，
     子面板就互相重叠、播放条和时间轴会被挤没。 */
  html, body { height: auto; }
  body {
    min-height: 100%;
    overflow: auto;
    overflow-x: hidden;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: min-content;
    flex: 0 0 auto;
    height: auto;
    overflow: visible;
    padding: 10px;
    gap: 10px;
  }
  .col-left, .col-right { overflow: visible; min-height: 0; }
  .col-left { gap: 10px; }
  .col-right { gap: 10px; }
  /* 面板按内容高度排版，别被压扁 */
  .preview-panel { flex: 0 0 auto; min-height: 0; }
  .timeline-panel { flex: 0 0 auto; }
  .src-info { display: none; }
  .stage { min-height: 240px; }

  /* 顶栏换行，避免横向溢出 */
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 12px;
  }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand-text h1 { font-size: 13px; }
  .brand-text p { display: none; }
  .topbar-actions {
    flex: 1 1 100%;
    justify-content: space-between;
    min-width: 0;
  }
  .status-chip { font-size: 10.5px; padding: 3px 9px; min-width: 0; }
  .status-chip #statusText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 46vw;
  }

  /* 拖放区在小屏上收窄内边距 */
  .dropzone { padding: 16px; }
  .dz-inner { padding: 40px 20px; gap: 10px; }
  .dz-inner h2 { font-size: 17px; }
  .dz-icon { width: 40px; height: 40px; }

  /* 时间轴工具条换行，缩放区左对齐 */
  .panel-head { flex-wrap: wrap; row-gap: 8px; }
  .tl-tools { margin-left: 0; width: 100%; }
  .tl-zoom { margin-left: auto; }
  .tl-times { gap: 10px; }
  .sel-summary { margin-left: 0; width: 100%; justify-content: space-between; }

  /* 播放条换行 */
  .player-bar { gap: 7px; }
  .time-readout { font-size: 11.5px; }
  .time-readout b { font-size: 12.5px; }
  .spacer { flex: 1 1 100%; height: 0; }

  /* 设置面板里的标签列窄一点 */
  .field-row .lbl { flex: 0 0 64px; }
  .mode-desc { font-size: 10.5px; }
}
