:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --panel: #ffffff;
  --text: #1f2520;
  --muted: #69716d;
  --line: #dce1dc;
  --accent: #2f7d59;
  --accent-strong: #236246;
  --warn: #a8651a;
  --danger: #9c2f2f;
  --shadow: 0 14px 35px rgba(28, 36, 30, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  width: clamp(160px, 22vw, 260px);
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

h2 {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
}

.topbar p,
.progress-meta,
.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  min-width: 76px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: #f9faf8;
  color: var(--muted);
  font-size: 13px;
}

.status-pill.running {
  color: var(--warn);
  border-color: #e2c79d;
  background: #fff7ea;
}

.status-pill.completed {
  color: var(--accent-strong);
  border-color: #acd4bf;
  background: #edf8f1;
}

.status-pill.failed {
  color: var(--danger);
  border-color: #e3b2b2;
  background: #fff0f0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
  grid-template-areas:
    "upload options"
    "output output"
    "progress progress";
  gap: 18px;
  padding: 18px;
  max-width: 1500px;
  margin: 0 auto;
}

.upload-panel {
  grid-area: upload;
}

.options-panel {
  grid-area: options;
}

.progress-panel {
  grid-area: progress;
}

.output-panel {
  grid-area: output;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

.panel-title {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1.5px dashed #b9c4bc;
  border-radius: 8px;
  background: #fbfcfb;
  cursor: pointer;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: #eef8f2;
}

.drop-zone input {
  display: none;
}

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

button,
.panel-title a {
  border: 1px solid transparent;
  border-radius: 8px;
  height: 40px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.secondary {
  background: #f8faf8;
  border-color: var(--line);
  color: var(--text);
}

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

label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

label small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin-top: 5px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}

.wide-label {
  display: block;
  margin-top: 12px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 14px;
}

.toggle-grid label {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

.progress-wrap {
  height: 12px;
  border-radius: 999px;
  background: #e9ede8;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  margin-top: 9px;
}

#logBox {
  min-height: 300px;
  max-height: 420px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #151b17;
  color: #dbe8de;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.video-shell {
  width: min(100%, 960px);
  aspect-ratio: 16 / 9;
  margin-inline: auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101511;
  overflow: hidden;
}

.video-shell.portrait {
  width: min(100%, 420px);
  aspect-ratio: 9 / 16;
}

.video-shell.square {
  width: min(100%, 620px);
  aspect-ratio: 1 / 1;
}

.video-shell video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}

.style-panel {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

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

.check-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
}

.check-row span {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.style-actions {
  margin-top: 12px;
}

#emptyResult {
  color: #b8c5bb;
  font-size: 14px;
}

.panel-title a {
  height: 34px;
  background: #edf8f1;
  border-color: #acd4bf;
  color: var(--accent-strong);
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    padding: 18px;
  }

  .brand-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand-logo {
    width: min(260px, 68vw);
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "upload"
      "options"
      "output"
      "progress";
    padding: 12px;
  }

  .video-shell {
    width: 100%;
  }

  .video-shell.portrait {
    width: min(100%, 360px);
  }

  .form-grid,
  .toggle-grid,
  .style-grid {
    grid-template-columns: 1fr;
  }
}
