/*
 * FFmpeg WebCLI × Tubox-inspired three-column workbench
 * Version: 1.0 (2026-11-08) — adapted to the local docs/index.html
 *
 * Assumes the HTML carries:
 * .workspace-shell, .workspace-sidebar, .workspace-stage, .workspace-inspector,
 * .tool-nav-group, .tool-nav-group__title and .tool-nav-group__items.
 *
 * It preserves the original FFmpeg class names and IDs. This is not a drop-in
 * visual reskin for the old two-column DOM by itself.
 */

:root {
  color-scheme: light;
  --wb-bg: #fafafa;
  --wb-panel: #ffffff;
  --wb-subtle: #f4f4f5;
  --wb-subtle-2: #efeff1;
  --wb-line: #e4e4e7;
  --wb-fg: #09090b;
  --wb-muted: #71717a;
  --wb-brand: #5b5bd6;
  --wb-brand-hover: #4c4cc4;
  --wb-brand-soft: #eeeefc;
  --wb-accent: #a855f7;
  --wb-success: #16a34a;
  --wb-success-soft: #f0fdf4;
  --wb-warning: #ca8a04;
  --wb-warning-soft: #fefce8;
  --wb-danger: #dc2626;
  --wb-danger-soft: #fef2f2;
  --wb-radius-panel: 16px;
  --wb-radius-control: 9px;
  --wb-gap: 16px;
  --wb-sidebar-width: 240px;
  --wb-inspector-width: 344px;
  --wb-shadow-soft: 0 0 0 1px rgb(0 0 0 / .02), 0 1px 2px rgb(0 0 0 / .035), 0 8px 24px -14px rgb(0 0 0 / .12);
  --wb-shadow-raised: 0 0 0 1px rgb(0 0 0 / .025), 0 2px 4px rgb(0 0 0 / .035), 0 12px 30px -16px rgb(0 0 0 / .16);
  --wb-font-sans: "Geist Variable", Geist, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --wb-font-mono: "SFMono-Regular", Consolas, "Cascadia Code", "Fira Code", monospace;

  /* Compatibility aliases used by the upstream inline CSS and JS. */
  --bg: var(--wb-bg);
  --surface: var(--wb-panel);
  --surface2: var(--wb-subtle);
  --surface3: var(--wb-subtle-2);
  --accent: var(--wb-brand);
  --accent-h: var(--wb-brand-hover);
  --success: var(--wb-success);
  --danger: var(--wb-danger);
  --warn: var(--wb-warning);
  --text: var(--wb-fg);
  --muted: var(--wb-muted);
  --border: var(--wb-line);
  --r: var(--wb-radius-panel);
}

:root[data-theme="dark"],
html.dark,
body.dark {
  color-scheme: dark;
  --wb-bg: #09090b;
  --wb-panel: #111114;
  --wb-subtle: #1a1a1f;
  --wb-subtle-2: #202027;
  --wb-line: #27272e;
  --wb-fg: #fafafa;
  --wb-muted: #9696a2;
  --wb-brand: #8b8dff;
  --wb-brand-hover: #a1a3ff;
  --wb-brand-soft: #1e1e3c;
  --wb-accent: #c084fc;
  --wb-success: #4ade80;
  --wb-success-soft: #102318;
  --wb-warning: #facc15;
  --wb-warning-soft: #29230d;
  --wb-danger: #f87171;
  --wb-danger-soft: #2b1517;
  --wb-shadow-soft: 0 0 0 1px rgb(255 255 255 / .025), 0 1px 2px rgb(0 0 0 / .42), 0 12px 32px -16px rgb(0 0 0 / .62);
  --wb-shadow-raised: 0 0 0 1px rgb(255 255 255 / .035), 0 3px 8px rgb(0 0 0 / .42), 0 24px 48px -24px rgb(0 0 0 / .72);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --wb-bg: #09090b;
    --wb-panel: #111114;
    --wb-subtle: #1a1a1f;
    --wb-subtle-2: #202027;
    --wb-line: #27272e;
    --wb-fg: #fafafa;
    --wb-muted: #9696a2;
    --wb-brand: #8b8dff;
    --wb-brand-hover: #a1a3ff;
    --wb-brand-soft: #1e1e3c;
    --wb-accent: #c084fc;
    --wb-success: #4ade80;
    --wb-success-soft: #102318;
    --wb-warning: #facc15;
    --wb-warning-soft: #29230d;
    --wb-danger: #f87171;
    --wb-danger-soft: #2b1517;
    --wb-shadow-soft: 0 0 0 1px rgb(255 255 255 / .025), 0 1px 2px rgb(0 0 0 / .42), 0 12px 32px -16px rgb(0 0 0 / .62);
    --wb-shadow-raised: 0 0 0 1px rgb(255 255 255 / .035), 0 3px 8px rgb(0 0 0 / .42), 0 24px 48px -24px rgb(0 0 0 / .72);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--wb-bg);
  scrollbar-color: var(--wb-line) transparent;
  scrollbar-width: thin;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--wb-bg);
  color: var(--wb-fg);
  font-family: var(--wb-font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--wb-brand);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in srgb, var(--wb-brand) 22%, transparent);
}

