/* Blue Compressor. Dark first, light via prefers-color-scheme. No external assets. */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Cascadia Mono", "Segoe UI Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --bg: #0c0e13;
  --bg-grad: none;
  --panel: rgba(255, 255, 255, 0.025);
  --surface: #141821;
  --surface-2: #191e29;
  --surface-hover: #1d2330;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e9ecf2;
  --text-2: #a3abbd;
  --text-3: #6d7588;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-ring: rgba(96, 165, 250, 0.45);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.12);
  --seg-bg: rgba(255, 255, 255, 0.04);
  --seg-active: #262d3b;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --radius: 12px;
  --titlebar-h: 56px;
  --traffic: 0px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa;
    --bg-grad: none;
    --panel: rgba(255, 255, 255, 0.55);
    --surface: #ffffff;
    --surface-2: #f7f8fb;
    --surface-hover: #f1f4f9;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.14);
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #8a94a6;
    --accent: #2563eb;
    --accent-2: #3b82f6;
    --accent-soft: rgba(37, 99, 235, 0.09);
    --accent-ring: rgba(37, 99, 235, 0.35);
    --ok: #059669;
    --ok-soft: rgba(5, 150, 105, 0.09);
    --err: #dc2626;
    --err-soft: rgba(220, 38, 38, 0.08);
    --seg-bg: rgba(15, 23, 42, 0.05);
    --seg-active: #ffffff;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.05);
  }
}

body.macos { --traffic: 76px; }

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  overflow: hidden;
}

button, input, select, textarea, label {
  font-family: inherit;
}

button { font: inherit; color: inherit; }

svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
.ico-sm { width: 14px; height: 14px; flex: none; }

.app {
  display: grid;
  grid-template-rows: var(--titlebar-h) 1fr auto;
  height: 100vh;
  background: var(--bg-grad);
}

/* Title bar ---------------------------------------------------------------- */

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 calc(18px + var(--traffic));
  height: var(--titlebar-h);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
  user-select: none;
  -webkit-user-select: none;
}
.titlebar-drag-spacer {
  flex: 1 1 20px;
  min-width: 15px;
  height: 100%;
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-icon { width: 26px; height: 26px; pointer-events: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 650; font-size: 13.5px; letter-spacing: -0.01em; }
.brand-sub { color: var(--text-3); font-size: 11.5px; }
.titlebar-right { display: flex; align-items: center; gap: 6px; }

/* Custom Headless Window Controls (Desktop only) */
.win-controls {
  display: none !important;
}
body.macos .win-controls {
  display: none !important;
}
.win-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}
.win-btn svg {
  width: 12px;
  height: 12px;
  display: block;
  pointer-events: none;
}
.win-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.win-btn-close:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.chip.cpu .chip-dot { background: var(--text-3); box-shadow: none; }

/* Layout ------------------------------------------------------------------- */

