:root {
  color-scheme: dark;
  --bg: #0c0d0e;
  --panel: #17191b;
  --panel-soft: #202326;
  --line: #30343a;
  --text: #f4f5f5;
  --muted: #a7adb4;
  --accent: #39c6a3;
  --accent-strong: #28ad8c;
  --danger: #ff6b6b;
}

* {
  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;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #111315;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #06100d;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
}

p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.drop-zone {
  border: 1px dashed #485058;
  border-radius: 8px;
  background: var(--panel);
  min-height: 116px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.drop-zone:hover {
  border-color: var(--accent);
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #12231f;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.drop-zone input {
  display: none;
}

.drop-title {
  font-weight: 700;
}

.drop-copy {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.settings {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.settings label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.model-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.small-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.settings .check-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-setting input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings input,
.settings select,
.model-field select,
td input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1113;
  color: var(--text);
  padding: 10px 11px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

button,
.download-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 42px;
  padding: 0 14px;
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

button.primary {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #06100d;
  font-weight: 800;
}

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

.editor {
  padding: 24px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.preview-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.preview-toolbar,
.table-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.preview-player {
  position: relative;
  border-radius: 6px;
  background: #000;
  overflow: hidden;
}

#previewCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.source-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preview-controls {
  min-height: 48px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 42px auto 1fr 74px;
  gap: 10px;
  align-items: center;
  background: #080909;
  border-top: 1px solid #202326;
}

.preview-controls button {
  min-height: 34px;
  padding: 0 10px;
}

#previewTime {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

#previewSeek {
  width: 100%;
  accent-color: var(--accent);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #2a2e32;
  overflow: hidden;
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.timeline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-height: 0;
}

.table-header {
  padding: 16px 16px 0;
  align-items: flex-start;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 520px);
  min-height: 180px;
  padding: 14px 16px 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
}

td:first-child {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .workspace,
  .timeline-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .table-wrap {
    max-height: none;
  }
}