/* ── Global header and status ─────────────────────────────────────── */
header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--wb-line);
  background: var(--wb-panel);
}

header h1 {
  margin: 0;
  color: var(--wb-fg);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

header > svg {
  flex: 0 0 auto;
}

.pill,
.badge-local,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--wb-subtle);
  color: var(--wb-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.badge-local {
  background: var(--wb-success-soft);
  color: var(--wb-success);
}

/* Light/dark switch — the label shows the mode it will switch to. */
.theme-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--wb-line);
  border-radius: 9px;
  background: var(--wb-panel);
  color: var(--wb-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.theme-toggle:hover {
  background: var(--wb-subtle);
  color: var(--wb-fg);
}

.theme-toggle i {
  font-size: 12px;
}


/* Header tool-readiness chip, matches the workbench tokens. */
.tool-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .3s, color .3s;
}

.tool-status.loading { background: var(--wb-warning-soft); color: var(--wb-warning); }
.tool-status.ready   { background: var(--wb-success-soft); color: var(--wb-success); }
.tool-status.stopped { background: var(--wb-subtle-2); color: var(--wb-muted); }
.tool-status.error   { background: var(--wb-danger-soft); color: var(--wb-danger); }

.container {
  width: min(100%, 1840px);
  max-width: none;
  margin: 0 auto;
  padding: 16px 20px 28px;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid var(--wb-line);
  border-radius: 12px;
  background: var(--wb-panel);
  box-shadow: var(--wb-shadow-soft);
}

#statusText {
  color: var(--wb-muted);
  font-size: 12px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wb-danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wb-danger) 12%, transparent);
}

.dot.loaded {
  background: var(--wb-success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wb-success) 13%, transparent);
}

.dot.loading {
  background: var(--wb-warning);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wb-warning) 13%, transparent);
  animation: wb-pulse 1.2s ease-in-out infinite;
}

@keyframes wb-pulse {
  50% { opacity: .55; }
}

.ml-auto {
  margin-left: auto;
}

/* ── Three-column workbench ────────────────────────────────────────── */
.workspace-shell {
  display: grid;
  grid-template-columns: minmax(216px, var(--wb-sidebar-width)) minmax(420px, 1fr) minmax(316px, var(--wb-inspector-width));
  align-items: start;
  gap: var(--wb-gap);
  min-width: 0;
}

.workspace-sidebar,
.workspace-inspector {
  position: sticky;
  top: 14px;
  min-width: 0;
  max-height: calc(100vh - 28px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--wb-line) transparent;
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-panel);
  background: var(--wb-panel);
  box-shadow: var(--wb-shadow-soft);
}

.workspace-sidebar {
  padding: 14px 10px 16px;
}

.workspace-inspector {
  padding: 0;
}

.workspace-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Cards keep their natural height so the stage column scrolls instead of
   squashing the preview or the output card. */
.workspace-stage > * {
  flex: 0 0 auto;
}

