:root {
  color-scheme: light;
  --ink: #1f2523;
  --muted: #66716d;
  --line: #d7ddd8;
  --panel: #f7f9f7;
  --field: #ffffff;
  --accent: #16664f;
  --accent-dark: #0e4b3a;
  --warn: #9a3412;
  --ok: #1f6f43;
  --shadow: 0 12px 34px rgba(22, 36, 31, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

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

.shell {
  width: min(1380px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 20px;
}

.controls,
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 800;
}

h2 {
  font-size: 14px;
  font-weight: 800;
}

.brand p,
.source-head span,
.hint,
.file-list,
.summary,
.status,
.stage-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status {
  min-width: 72px;
  text-align: right;
  font-weight: 800;
}

.status.error {
  color: var(--warn);
}

.status.ok {
  color: var(--ok);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mode-tab {
  min-height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-tab.active {
  background: var(--accent);
  color: #ffffff;
}

.source-panel,
.dropzone {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.source-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.source-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.icon-button,
.secondary-button,
.render-button,
.download-button {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
}

.icon-button,
.secondary-button {
  color: var(--ink);
  background: #e5ebe6;
}

.render-button,
.download-button {
  width: 100%;
  color: #fff;
  background: var(--accent);
}

.download-button {
  background: #35403b;
}

.render-button:not(:disabled):hover,
.download-button:not(:disabled):hover {
  background: var(--accent-dark);
}

.clip-list,
.file-list {
  display: grid;
  gap: 8px;
  max-height: 236px;
  overflow: auto;
  padding-right: 4px;
}

.clip-row,
.file-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #edf1ee;
  padding-bottom: 8px;
}

.clip-name,
.file-row span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
}

.clip-meta,
.file-row span:last-child {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dropzone {
  min-height: 96px;
  padding: 18px;
  display: grid;
  gap: 10px;
  place-items: center;
  text-align: center;
  border-style: dashed;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: #f1fbf6;
}

input[type="file"] {
  display: none;
}

.hidden {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #35403b;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd4ce;
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 8px 10px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stage {
  min-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.stage-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.stage-title {
  font-weight: 800;
  font-size: 15px;
}

.n8n-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.stage-main {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #202622;
}

video {
  width: min(100%, 540px);
  max-height: calc(100vh - 190px);
  aspect-ratio: 9 / 16;
  background: #0c100e;
  border: 1px solid #414a45;
}

.empty {
  color: #cbd4ce;
  text-align: center;
  font-size: 14px;
}

.summary {
  min-height: 78px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  display: grid;
  gap: 4px;
}

.summary strong {
  color: var(--ink);
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .controls {
    gap: 14px;
  }

  .stage {
    min-height: 620px;
  }
}

@media (max-width: 480px) {
  .grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .brand {
    align-items: flex-start;
  }
}
