:root {
  --bg: #0d0d10;
  --bg-2: #131318;
  --bg-3: #191920;
  --line: rgba(198, 166, 100, .16);
  --gold: #c6a664;
  --gold-2: #e0c48c;
  --text: #ece8df;
  --dim: #8b8577;
  --dim-2: #6b6659;
  --ok: #7fae86;
  --err: #c96a5e;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  overflow: hidden;
  height: 100vh;
}

button, input, select { font-family: inherit; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 22px; flex: none;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.logo { font-size: 16px; letter-spacing: 2px; color: #f4f0e7; }
.logo span {
  margin-left: 10px; font-size: 11px; letter-spacing: 1px;
  color: var(--gold); opacity: .85;
}
.top-right { display: flex; align-items: center; gap: 10px; }
.quota { font-size: 12px; color: var(--dim); }
.quota b { color: var(--gold); font-size: 16px; margin: 0 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--text);
  font-size: 12.5px; transition: .15s;
}
.btn:hover { border-color: rgba(198,166,100,.45); }
.btn.primary {
  background: linear-gradient(180deg, #d3b273, #b8955a);
  color: #171410; font-weight: 600; border: none;
}
.btn.ghost { background: transparent; }
.btn.small { height: 30px; padding: 0 12px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.mini {
  height: 26px; padding: 0 10px; border-radius: 6px; cursor: pointer;
  background: rgba(198,166,100,.1); color: var(--gold);
  border: 1px solid rgba(198,166,100,.25); font-size: 11.5px;
}
.mini:hover { background: rgba(198,166,100,.2); }
.mini.wide { width: 100%; margin-top: 8px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--line);
  font-size: 13px;
}

/* ---------------- 三栏 ---------------- */
.layout {
  flex: 1; display: grid;
  grid-template-columns: 260px 1fr 320px;
  min-height: 0;
}

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-size: 12px; color: var(--dim);
  letter-spacing: 1px; border-bottom: 1px solid rgba(255,255,255,.05);
}
.job-list { overflow-y: auto; flex: 1; padding: 10px; }

.job {
  display: flex; gap: 10px; padding: 10px; border-radius: 10px;
  cursor: pointer; border: 1px solid transparent; margin-bottom: 8px;
}
.job:hover { background: rgba(255,255,255,.03); }
.job.on { background: #221f1a; border-color: rgba(198,166,100,.5); }
.job img { width: 74px; height: 44px; border-radius: 6px; object-fit: cover; background: #222; flex: none; }
.job .jinfo { flex: 1; min-width: 0; }
.job .jtitle { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .jmeta { font-size: 10.5px; color: var(--dim-2); margin-top: 4px; }
.job .jstat { font-size: 11px; margin-top: 5px; color: var(--dim); }
.job .jstat.doing { color: var(--gold); }
.job .jstat.done { color: var(--ok); }
.job .jstat.failed { color: var(--err); }

.pbar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, #8a7346, var(--gold)); }

/* ---------------- 舞台 ---------------- */
.stage-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #08080a; }
.stage {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000;
}
.stage video { max-width: 100%; max-height: 100%; display: block; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.stage-hint {
  position: absolute; color: var(--dim-2); font-size: 13px;
}

.vtag {
  position: absolute;
  padding: 7px 12px;
  border-radius: 9px;
  background: rgba(17,17,19,.86);
  border: 1px solid rgba(198,166,100,.45);
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  pointer-events: auto; cursor: pointer;
  max-width: 260px;
  transition: opacity .12s;
}
.vtag .vt-t { font-size: 12.5px; color: #f4f0e7; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtag .vt-s { font-size: 12px; color: var(--gold); margin-top: 1px; }
.vtag.luxury { background: rgba(24,22,18,.9); border-color: rgba(198,166,100,.7); }
.vtag.matte { background: rgba(250,249,246,.94); border-color: rgba(198,166,100,.35); }
.vtag.matte .vt-t { color: #2a2724; }
.vtag.matte .vt-s { color: #8a7346; }
.vtag.pill { border-radius: 999px; }
.vtag.on { outline: 2px solid var(--gold); }

.transport {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: 10px 16px; background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.timecode { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.timecode b { color: var(--gold); font-size: 13px; }
.status { font-size: 11.5px; color: var(--dim); }
.grow { flex: 1; }

/* ---------------- 时间轴 ---------------- */
.timeline-wrap { flex: none; background: var(--bg-2); border-top: 1px solid var(--line); }
.tl-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px 4px; font-size: 11.5px; color: var(--dim);
}
.tl-tip { color: var(--dim-2); font-size: 10.5px; }

.timeline {
  position: relative; height: 158px; overflow-y: auto; overflow-x: hidden;
  padding-bottom: 8px;
}
.ruler {
  position: sticky; top: 0; z-index: 3;
  height: 20px; background: #101014; border-bottom: 1px solid rgba(255,255,255,.05);
}
.ruler span {
  position: absolute; top: 3px; font-size: 9.5px; color: var(--dim-2);
  transform: translateX(-50%);
}
.tracks { position: relative; }
.track {
  position: relative; height: 30px; margin: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.track .tname {
  position: absolute; left: 4px; top: 6px; font-size: 10px; color: var(--dim-2);
  z-index: 2; pointer-events: none;
  text-shadow: 0 1px 3px #000;
  max-width: 110px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.seg {
  position: absolute; top: 5px; height: 20px; border-radius: 5px;
  background: linear-gradient(180deg, rgba(198,166,100,.75), rgba(150,122,70,.75));
  border: 1px solid rgba(230,205,150,.65);
  cursor: grab; display: flex; align-items: center;
}
.seg.sel { box-shadow: 0 0 0 2px rgba(198,166,100,.55); }
.seg .h {
  position: absolute; top: -1px; bottom: -1px; width: 6px; cursor: ew-resize;
  background: rgba(255,255,255,.35); border-radius: 3px;
}
.seg .h.l { left: -3px; }
.seg .h.r { right: -3px; }
.seg .lbl {
  padding: 0 8px; font-size: 10px; color: #171410; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.playhead {
  position: absolute; top: 0; bottom: 0; width: 1px; background: #e05a4a;
  pointer-events: none; z-index: 4;
}
.playhead::before {
  content: ''; position: absolute; top: 0; left: -4px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 6px solid #e05a4a;
}

/* ---------------- 右侧面板 ---------------- */
.panel {
  background: var(--bg-2); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-size: 12px; color: var(--dim); letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,.05); flex: none;
}
.badge {
  padding: 1px 8px; border-radius: 10px; font-size: 10.5px;
  background: rgba(198,166,100,.15); color: var(--gold);
}
.obj-list { flex: none; max-height: 36%; overflow-y: auto; padding: 10px; }
.obj {
  display: flex; gap: 10px; padding: 8px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 7px;
}
.obj:hover { background: rgba(255,255,255,.03); }
.obj.on { background: #221f1a; border-color: rgba(198,166,100,.55); }
.obj img { width: 62px; height: 44px; border-radius: 6px; object-fit: cover; background: #222; flex: none; }
.obj .oi { flex: 1; min-width: 0; }
.obj .on-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj .on-meta { font-size: 10.5px; color: var(--dim-2); margin-top: 4px; }
.obj .on-q { font-size: 10px; color: #d0a24e; margin-top: 3px; }

.edit { flex: 1; overflow-y: auto; padding: 14px 16px 30px; border-top: 1px solid var(--line); }
.edit-title { font-size: 12px; color: var(--gold); letter-spacing: 1px; margin-bottom: 14px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 10.5px; color: var(--dim); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; height: 32px; padding: 0 10px; border-radius: 7px;
  background: #17171d; color: var(--text); border: 1px solid rgba(255,255,255,.07);
  font-size: 12px; outline: none;
}
.field input:focus, .field select:focus { border-color: rgba(198,166,100,.5); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 11px; border-radius: 14px; font-size: 11px; cursor: pointer;
  background: #17171d; color: var(--dim); border: 1px solid rgba(255,255,255,.07);
}
.chip.on { background: rgba(198,166,100,.16); border-color: var(--gold); color: var(--gold-2); }
.seg-list { max-height: 120px; overflow-y: auto; }
.seg-row {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: #17171d; border-radius: 6px; margin-bottom: 5px; font-size: 11px;
}
.seg-row .sr-t { flex: 1; color: #cfc8b8; font-variant-numeric: tabular-nums; }
.seg-row button {
  background: none; border: none; color: var(--gold); cursor: pointer; font-size: 10.5px;
  padding: 2px 4px;
}
.seg-row button.del { color: var(--err); }
.edit-actions { display: flex; gap: 8px; margin-top: 16px; }
.edit-actions .btn { flex: 1; }

/* ---------------- 结果面板 ---------------- */
.result-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.result {
  width: min(1120px, 92vw); height: min(760px, 88vh);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
}
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.result-title { font-size: 15px; color: #f4f0e7; }
.result-sub { font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.result-body { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.result-left { padding: 16px; border-right: 1px solid var(--line); overflow-y: auto; }
.result-left video { width: 100%; border-radius: 10px; background: #000; }
.artifacts { margin-top: 14px; }
.art {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.05); font-size: 12px;
}
.art .a-n { flex: 1; }
.art .a-t { font-size: 10.5px; color: var(--dim-2); }
.result-right { padding: 16px; overflow-y: auto; }
.block { margin-bottom: 18px; }
.block-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--gold); margin-bottom: 8px; letter-spacing: .5px;
}
.pre {
  padding: 12px; border-radius: 8px; background: #101014;
  font-size: 12px; line-height: 1.75; white-space: pre-wrap; color: #cfc8b8;
  font-family: inherit;
}
.pre.gold { border-left: 3px solid var(--gold); }
.tl-list .tl-i { display: flex; gap: 10px; padding: 6px 0; font-size: 11.5px; border-bottom: 1px solid rgba(255,255,255,.04); }
.tl-list .tl-i b { color: var(--gold); width: 110px; flex: none; font-weight: 500; font-variant-numeric: tabular-nums; }
.title-opts .to {
  padding: 8px 10px; border-radius: 8px; background: #17171d; margin-bottom: 6px;
  font-size: 12px; cursor: pointer; border: 1px solid transparent; line-height: 1.5;
}
.title-opts .to.on { border-color: var(--gold); background: #201d18; }
.title-opts .to em { color: var(--gold); font-style: normal; margin-right: 6px; font-size: 10.5px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-row .tg { padding: 3px 9px; border-radius: 10px; background: rgba(198,166,100,.1); color: #b9ac8e; font-size: 11px; }
.plat-row .pl { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.plat-row .pl .pl-n { flex: 1; font-size: 12px; }
.plat-row .pl .pl-r { font-size: 10.5px; color: var(--dim-2); margin-top: 3px; }

/* ---------------- 产品库抽屉 ---------------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; z-index: 51;
  background: var(--bg-2); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.drawer-tools { display: flex; gap: 8px; padding: 12px 16px 0; }
.prod-form { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.prod-form input {
  height: 32px; padding: 0 10px; border-radius: 7px; background: #17171d;
  color: var(--text); border: 1px solid rgba(255,255,255,.07); font-size: 12px; outline: none;
}
.prod-list { flex: 1; overflow-y: auto; padding: 0 16px 20px; }
.prod {
  padding: 10px; border-radius: 8px; background: #17171d; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.prod .p-i { flex: 1; min-width: 0; }
.prod .p-n { font-size: 12px; }
.prod .p-m { font-size: 10.5px; color: var(--dim-2); margin-top: 3px; }
.prod .p-x { color: var(--err); cursor: pointer; font-size: 11px; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #221f1a; color: var(--gold-2); border: 1px solid rgba(198,166,100,.4);
  padding: 10px 18px; border-radius: 10px; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 999;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { color: #f0b3aa; border-color: rgba(201,106,94,.5); }

/* ---------------------------------------------------- 粘贴抖音链接弹层 */

.sheet-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .62);
  z-index: 940; backdrop-filter: blur(2px);
}
.sheet {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 40px));
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px;
  z-index: 941; box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; font-size: 15px; font-weight: 600; color: var(--gold-2);
}
.link-help {
  font-size: 12px; line-height: 1.8; color: var(--dim);
  margin-bottom: 10px;
}
.link-help b { color: var(--gold-2); font-weight: 600; }

#linkText {
  width: 100%; resize: vertical; min-height: 92px;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 12.5px; line-height: 1.7;
  font-family: inherit; outline: none;
}
#linkText:focus { border-color: rgba(198, 166, 100, .55); }
#linkText::placeholder { color: var(--dim-2); }

/* 剪贴板诊断：读到几个字 / 空的 / 没权限，都写在这一行 */
.clip-line {
  margin-top: 8px; padding: 7px 11px; border-radius: 8px;
  font-size: 11.5px; line-height: 1.6;
  background: rgba(255, 255, 255, .035); color: var(--dim);
  display: none;
}
.clip-line.ok { display: block; color: var(--ok); background: rgba(127, 174, 134, .1); }
.clip-line.bad { display: block; color: #e0928a; background: rgba(201, 106, 94, .12); }

/* 链接判定：是不是抖音、能不能下 */
.check-line {
  margin-top: 8px; font-size: 12px; line-height: 1.7; color: var(--dim);
  display: none;
}
.check-line.ok { display: block; color: var(--ok); }
.check-line.bad { display: block; color: #e0928a; }

.sheet-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px;
}

/* 通道状态一行，不占地方但要一直看得见 */
.gate-line {
  margin-top: 12px; font-size: 11.5px; color: var(--dim-2); line-height: 1.6;
}
.gate-line.ok { color: var(--ok); }
.gate-line.bad { color: #e0928a; }

/* ---- 下载进度 ---- */
.dl-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.dl-stage { font-size: 13px; color: var(--text); }
.dl-pct { font-size: 26px; font-weight: 600; color: var(--gold-2); }
.dl-pct b { font-size: 30px; }

.dl-bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .07);
}
.dl-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  border-radius: 999px; transition: width .35s ease;
}
/* 解析信息 / 转码这种没有真实百分比，用走动条代替假进度 */
.dl-bar i.indet {
  width: 30% !important;
  animation: dl-slide 1.15s ease-in-out infinite;
}
@keyframes dl-slide {
  0% { margin-left: -30%; }
  100% { margin-left: 100%; }
}

.dl-tip {
  margin-top: 10px; font-size: 12px; color: var(--dim); line-height: 1.7;
  min-height: 18px;
}
.dl-note {
  margin-top: 14px; font-size: 11.5px; color: var(--dim-2); line-height: 1.7;
}