.body { display: grid; grid-template-columns: 320px 1fr; min-height: 0; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 18px 10px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.hint { margin: 8px 2px 0; color: var(--text-3); font-size: 11.5px; line-height: 1.45; }

/* Segmented control */
.seg {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--seg-bg);
  border: 1px solid var(--border);
}
.seg button {
  position: relative;
  z-index: 1;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-weight: 550;
  font-size: 12.5px;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.seg button:hover:not(.active):not(:disabled) { color: var(--text); background: rgba(127, 127, 127, 0.07); }
.seg button.active {
  color: var(--text);
  background: var(--seg-active);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border-strong);
}
.seg-quality button { height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.seg-quality b { font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em; }
.seg-quality small { font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.seg-quality button.active small { color: var(--accent-2); }
.seg button:disabled { opacity: 0.45; }

.quality-card {
  margin-top: 8px;
  padding: 11px 14px 11px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.quality-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.quality-title { font-weight: 650; font-size: 13px; }
.quality-saving { color: var(--ok); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }
.quality-text { margin: 4px 0 10px; color: var(--text-2); font-size: 11.5px; min-height: 2.9em; }
.meter { position: relative; height: 6px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.meter-legend { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Destination */
.dest-hint { display: flex; gap: 8px; align-items: baseline; }
.dest-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; color: var(--text-2); }
.link { color: var(--accent-2); font-weight: 550; cursor: pointer; flex: none; }
.link:hover { text-decoration: underline; }

/* Queue -------------------------------------------------------------------- */

.queue { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 12px;
}
.queue-title { display: flex; align-items: baseline; gap: 10px; }
.queue-title h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.queue-meta { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.queue-actions { display: flex; gap: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 550;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s, box-shadow 0.15s, opacity 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.4; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.btn.primary-soft { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-ring); }
.btn.primary-soft:hover { background: rgba(59, 130, 246, 0.22); }
.btn.primary {
  height: 38px;
  padding: 0 20px;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
}
.btn.primary:hover:not(:disabled) { background: #4b8df7; }
.btn.primary:disabled { opacity: 1; background: var(--seg-bg); color: var(--text-3); box-shadow: 0 0 0 1px var(--border) inset; }
.btn.primary.stop {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: none;
}
.btn.primary.stop:hover { background: var(--surface-hover); }
.btn.danger { background: #dc2626; color: #fff; }
.btn.danger:hover { background: #e23a3a; }

/* Empty state / drop zone */
.empty { flex: 1; display: flex; padding: 6px 22px 22px; min-height: 0; }
.empty[hidden], .list[hidden] { display: none; }
.drop-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 18px;
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.drop-zone.over { border-color: var(--accent-2); background: var(--accent-soft); }
.drop-art { position: relative; width: 96px; height: 96px; margin-bottom: 14px; }
.quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 72px;
  height: 72px;
  margin: 12px;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0.85;
}
.q { border-radius: 7px; }
.q.g { background: #22a35a; }
.q.r { background: #d9435e; }
.q.b { background: #3b78e0; }
.drop-zone.over .quad { transform: scale(0.82); }
.drop-arrow {
  position: absolute;
  right: -14px;
  bottom: -10px;
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  stroke-width: 2;
  box-shadow: 0 0 0 4px var(--bg);
}
.drop-title { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.drop-sub { color: var(--text-2); font-size: 12.5px; }
.kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
}
.drop-buttons { display: flex; gap: 8px; margin-top: 16px; }
.promises { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 34px 0 0; padding: 0 20px; list-style: none; color: var(--text-3); font-size: 11.5px; }
.promises li { display: flex; align-items: center; gap: 7px; }
.promises svg { color: var(--ok); }

/* Drop overlay over a non-empty queue */
.drop-overlay {
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1.5px dashed var(--accent-2);
  background: rgba(12, 14, 19, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
@media (prefers-color-scheme: light) { .drop-overlay { background: rgba(244, 246, 250, 0.8); } }
.drop-overlay.show { opacity: 1; }
.drop-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.drop-overlay .drop-arrow { position: static; width: 44px; height: 44px; padding: 10px; }

/* Job list */
.list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 22px 22px; display: flex; flex-direction: column; gap: 8px; }

.job {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0; /* keep full height in long queues; the list scrolls instead */
  animation: rise 0.2s ease-out both;
  transition: border-color 0.2s, background 0.2s;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.job:hover { background: var(--surface-2); }
.job.running { border-color: var(--accent-ring); }

.job-thumb {
  position: relative;
  width: 88px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--seg-bg);
  border: 1px solid var(--border);
  flex: none;
}
.job-thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.25s; }
.job-thumb-img.ready { opacity: 1; }
.job-codec {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 14px;
  color: #fff;
  background: rgba(8, 10, 14, 0.72);
  white-space: nowrap;
}
.job-thumb.bad { background: var(--err-soft); border-color: rgba(248, 113, 113, 0.25); }
.job-thumb.bad .job-codec { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); background: none; color: var(--err); font-size: 14px; }

.job-main { min-width: 0; }
.job-line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.job-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.005em; }
.job-pill {
  flex: none;
  height: 19px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  background: var(--seg-bg);
  color: var(--text-3);
}
.job-pill.running { background: var(--accent-soft); color: var(--accent-2); }
.job-pill.done { background: var(--ok-soft); color: var(--ok); }
.job-pill.failed { background: var(--err-soft); color: var(--err); }
.job-pill.paused { background: var(--seg-bg); color: var(--text-2); }
.job-meta {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-meta .sep { margin: 0 6px; opacity: 0.5; }
.job-meta .target { color: var(--accent-2); }
.job-meta.error { color: var(--err); white-space: normal; }

.job-side { text-align: right; font-variant-numeric: tabular-nums; min-width: 128px; }
.job-stat { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; }
.job-stat .good { color: var(--ok); }
.job-stat-sub { color: var(--text-3); font-size: 11.5px; margin-top: 2px; white-space: nowrap; }

.job-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.job:hover .job-actions { opacity: 1; }
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn[hidden] { display: none; }

.job-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.job.running .job-progress, .job.done .job-progress { background: var(--seg-bg); }
.job-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s linear;
  position: relative;
  overflow: hidden;
}
.job.done .job-progress-fill { background: var(--ok); opacity: 0.7; }
.job.already .job-progress { background: var(--seg-bg); }
.job.already .job-progress-fill { background: var(--ok); opacity: 0.7; }
.job.running.paused .job-progress-fill { opacity: 0.5; }
.job.running.paused .job-progress-fill::after { display: none; }

/* Footer ------------------------------------------------------------------- */

.bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.bar-progress { position: absolute; top: -1px; left: 0; right: 0; height: 2px; }
.bar-progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.3s linear; }
.bar-left { min-width: 0; }
.bar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.bar-main { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; letter-spacing: -0.005em; }
.bar-main .good { color: var(--ok); }
.bar-sub { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Modal -------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  z-index: 10;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 380px;
  padding: 24px 24px 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  transform: scale(0.97);
  transition: transform 0.18s;
}
.modal.show .modal-card { transform: none; }
.modal-icon { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(251, 191, 36, 0.12); color: var(--warn); }
.modal-icon svg { width: 22px; height: 22px; }
.modal-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 650; }
.modal-card p { margin: 0 0 18px; color: var(--text-2); font-size: 12.5px; }
.modal-buttons { display: flex; gap: 8px; justify-content: center; }
.modal-buttons .btn { height: 34px; padding: 0 16px; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(127, 127, 127, 0.25); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .body { grid-template-columns: 280px 1fr; }
  .job-side { min-width: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Same settings switch ------------------------------------------------------ */

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.switch-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.switch-title { font-weight: 600; font-size: 12.5px; }
.switch-sub { color: var(--text-3); font-size: 11px; line-height: 1.35; margin-top: 1px; }
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  background: var(--seg-bg);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: background 0.2s;
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.switch:checked { background: var(--accent); box-shadow: none; }
.switch:checked::after { transform: translateX(14px); }
.switch:disabled { opacity: 0.5; }

/* Per-clip settings in a card */
.job { cursor: pointer; }
.job-settings { display: none; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-width: 0; }
.job-main { min-width: 0; }
body.per-clip .job-settings { display: flex; }
.mini-select {
  appearance: none;
  -webkit-appearance: none;
  height: 26px;
  padding: 0 24px 0 9px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5' fill='none' stroke='%238b93a7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 6px center / 13px;
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
}
.mini-select:hover:not(:disabled) { border-color: var(--accent-ring); }
.mini-select:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent-ring); }
.mini-select:disabled { opacity: 0.5; cursor: default; }
.job.selected { border-color: var(--accent-ring); }

/* Previewer ----------------------------------------------------------------- */

.app { position: relative; }
.viewer {
  position: absolute;
  top: var(--titlebar-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  opacity: 0;
  transform: translateY(8px) scale(0.995);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.viewer.show { opacity: 1; transform: none; pointer-events: auto; }

.viewer-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.v-close { width: 32px; height: 32px; border: 1px solid var(--border); }
.v-close svg { width: 16px; height: 16px; }
.v-title { min-width: 0; flex: 1; }
.v-name { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-meta { color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-controls { display: flex; gap: 14px; align-items: center; }
.v-group { display: flex; flex-direction: column; gap: 4px; }
.v-group-label { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); padding-left: 2px; }
.seg-sm { padding: 2px; border-radius: 8px; }
.seg-sm button { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.v-squeeze { display: flex; gap: 6px; align-items: center; height: 30px; }
.v-squeeze .mini-select { height: 30px; border-radius: 8px; font-size: 12px; }
#v-squeeze-group.on .mini-select { border-color: var(--accent-ring); color: var(--accent); }
.mini-input {
  width: 64px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.mini-input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent-ring); }
.mini-input[hidden] { display: none; }

.stage {
  position: relative;
  overflow: hidden;
  background:
    repeating-conic-gradient(rgba(127, 127, 127, 0.06) 0% 25%, transparent 0% 50%) 0 0 / 22px 22px,
    #07080b;
  cursor: zoom-in;
  touch-action: none;
}
@media (prefers-color-scheme: light) { .stage { background-color: #1a1d24; } }
.stage.zoomed { cursor: grab; }
.stage.panning { cursor: grabbing; }
.stage.near-split { cursor: ew-resize; }
#v-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.v-tag {
  position: absolute;
  top: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(10, 12, 16, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.v-tag.left { left: 14px; }
.v-tag.right { right: 14px; }
.v-tag.right b { color: #93c5fd; font-weight: 650; }

.v-split {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  left: 50%;
  pointer-events: none;
}
.v-split::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 12px rgba(0, 0, 0, 0.35);
}
.v-knob {
  position: absolute;
  top: 50%;
  left: -17px;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  border-radius: 50%;
  background: #fff;
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s;
}
.stage.dragging-split .v-knob { transform: scale(1.08); }
.v-knob svg { width: 16px; height: 16px; stroke-width: 1.8; }

.v-loading {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(6px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 550;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.2s;
}
.v-loading.show { opacity: 1; transform: translateX(-50%); }
.v-loading.first { bottom: auto; top: 50%; transform: translate(-50%, -50%); }
.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #93c5fd;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.v-error {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--err);
  font-weight: 550;
  padding: 40px;
  text-align: center;
}
.v-error.show { display: flex; }
.v-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  color: rgba(229, 231, 235, 0.85);
  background: rgba(10, 12, 16, 0.5);
  pointer-events: none;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.v-hint.hide { opacity: 0; }

.viewer-bottom {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 22px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.scrub { display: flex; align-items: center; gap: 6px; min-width: 0; }
.scrub-label { display: flex; flex-direction: column; margin-left: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#v-frame-label { font-weight: 600; font-size: 12.5px; }
.scrub-tc { color: var(--text-3); font-size: 11px; font-family: var(--mono); }

.range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 120px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--seg-bg) var(--p, 50%));
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45), 0 0 0 4px var(--accent-soft);
  cursor: grab;
}
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; }

.v-estimate { text-align: right; font-variant-numeric: tabular-nums; min-width: 270px; }
.v-est-main { font-weight: 650; font-size: 14px; white-space: nowrap; }
.v-est-main .good { color: var(--ok); }
.v-est-sub { color: var(--text-3); font-size: 11.5px; white-space: nowrap; }

@media (max-width: 980px) {
  .v-group-label { display: none; }
  .v-controls { gap: 8px; }
}

/* Minimap and zoom badge, shown while zoomed in */
.v-mini {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 168px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  background: #07080b;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.2s;
  cursor: move;
}
.stage.zoomed .v-mini { opacity: 1; transform: none; pointer-events: auto; }
#v-mini-canvas { display: block; width: 100%; }
.v-mini-view {
  position: absolute;
  border: 1.5px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 999px rgba(7, 8, 11, 0.5);
  pointer-events: none;
}
.v-zoom-badge {
  position: absolute;
  right: 14px;
  top: 48px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(10, 12, 16, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}
.stage.zoomed .v-zoom-badge { opacity: 1; }
.stage.zoomed .v-hint { opacity: 0; }

/* Finished clip: what it was compressed with, and a way to make another version */
.job-after { grid-column: 2 / -1; display: flex; align-items: center; gap: 10px; margin-top: -6px; font-size: 11.5px; color: var(--text-3); min-width: 0; }
.job-thumb { grid-row: span 2; align-self: start; }
.job:not(.done):not(.failed):not(.cancelled) .job-thumb { grid-row: auto; align-self: center; }
.job-after[hidden] { display: none; }
.job-proxy-error { color: var(--err); }
.job-r3d-skipped { color: var(--text-2); }
.job-after-info { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-after .sep { margin: 0 6px; opacity: 0.5; }
.job-out { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.link-btn {
  flex: none;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
}
.link-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.link-btn:disabled { opacity: 0.4; }
.job.flash { border-color: var(--accent-ring); background: var(--surface-2); }

.modal-card .btn.primary { height: 34px; padding: 0 18px; }
.job.done .job-settings, .job.failed .job-settings, .job.cancelled .job-settings { display: none; }
.seg.inactive button.active { background: transparent; box-shadow: 0 0 0 1px var(--border) inset; color: var(--text-2); }
.seg.inactive { opacity: 0.6; }

/* Watch folder status and Web UI server file browser ----------------------- */

.chip-dot.running { background: var(--accent-2); }
.chip-dot.stabilizing { background: var(--warn); }

.watch-card {
  padding: 11px 13px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.watch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.watch-preset { font-weight: 600; font-size: 12.5px; }
.watch-dirs { font-family: var(--mono); font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-stats { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.watch-meter { margin-top: 2px; }
.watch-controls { display: grid; grid-template-columns: 4fr 3fr; gap: 6px; margin-top: 4px; }
.watch-controls .seg-sm button { padding: 0 4px; font-size: 11.5px; height: 24px; }
.watch-clear-row {
  margin: 4px 0 0;
  padding: 8px 10px;
  background: var(--surface-2);
  border-color: var(--border);
}
.watch-clear-row .switch-title { font-size: 12px; }
.watch-clear-row .switch-sub { font-size: 10.5px; }

#fs-modal .fs-card {
  width: min(720px, calc(100vw - 36px));
  max-height: calc(100vh - 48px);
  padding: 18px 20px 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fs-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.fs-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.fs-roots { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-roots:empty { display: none; }
.fs-root-btn {
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}
.fs-root-btn:hover, .fs-root-btn.active { border-color: var(--accent-ring); color: var(--text); background: var(--accent-soft); }
.fs-nav, .fs-mkdir-row { display: flex; gap: 6px; align-items: center; }
.fs-nav[hidden], .fs-mkdir-row[hidden], .fs-error[hidden], .btn[hidden], .chip[hidden], section[hidden] { display: none !important; }
.fs-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}
.fs-input:focus { outline: none; border-color: var(--accent-ring); box-shadow: 0 0 0 2px var(--accent-soft); }
.fs-error {
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--err-soft);
  color: var(--err);
  font-size: 12px;
}
.fs-list {
  flex: 1;
  min-height: 240px;
  max-height: 380px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fs-empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
}
.fs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid transparent;
}
.fs-row:hover { background: var(--surface-hover); }
.fs-row.selected { background: var(--accent-soft); border-color: var(--accent-ring); }
.fs-row-ico { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.fs-row.dir .fs-row-ico { color: var(--accent-2); }
.fs-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.fs-row-badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 650;
  background: var(--seg-bg);
  color: var(--text-2);
  flex: none;
}
.fs-row-meta { color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; flex: none; }
.fs-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}
.fs-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 12px;
  font-family: var(--mono);
}
.fs-buttons { display: flex; gap: 8px; flex: none; }

/* Compression: quick picks and bits per pixel ---------------------------------- */

.seg-picks button { height: 34px; font-size: 12.5px; }
.bpp-card {
  margin-top: 8px;
  padding: 11px 14px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.comp-text { margin: 0 0 4px; color: var(--text-2); font-size: 11.5px; line-height: 1.45; min-height: 1.45em; }
.comp-readout { font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; min-height: 1.4em; margin-bottom: 10px; }
.comp-readout:empty { display: none; }
.bpp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bpp-title { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); cursor: help; }
.bpp-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  cursor: text;
}
.bpp-value:focus-within { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent-ring); }
.bpp-value input {
  width: 3.6ch;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: right;
}
.bpp-value input:focus { outline: none; }
.bpp-value input:disabled { color: var(--text-3); }
.bpp-unit { color: var(--text-3); font-weight: 500; }
.bpp-unit[hidden] { display: none; }
/* The bpp slider: a 36px tall input (the whole height is the hit area; clicking anywhere
   on it jumps the thumb there) drawing a 4px track and a 16px thumb in the middle. */
.bpp-slider { position: relative; display: flex; padding: 12px 0 0; }
.bpp-slider .range {
  min-width: 0;
  width: 100%;
  height: 36px;
  margin: 0;
  background: transparent;
  touch-action: none;
  --track: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--seg-bg) var(--p, 50%));
}
.bpp-slider .range.lossless { --track: linear-gradient(90deg, var(--ok) 100%, var(--seg-bg) 100%); }
.bpp-slider .range::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--track); }
.bpp-slider .range::-webkit-slider-thumb { margin-top: -6px; }
.bpp-slider .range:active::-webkit-slider-thumb { cursor: grabbing; }
.bpp-slider .range::-moz-range-track { height: 4px; border-radius: 999px; background: var(--track); }
.bpp-slider .range:focus-visible::-webkit-slider-thumb { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45), 0 0 0 5px var(--accent-ring); }
.bpp-sources { position: absolute; left: 8px; right: 8px; top: 0; bottom: 0; pointer-events: none; }
.bpp-source {
  position: absolute;
  top: 22px;
  width: 3px;
  height: 16px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--warn);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.bpp-ticks { position: relative; height: 20px; margin: -10px 8px 0; pointer-events: none; }
.bpp-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bpp-tick i { display: block; width: 1px; height: 5px; background: var(--border-strong); margin-bottom: 2px; }
.bpp-tick b { font-weight: 550; }
.bpp-note { min-height: 1.45em; margin: 4px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bpp-he {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 12px;
  letter-spacing: 0.02em;
  color: var(--accent-2);
  pointer-events: auto;
  cursor: help;
}
.bpp-note.warn { color: var(--warn); }
.job-b { width: 72px; height: 26px; }
.job-bpp { color: var(--text-2); }
#v-bpp { width: 76px; }
.watch-bpp { width: 64px; height: 28px; }
.watch-controls { grid-template-columns: 1fr auto; }
.watch-controls #watch-resolution { grid-column: 1 / -1; }
.bpp-card[hidden], .field[hidden], .v-group[hidden] { display: none; }
.watch-controls > * { min-width: 0; }
.bpp-target {
  position: absolute;
  top: 25.5px;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--surface);
  pointer-events: auto;
}

/* Updates: sidebar setting, prompt and the Web UI banner --------------------- */
.update-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.update-row .btn { height: 28px; padding: 0 12px; flex: none; }
.update-status { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-card { width: 420px; }
.update-icon { background: var(--accent-soft); color: var(--accent-2); }
.update-notes {
  max-height: 150px;
  overflow: auto;
  margin: -6px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}
.update-notes:empty { display: none; }
.update-notes ul { margin: 0; padding-left: 16px; }
.update-notes li + li { margin-top: 3px; }
.update-progress { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.update-progress[hidden], .update-msg[hidden], .update-skip[hidden], .update-banner[hidden], .update-banner-steps[hidden] { display: none; }
.update-bar { height: 6px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
.update-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.2s ease; }
.update-msg { margin: -4px 0 16px !important; font-size: 12px !important; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-2); font: inherit; font-size: 12px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.update-skip { display: block; margin: 12px auto 0; color: var(--text-3); font-size: 11.5px; }
.update-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--accent-ring);
  background: var(--accent-soft);
  font-size: 12.5px;
}
.update-banner-main { display: flex; align-items: center; gap: 10px; }
.update-banner-main svg { color: var(--accent-2); flex: none; }
.update-banner-main > span { font-weight: 600; flex: 1; min-width: 0; }
.update-banner .icon-btn { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; }
.update-banner .icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.update-banner-steps { margin-top: 8px; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.update-banner-steps p { margin: 0 0 6px; }
.update-banner-steps ol { margin: 0 0 6px; padding-left: 18px; }
.update-banner-steps li + li { margin-top: 4px; }
.update-banner-steps code { font-size: 11px; padding: 1px 4px; border-radius: 4px; background: var(--surface-2); }
.update-banner-steps a { color: var(--accent-2); }

.badge-exp { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 0.85em; background: rgba(255, 170, 0, 0.18); color: #c77d00; }
.switch-row.dim, .select-row.dim { opacity: 0.5; }
.switch-note { display: block; color: var(--warn, #d9a441); font-size: 11px; line-height: 1.35; margin-top: 2px; }
.switch-note[hidden] { display: none; }
.select-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 8px; }
.lang-pick { display: inline-flex; align-items: center; gap: 4px; color: var(--muted, #888); }
.lang-pick select { background: transparent; color: inherit; border: 1px solid rgba(127, 127, 127, 0.3); border-radius: 6px; padding: 2px 4px; font: inherit; font-size: 12px; max-width: 150px; }
.lang-pick svg { fill: none; stroke: currentColor; stroke-width: 1.2; }
:lang(ja), :lang(ko), :lang(zh-Hans), :lang(zh-Hant) { line-break: strict; font-family: var(--font) !important; }
.switch-title, .switch-sub, .field-label, .btn, .job-pill { overflow-wrap: anywhere; hyphens: auto; }

/* Info icon next to a switch title; its text shows in a floating tooltip. */
.switch-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.info { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--text-3); color: var(--text-3); font: 600 9.5px/1 var(--font); font-style: italic; cursor: help; user-select: none; }
.info:hover, .info:focus-visible { color: var(--text); border-color: currentColor; outline: none; }
.tip { position: fixed; z-index: 1000; padding: 7px 9px; border-radius: 6px; background: #1d2230; color: #e8ecf4; font-size: 11.5px; line-height: 1.4; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); pointer-events: none; white-space: pre-line; }
.tip[hidden] { display: none; }

/* Preview: every row and column may shrink to the window, the frame is fitted (contain)
   inside the stage, the toolbar wraps and the frame info wraps instead of overflowing. */
.viewer { grid-template-columns: minmax(0, 1fr); }
.viewer > * { min-width: 0; }
.stage { min-height: 0; }
.viewer-top { flex-wrap: wrap; row-gap: 8px; }
.v-title { flex: 1 1 180px; }
.v-controls { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; min-width: 0; max-width: 100%; }
.viewer-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto; row-gap: 8px; }
.v-estimate { min-width: 0; max-width: 46vw; }
.v-est-main, .v-est-sub { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) {
  .v-controls { flex: 1 1 100%; justify-content: flex-start; }
}
@media (max-width: 860px) {
  .viewer-bottom { grid-template-columns: minmax(0, 1fr) auto; }
  .v-estimate { grid-column: 1 / -1; grid-row: 2; text-align: left; max-width: none; }
  .v-est-main, .v-est-sub { white-space: normal; }
  .v-apply-wrap, #v-apply { grid-row: 1; grid-column: 2; }
}

/* Develop ------------------------------------------------------------------ */

.tabs {
  width: auto;
  min-width: 360px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
}
.tabs button {
  flex: 1 1 0;
  min-width: 100px;
  height: 32px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -0.01em;
  cursor: pointer;
  pointer-events: auto;
}
.develop {
  position: absolute;
  top: var(--titlebar-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.develop[hidden] { display: none; }
.dev-intro { margin: 0; padding: 10px 18px; color: var(--text-2); font-size: 12.5px; border-bottom: 1px solid var(--border); }
.dev-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-2); }
.dev-empty[hidden], .dev-work[hidden] { display: none; }
.dev-work { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr) 320px; }
.dev-list { overflow: auto; border-right: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.dev-clip { text-align: left; border: 1px solid transparent; background: transparent; color: var(--text); border-radius: 8px; padding: 7px 9px; display: flex; flex-direction: column; gap: 2px; }
.dev-clip:hover { background: var(--surface-hover); }
.dev-clip.on { background: var(--accent-soft); border-color: var(--accent-ring); }
.dev-clip-name { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-clip-sub { font-size: 11px; color: var(--text-3); }
.dev-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 10px 14px; gap: 8px; }
.dev-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dev-top .v-title { min-width: 0; }
.dev-top .v-name, .dev-top .v-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-stage { position: relative; flex: 1; min-height: 120px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: rgba(127, 127, 127, 0.14); border-radius: 8px; }
.dev-stage { cursor: zoom-in; touch-action: none; }
.dev-stage.zoomed { cursor: grab; }
.dev-stage.zoomed.panning { cursor: grabbing; }
.dev-stage canvas { display: block; position: absolute; image-rendering: auto; }
.dev-stage.zoomed .v-zoom-badge { opacity: 1; top: 10px; }
.dev-top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dev-group { display: flex; flex-direction: column; gap: 14px; }
.dev-group-body { display: flex; flex-direction: column; gap: 14px; }
.dev-group.collapsed .dev-group-body { display: none; }
.dev-sec-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 6px; cursor: pointer; margin-top: 12px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.dev-sec-btn:hover { color: var(--text-2); }
.dev-sec-btn:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; border-radius: 4px; }
.dev-chev { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform 0.15s; }
.dev-group.collapsed .dev-chev { transform: rotate(-90deg); }
.dev-lut-remove { align-self: flex-start; }
.dev-stage .v-error { white-space: pre-line; }
.dev-stage .v-loading[hidden], .dev-stage .v-error[hidden] { display: none; }
.dev-panel { overflow: auto; border-left: 1px solid var(--border); padding: 12px 14px 18px; display: flex; flex-direction: column; gap: 14px; }
.dev-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dev-actions .btn { flex: 1; }
.dev-sec { margin-top: 12px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
#dev-controls, #dev-export { display: flex; flex-direction: column; gap: 14px; }
.dev-row { display: flex; flex-direction: column; gap: 6px; }
.dev-row .dev-check { margin-top: 4px; }
.dev-row.off { opacity: 0.45; }
.dev-row-head { display: flex; align-items: center; gap: 6px; }
.dev-label { flex: 1; font-size: 12.5px; color: var(--text-2); }
.dev-num { width: 72px; text-align: right; }
.dev-unit { width: 30px; font-size: 11px; color: var(--text-3); }
.dev-select { width: 100%; }
.dev-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
body.tab-develop .viewer { display: none; }

/* Narrow and short windows: nothing overlaps, fields keep their content. */
.queue-head { flex-wrap: wrap; row-gap: 8px; }
.queue-actions { flex-wrap: wrap; justify-content: flex-end; }
.empty { overflow: auto; flex-direction: column; }
.drop-zone { justify-content: safe center; flex-shrink: 0; min-height: 100%; height: auto; padding: 16px; text-align: center; box-sizing: border-box; }
.seg button { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .seg-picks { display: grid; grid-template-columns: 1fr 1fr; }
  .seg-picks button { overflow: visible; }
}
.drop-sub { max-width: 100%; }
.bpp-head { flex-wrap: wrap; }
.bpp-value { flex: none; }
.bpp-value input { min-width: 3ch; }
.brand { min-width: 0; }
.brand-text { min-width: 0; }
.brand-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-height: 760px), (max-width: 1100px) {
  .drop-art { width: 64px; height: 64px; margin-bottom: 6px; }
  .quad { width: 48px; height: 48px; margin: 8px; gap: 4px; }
  .q { border-radius: 5px; }
  .drop-arrow { width: 26px; height: 26px; right: -10px; bottom: -8px; }
}
@media (max-width: 1100px) {
  .brand-sub { display: none; }
}
@media (max-width: 900px) {
  .body { grid-template-columns: 260px minmax(0, 1fr); }
  .queue-head { padding: 14px 16px 10px; }
  .empty { padding: 6px 16px 16px; }
  .queue-actions .btn { padding: 0 9px; }
}

/* Convert: one choice for the output format, like the compression picks. */
.convert-label { display: flex; align-items: center; gap: 6px; }
.seg-convert { margin-bottom: 8px; }
@media (max-width: 900px) { .seg-picks.seg-convert { display: flex; } }
.switch-row[hidden] { display: none; }

/* Range of the clip targets of a pick: under the track, never on the knob. */
.bpp-span {
  position: absolute;
  top: 37px;
  height: 3px;
  min-width: 3px;
  border-radius: 999px;
  background: var(--accent-2);
  opacity: 0.55;
  pointer-events: auto;
  cursor: help;
}
.bpp-span.one { margin-left: -1.5px; }

.dev-transport .range { flex: 1; }
.dev-transport .icon-btn { flex: none; cursor: pointer; }
.dev-transport .scrub-tc { min-width: 92px; text-align: right; white-space: nowrap; }

/* Develop Timeline & In/Out Scrubber */
.dev-timeline-box {
  flex: 1;
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0 4px;
}
.dev-timeline-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--border-strong);
  border-radius: 4px;
  overflow: visible;
  pointer-events: none;
}
.dev-range-highlight {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--accent-soft);
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  pointer-events: none;
  left: 0%;
  width: 100%;
}
.dev-timeline-handle {
  position: absolute;
  top: -6px;
  width: 14px;
  height: 20px;
  background: var(--accent);
  border: 1px solid var(--accent-2);
  border-radius: 3px;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  z-index: 6;
  user-select: none;
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  transition: transform 0.1s ease;
}
.dev-timeline-handle:hover, .dev-timeline-handle.dragging {
  transform: translateX(-50%) scale(1.15);
}
.dev-handle-in {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}
.dev-handle-out {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}
.dev-playhead {
  position: absolute;
  top: -8px;
  width: 2px;
  height: 24px;
  background: var(--text);
  pointer-events: none;
  z-index: 7;
  transform: translateX(-50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}
.dev-timeline-slider {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 4;
  margin: 0;
}
.dev-io-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
}
.btn-io {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 550;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-io:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.dev-cut-stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-2);
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
}
.dev-lossless-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.dev-lossless-desc {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Queue Cut Badge */
.job-cut-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  margin-left: 8px;
  flex: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.job-cut-badge:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.job-cut-badge[hidden] {
  display: none !important;
}

.job-cut-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent);
  font-size: 11px;
  font-weight: 550;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 6px;
  cursor: default;
}

/* Full-Page Trim XML matching Develop & Compress theme */
.trim-xml {
  position: absolute;
  top: var(--titlebar-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.trim-xml[hidden] {
  display: none !important;
}

.trim-intro {
  margin: 0;
  padding: 10px 18px;
  color: var(--text-2);
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.trim-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-2);
  padding: 24px;
  background: var(--bg);
}
.trim-empty[hidden],
.trim-work[hidden] {
  display: none !important;
}

.trim-empty-card {
  max-width: 540px;
  width: 100%;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 44px 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.trim-empty-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.trim-work {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 320px;
  background: var(--bg);
}

/* Sidebar / Clip List */
.trim-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.trim-sidebar-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trim-sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.trim-search-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  box-sizing: border-box;
  outline: none;
}
.trim-search-input:focus {
  border-color: var(--accent);
}
.trim-clip-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trim-clip-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.trim-clip-item:hover {
  background: var(--surface-hover);
}
.trim-clip-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
}
.trim-clip-name {
  font-size: 12px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trim-clip-meta {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
}

/* Center Area */
.trim-center {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  gap: 12px;
  overflow-y: auto;
  background: var(--bg);
}
.trim-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.trim-proj-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.trim-proj-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
.trim-stat-chips {
  display: flex;
  gap: 8px;
}

/* Canvas Visualizer Card */
.trim-canvas-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.trim-canvas-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-2);
}
.trim-canvas-container {
  min-height: 180px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  cursor: crosshair;
}
#trim-timeline-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.trim-timeline-inspector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-2);
  min-height: 28px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.trim-timeline-inspector .ins-highlight {
  color: var(--accent);
  font-weight: 600;
}
.trim-timeline-inspector .ins-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #0284c7;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  margin-right: 6px;
}
.trim-timeline-inspector .ins-missing {
  background: #dc2626;
}

/* Savings Banner */
.trim-stats-banner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.trim-stat-box {
  text-align: center;
}
.trim-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.trim-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}
.trim-val-highlight {
  color: var(--accent);
}
.trim-val-saved {
  color: var(--ok);
}
.trim-stat-arrow {
  font-size: 16px;
  color: var(--text-3);
}
.trim-stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* Progress Log Card */
.trim-log-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.trim-log-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  margin-bottom: 8px;
}
.trim-log-messages {
  max-height: 120px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.6;
  margin-top: 8px;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 8px;
}

/* Right Panel */
.trim-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 14px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.trim-setting-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trim-label {
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
}
.trim-input {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  box-sizing: border-box;
  outline: none;
}
.trim-input:focus {
  border-color: var(--accent);
}

/* Sleek F <-> S Toggle Switch */
.trim-toggle-fs {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.trim-fs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font) !important;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 0;
  line-height: 1;
}
.trim-fs-btn:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
.trim-fs-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-weight: 800;
}