.workspace-sidebar__heading,
.workspace-inspector__heading,
.workspace-stage__eyebrow {
  padding: 2px 9px 12px;
  color: var(--wb-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.workspace-inspector__heading {
  padding: 17px 17px 12px;
}

/* ── Tool navigation: existing .op-tile nodes were moved here ──────── */
.tool-nav {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.tool-nav-group {
  min-width: 0;
}

.tool-nav-group__title {
  margin: 0 8px 5px;
  color: var(--wb-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.tool-nav-group__items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  margin: 0;
}

.op-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--wb-muted);
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.35;
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}

.op-tile i {
  display: inline-flex;
  flex: 0 0 17px;
  align-items: center;
  justify-content: center;
  width: 17px;
  margin: 0;
  color: currentColor;
  font-size: 14px;
}

.op-tile:hover:not(.disabled) {
  border-color: transparent;
  background: var(--wb-subtle);
  color: var(--wb-fg);
}

.op-tile.active {
  border-color: color-mix(in srgb, var(--wb-brand) 12%, transparent);
  background: var(--wb-brand-soft);
  color: var(--wb-brand);
  font-weight: 650;
}

.op-tile.disabled {
  opacity: .46;
  cursor: not-allowed;
}

.op-tile.disabled:hover {
  border-color: transparent;
  background: transparent;
  color: var(--wb-muted);
}

/* Anchor tiles open the standalone AI feature pages (docs/ai/*.html). */
a.op-tile {
  position: relative;
  text-decoration: none;
}

a.op-tile:focus-visible {
  outline: 2px solid var(--wb-brand);
  outline-offset: 1px;
}

/* 付费 AI 入口的常驻高亮徽标：渐变流动 + 呼吸光晕 + 扫光。 */
.op-tile__new {
  position: absolute;
  top: 3px;
  right: 5px;
  isolation: isolate;
  overflow: hidden;
  padding: 1px 5px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--wb-brand) 0%, #a855f7 38%, #ec4899 68%, var(--wb-brand) 100%);
  background-size: 260% 100%;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: .05em;
  text-shadow: 0 1px 1px rgba(49, 12, 82, .32);
  box-shadow: 0 0 0 0 rgba(124, 58, 237, .5), 0 0 6px rgba(236, 72, 153, .35);
  animation: ai-new-flow 3.2s linear infinite, ai-new-pulse 1.8s ease-in-out infinite;
}

.op-tile__new::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .85) 50%, transparent 70%);
  transform: translateX(-130%);
  pointer-events: none;
  animation: ai-new-shine 2.4s ease-in-out infinite;
}

@keyframes ai-new-flow {
  to { background-position: 260% 0; }
}

@keyframes ai-new-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(124, 58, 237, .5), 0 0 6px rgba(236, 72, 153, .35);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0), 0 0 12px rgba(236, 72, 153, .7);
  }
}

@keyframes ai-new-shine {
  0%, 32% { transform: translateX(-130%); }
  72%, 100% { transform: translateX(170%); }
}

@media (prefers-reduced-motion: reduce) {
  .op-tile__new {
    animation: none;
    background: linear-gradient(120deg, var(--wb-brand), #a855f7);
    background-size: 100% 100%;
    box-shadow: 0 0 0 1px rgba(124, 58, 237, .35);
  }
  .op-tile__new::after { display: none; }
}

/* ── Cards / stage surfaces ───────────────────────────────────────── */
.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-panel);
  background: var(--wb-panel);
  box-shadow: var(--wb-shadow-soft);
}

.card + .card {
  margin-top: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--wb-line);
  background: var(--wb-panel);
  color: var(--wb-fg);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-transform: none;
}

.card-body {
  min-width: 0;
  padding: 16px;
}

