:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --field: #ffffff;
  --stage: #f7f8fb;
  --line: rgba(0, 0, 0, .12);
  --text: #111827;
  --sub: #856259;
  --topbar: #ffffff;
  --primary: #fa9403;
  --primary-strong: #cf6f00;
  --accent: #2563eb;
  --muted: #667085;
  --success: #16a34a;
  --danger: #dc2626;
}

html[data-theme="dark"] {
  --bg: #000000;
  --surface: #0d0f14;
  --field: #141820;
  --stage: #050608;
  --line: rgba(255, 255, 255, .16);
  --text: #e5e7eb;
  --sub: #d9b8a0;
  --topbar: #000000;
  --muted: #9ca3af;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.dt-topbar {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
}

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

.dt-logo {
  display: block;
  min-width: 0;
}

.dt-logotop {
  width: min(500px, 58vw);
  height: auto;
  display: block;
}

.dt-title {
  color: var(--sub);
  font-weight: 700;
  white-space: nowrap;
}

.dt-actions,
.vc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

button,
.dt-secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:not(.dt-secondary-btn) {
  border-color: transparent;
  background: var(--primary);
  color: #17120a;
}

button:hover,
.dt-secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

button:not(.dt-secondary-btn):hover {
  background: var(--primary-strong);
  color: #ffffff;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.dt-main {
  width: 100%;
  margin: 18px 0;
  padding: 0 14px 40px;
}

.vc-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 16px;
  align-items: start;
}

.vc-stage,
.vc-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.vc-panel h1,
.vc-panel h2,
.vc-output h2 {
  margin: 0 0 10px;
  color: var(--sub);
  font-weight: 650;
}

.vc-panel h2 {
  margin-top: 16px;
}

.vc-preview {
  position: relative;
  width: 100%;
  min-height: 560px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--stage);
}

#previewCanvas {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 74vh;
  object-fit: contain;
  background: #000000;
}

.vc-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
  padding: 20px;
  pointer-events: none;
}

.vc-empty.is-hidden {
  display: none;
}

.vc-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.vc-time {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

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

.vc-actions.tight {
  margin: 0 0 12px;
}

.vc-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.vc-progress[aria-hidden="true"] {
  display: none;
}

.vc-progress-track {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  overflow: hidden;
}

.vc-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .16s ease;
}

.vc-progress-text {
  min-width: 44px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.vc-output {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.vc-status {
  min-width: 180px;
  margin: 0;
  color: var(--success);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.vc-status.is-error {
  color: var(--danger);
}

.vc-dropzone {
  min-height: 142px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  text-align: center;
  padding: 14px;
  cursor: pointer;
}

.vc-dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.vc-dropzone span,
.vc-meta,
.vc-mini {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.vc-meta {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.vc-row {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.vc-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  margin-top: 8px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--field);
  color: var(--text);
  font-size: 13px;
}

input[type="color"] {
  width: 100%;
  height: 40px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  padding: 2px;
}

.vc-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.vc-check input {
  margin: 0;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .vc-shell {
    grid-template-columns: 1fr;
  }

  .vc-preview {
    min-height: 430px;
  }
}

@media (max-width: 620px) {
  .dt-topbar,
  .dt-brand,
  .vc-output {
    align-items: flex-start;
    flex-direction: column;
  }

  .dt-logotop {
    width: min(380px, 68vw);
  }

  .vc-row.two,
  .vc-player,
  .vc-time {
    grid-template-columns: 1fr;
  }

  .vc-status {
    text-align: left;
  }
}
