:root {
  --bg: #0f1420;
  --panel: #161c2b;
  --panel-2: #1d2536;
  --line: #2a3346;
  --text: #e6ebf5;
  --muted: #8b96ab;
  --accent: #2f7bff;
  --accent-2: #1b4fd1;
  --danger: #ff5d5d;
  --ok: #34d399;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 16px; letter-spacing: .5px; }
.brand .ver { font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }

.btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
  transition: .15s; user-select: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.progress-wrap { display: flex; align-items: center; gap: 8px; width: 220px; }
.progress-track { flex: 1; height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }
#progressPct { font-size: 12px; color: var(--muted); width: 36px; text-align: right; }

.banner { padding: 8px 16px; font-size: 13px; }
.banner.warn { background: #3a2f12; color: #ffd479; border-bottom: 1px solid #5a4a1a; }
.banner.error { background: #3a1717; color: #ff9a9a; border-bottom: 1px solid #5a2222; }
.error { margin: 10px 16px; padding: 8px 12px; background: #3a1717; color: #ff9a9a; border-radius: 8px; font-size: 13px; }

/* 布局 */
.layout { display: grid; grid-template-columns: 240px 1fr 280px; height: calc(100vh - 53px); }
.panel { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; }
.panel.right { border-right: none; border-left: 1px solid var(--line); }
.panel h2 { font-size: 13px; color: var(--muted); margin: 4px 0 12px; text-transform: uppercase; letter-spacing: 1px; }

/* 素材库 */
.library { display: flex; flex-direction: column; gap: 10px; }
.media-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.media-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.hint { color: var(--muted); font-size: 12px; padding: 12px 4px; line-height: 1.6; }

/* 中央区 */
.center { display: flex; flex-direction: column; padding: 14px; gap: 10px; overflow: hidden; }
.preview-wrap {
  position: relative; flex: 1; min-height: 240px;
  background: #000; border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#previewVideo { max-width: 100%; max-height: 100%; transform-origin: center center; background: #000; }
.preview-text {
  position: absolute; left: 0; right: 0; bottom: 6%;
  text-align: center; font-weight: 700;
  font-size: clamp(14px, 4vw, 34px); pointer-events: none;
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.transport { color: var(--muted); font-size: 13px; text-align: center; }
.timeline {
  position: relative; min-height: 64px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; display: flex; gap: 6px; align-items: stretch; overflow-x: auto;
}
.clip {
  position: relative; min-width: 40px; flex: 0 0 auto;
  background: linear-gradient(180deg, #2f7bff33, #2f7bff14);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between;
}
.clip.selected { background: linear-gradient(180deg, #2f7bff66, #2f7bff33); box-shadow: 0 0 0 2px var(--accent); }
.clip-title { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.clip-dur { font-size: 11px; color: var(--muted); }
#playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ok);
  left: 0; pointer-events: none; z-index: 5;
}
.ruler-hint { color: var(--muted); font-size: 12px; }

/* 属性面板 */
.inspector .sect { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.inspector h3 { font-size: 13px; margin: 0 0 10px; color: var(--text); }
.inspector label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.inspector label.chk { flex-direction: row; align-items: center; gap: 8px; }
.inspector input[type="text"], .inspector input[type="number"], .inspector select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font-size: 13px;
}
.inspector input[type="range"] { width: 100%; }
.inspector .row { display: flex; gap: 6px; }
.clip-tag { font-size: 12px; color: var(--accent); margin-bottom: 10px; word-break: break-all; }
.inspector span { color: var(--text); font-size: 11px; }