/* Stage can use a subtle Tubox-like dotted field, but never over the video. */
.stage-dots {
  background-color: var(--wb-bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 50% 45%, color-mix(in srgb, var(--wb-panel) 92%, transparent), transparent 72%),
    radial-gradient(color-mix(in srgb, var(--wb-fg) 7%, transparent) 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px;
}

/* ── Upload / input preview ────────────────────────────────────────── */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  padding: 28px 20px;
  border: 1px dashed color-mix(in srgb, var(--wb-muted) 38%, var(--wb-line));
  border-radius: 13px;
  background: var(--wb-subtle);
  color: var(--wb-muted);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.drop-zone:hover,
.drop-zone.over {
  border-color: var(--wb-brand);
  background: var(--wb-brand-soft);
  color: var(--wb-brand);
}

.drop-zone svg,
.drop-zone i {
  color: currentColor;
  opacity: .78;
}

.drop-zone p {
  color: inherit;
  font-size: 13px;
}

.drop-zone strong {
  color: var(--wb-brand);
}

#fileInput {
  display: none;
}

video,
audio {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  background: #09090b;
}

#inputVideo {
  max-height: min(58vh, 560px);
  object-fit: contain;
}

#outVideo {
  max-height: 460px;
  object-fit: contain;
}

.file-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--wb-muted);
  font-size: 12px;
}

/* ── Batch queue ───────────────────────────────────────────────────── */
.batch-queue-list {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--wb-line);
}

.batch-file-item,
.stack-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 5px 0;
  padding: 9px 10px;
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  background: var(--wb-panel);
}

/* ── Trim timeline ─────────────────────────────────────────────────── */
#trimCard .card-body {
  padding-top: 13px;
}

.trim-row {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.trim-col {
  flex: 1;
  min-width: 0;
}

.trim-col label {
  display: block;
  margin-bottom: 5px;
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 550;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--wb-brand);
  cursor: pointer;
}

.time-val {
  margin-top: 4px;
  color: var(--wb-fg);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.timeline {
  position: relative;
  height: 10px;
  margin: 13px 0 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--wb-subtle-2);
}

.tl-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-right: 2px solid var(--wb-brand);
  border-left: 2px solid var(--wb-brand);
  background: color-mix(in srgb, var(--wb-brand) 28%, transparent);
  transition: left .05s, width .05s;
}

.tl-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--wb-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.tag {
  margin-left: 5px;
  background: var(--wb-brand-soft);
  color: var(--wb-brand);
  font-size: 10px;
}

/* ── Inspector / operation settings ────────────────────────────────── */
.workspace-inspector > .card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.workspace-inspector > .card > .card-body {
  padding: 0 15px 16px;
}

.op-panel {
  margin: 0 0 14px;
  padding: 0 0 14px;
  border: 0;
  border-bottom: 1px solid var(--wb-line);
  border-radius: 0;
  background: transparent;
}

.op-panel h4 {
  margin: 0 0 12px;
  color: var(--wb-fg);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.015em;
  text-transform: none;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.form-group {
  flex: 1 1 120px;
  min-width: 0;
}

label.lbl {
  display: block;
  margin: 0 0 6px;
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 550;
}

input[type="number"],
input[type="text"],
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-control);
  outline: none;
  background: var(--wb-panel);
  color: var(--wb-fg);
  font-size: 13px;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
  font-family: var(--wb-font-mono);
  font-size: 12px;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--wb-muted) 68%, transparent);
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--wb-brand) 62%, var(--wb-line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wb-brand) 11%, transparent);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .58;
  background: var(--wb-subtle);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--wb-brand);
}

.hint {
  margin-top: 6px;
  color: var(--wb-muted);
  font-size: 11.5px;
  line-height: 1.55;
}

/* Crop UI stays in its original op-panel and keeps all original IDs. */
.crop-toolbar,
.crop-summary {
  color: var(--wb-muted);
}

.crop-stage {
  border-radius: 10px;
  background: #09090b;
}

.crop-handle {
  border-color: var(--wb-panel);
  background: var(--wb-brand);
}

/* ── Operation stack ───────────────────────────────────────────────── */
.stack-empty {
  padding: 14px 8px;
  color: var(--wb-muted);
  font-size: 12px;
  text-align: center;
}

.stack-item {
  margin: 6px 0;
  padding: 8px 9px;
  background: var(--wb-subtle);
}

.stack-idx {
  display: inline-flex;
  flex: 0 0 22px;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--wb-brand-soft);
  color: var(--wb-brand);
  font-size: 11px;
  font-weight: 700;
}

.stack-label i {
  color: var(--wb-brand);
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1.2;
  white-space: nowrap;
  transition: color .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: .42;
  cursor: not-allowed;
  filter: none;
}

.btn-primary {
  border-color: var(--wb-brand);
  background: var(--wb-brand);
  color: #fff;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--wb-brand) 20%, transparent);
}

.btn-primary:hover:not(:disabled) {
  border-color: var(--wb-brand-hover);
  background: var(--wb-brand-hover);
}

.btn-success {
  border-color: color-mix(in srgb, var(--wb-success) 25%, var(--wb-line));
  background: var(--wb-success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  filter: brightness(.96);
}

.btn-ghost {
  border-color: var(--wb-line);
  background: var(--wb-panel);
  color: var(--wb-fg);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--wb-line);
  background: var(--wb-subtle);
}

.btn-sm {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11.5px;
}

.btn-block {
  width: 100%;
  min-height: 42px;
}

#processBtn,
#processStackBtn {
  margin-top: 8px !important;
}

/* ── Size estimate / progress / action cluster ─────────────────────── */
.size-estimate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 11px;
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  background: var(--wb-subtle);
  color: var(--wb-muted);
  font-size: 12px;
}

.size-estimate strong {
  color: var(--wb-fg);
  font-size: 13px;
}

.size-delta.smaller { color: var(--wb-success); }
.size-delta.larger { color: var(--wb-danger); }

.progress-wrap {
  width: 100%;
  margin: 12px 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--wb-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--wb-subtle-2);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--wb-brand);
  transition: width .2s ease;
}

#quickDownloadWrap {
  margin-top: 14px !important;
  padding-top: 14px !important;
  border-top-color: var(--wb-line) !important;
}

/* ── Output ────────────────────────────────────────────────────────── */
.out-empty {
  padding: 30px 18px;
  border: 1px dashed var(--wb-line);
  border-radius: 12px;
  background: var(--wb-subtle);
  color: var(--wb-muted);
  font-size: 12.5px;
  text-align: center;
}

.out-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.out-size {
  color: var(--wb-muted);
  font-size: 11.5px;
}

/* ── Command preview: terminal is a contained utility ──────────────── */
.cmd-preview {
  min-height: 38px;
  margin-top: 4px;
  padding: 10px 11px;
  border: 1px solid var(--wb-line);
  border-radius: 9px;
  background: var(--wb-subtle);
  color: var(--wb-fg);
  font-family: var(--wb-font-mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Utilities and legacy compatibility ───────────────────────────── */
.hidden {
  display: none !important;
}

#batchTrimWarning {
  background: var(--wb-warning-soft) !important;
  color: var(--wb-warning) !important;
}

select:disabled {
  opacity: .58;
  cursor: not-allowed;
  background: var(--wb-subtle);
}

.raw-examples-details {
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--wb-line);
  border-radius: 9px;
}

.raw-examples-details summary {
  padding: 9px 11px;
  background: var(--wb-subtle);
  color: var(--wb-muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.rex-list {
  gap: 5px;
  background: var(--wb-panel);
}

/* ── Responsive: preserve 3 columns while content can breathe ──────── */

/* Desktop gets a viewport-height workbench: each column scrolls on its own,
   so the navigation and inspector are reachable without scrolling the page. */
@media (min-width: 961px) {
  body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  header { flex: 0 0 auto; }

  .container {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 16px;
  }

  .statusbar { flex: 0 0 auto; }

  .workspace-shell {
    flex: 1 1 auto;
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    min-height: 0;
  }

  .workspace-sidebar,
  .workspace-inspector,
  .workspace-stage {
    position: static;
    top: auto;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--wb-line) transparent;
  }

  .workspace-stage { padding-right: 2px; }
}

@media (max-width: 1279px) and (min-width: 961px) {
  :root {
    --wb-sidebar-width: 194px;
    --wb-inspector-width: 304px;
    --wb-gap: 12px;
  }

  .container {
    padding-right: 14px;
    padding-left: 14px;
  }

  .workspace-shell {
    grid-template-columns: minmax(180px, var(--wb-sidebar-width)) minmax(300px, 1fr) minmax(280px, var(--wb-inspector-width));
  }

  .workspace-sidebar { padding-right: 7px; padding-left: 7px; }
  .op-tile { gap: 7px; padding-right: 7px; padding-left: 7px; font-size: 11.5px; }
  .workspace-inspector > .card > .card-body { padding-right: 12px; padding-left: 12px; }
}

@media (max-width: 960px) {
  .workspace-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-sidebar,
  .workspace-inspector {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .workspace-sidebar {
    padding: 12px;
  }

  .tool-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .tool-nav-group__items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Below the three-column breakpoint the stage comes first, then tools,
     then the parameter inspector — the video stays the focal point. */
  .workspace-stage { order: 1; }
  .workspace-sidebar { order: 2; }
  .workspace-inspector { order: 3; }
}

@media (max-width: 600px) {
  header {
    min-height: 54px;
    padding: 10px 13px;
  }

  header h1 { font-size: 15px; }
  .container { padding: 10px 10px 22px; }

  /* The long trust badge does not fit a phone header; the offline pill and
     the tool-status chip still communicate the same thing. */
  .badge-local { display: none; }

  .theme-toggle { padding: 6px 8px; }
  .theme-toggle__label { display: none; }

  .statusbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  .statusbar .ml-auto {
    width: 100%;
    margin-left: 0;
  }

  .statusbar .btn { width: 100%; }
  .workspace-shell { gap: 10px; }

  .tool-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .tool-nav-group__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .op-tile {
    min-height: 38px;
    padding: 7px 8px;
    font-size: 11.5px;
  }

  .card-header { min-height: 44px; padding: 10px 12px; }
  .card-body { padding: 12px; }
  .drop-zone { min-height: 170px; padding: 22px 12px; }
  #inputVideo { max-height: 42vh; }
  .trim-row { flex-direction: column; gap: 8px; }
  .form-row { gap: 8px; }
  .form-group { flex-basis: 100%; }
  .crop-handle { width: 16px; height: 16px; }
  .out-actions { align-items: stretch; flex-direction: column; }
  .out-actions .btn { width: 100%; }
  .out-actions .out-size { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Site footer: shared by the workbench and AI feature pages ────── */
.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--wb-line);
  background: var(--wb-panel);
  color: var(--wb-muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  width: min(100%, 1840px);
  margin: 0 auto;
  /* 右侧为客服浮窗预留位置，避免遮住备案号。 */
  padding: 11px 88px 11px 20px;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.site-footer a {
  color: inherit;
  border-radius: 4px;
  text-decoration: none;
  transition: color .15s;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--wb-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer__copy {
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-footer__copy a {
  white-space: nowrap;
}

/* ── Customer-service floating button ────────────────────────────── */
.site-support {
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wb-brand), #8b5cf6);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(76, 76, 196, .3), 0 2px 6px rgba(15, 23, 42, .16);
  transition: transform .18s ease, box-shadow .18s ease;
}

.site-support i {
  font-size: 17px;
  line-height: 1;
}

.site-support__label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .04em;
}

.site-support:hover,
.site-support:focus-visible {
  color: #fff;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(76, 76, 196, .38), 0 3px 8px rgba(15, 23, 42, .18);
}

.site-support:focus-visible {
  outline: 2px solid var(--wb-brand);
  outline-offset: 3px;
}

@media (max-width: 1279px) {
  .site-footer__inner {
    padding-right: 86px;
    padding-left: 14px;
  }
}

@media (max-width: 600px) {
  .site-footer__inner {
    justify-content: center;
    gap: 4px 16px;
    /* 底部为客服浮窗预留位置。 */
    padding: 10px 13px 62px;
    text-align: center;
  }

  .site-support {
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    width: 48px;
    height: 48px;
  }

  .site-support i {
    font-size: 15px;
  }
}
