:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181b20;
  --panel-2: #20242b;
  --line: #323844;
  --text: #f3f5f7;
  --muted: #a8b0bd;
  --accent: #39d0a3;
  --accent-2: #f0b64f;
  --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,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  border-right: 1px solid var(--line);
  background: #15171b;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 24px;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

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

.tab,
.ghost,
.primary {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  min-height: 40px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--accent);
  background: rgba(57, 208, 163, 0.14);
}

.primary {
  border-color: transparent;
  background: var(--accent);
  color: #061411;
  font-weight: 800;
  padding: 0 18px;
}

.ghost {
  padding: 0 14px;
}

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

.panel {
  padding: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d0f12;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

.workspace {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.actions {
  display: flex;
  gap: 10px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.composer,
.result {
  padding: 18px;
}

.shots {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.shot {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12151a;
  padding: 10px;
}

.shot-index {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: rgba(240, 182, 79, 0.14);
  color: var(--accent-2);
  font-weight: 800;
}

.remove {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #191d23;
  color: var(--muted);
  cursor: pointer;
}

.params {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.reference-field {
  margin-bottom: 16px;
}

.reference-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.reference-inputs {
  display: grid;
  grid-template-columns: auto 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.upload-button,
.remove-reference {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.upload-button {
  display: grid;
  place-items: center;
  min-height: 40px;
  margin: 0;
  padding: 0 14px;
  white-space: nowrap;
}

.or {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.reference-preview {
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12151a;
}

.reference-preview:not([hidden]) {
  display: grid;
}

.reference-preview img {
  width: 64px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: #08090b;
}

.reference-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.reference-meta strong,
.reference-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-meta strong {
  font-size: 13px;
}

.reference-meta span {
  color: var(--muted);
  font-size: 12px;
}

.remove-reference {
  min-height: 34px;
  padding: 0 12px;
}

.wide {
  margin-bottom: 16px;
}

.preview {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #08090b;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.empty {
  color: var(--muted);
}

.statusline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0;
}

.jobs {
  display: grid;
  gap: 10px;
}

.history-title {
  margin: 0 0 10px;
  font-size: 16px;
}

.history-empty {
  padding: 18px 0;
  text-align: center;
}

.job {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #12151a;
}

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.job button {
  min-height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.job pre {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  max-height: 180px;
  overflow: auto;
}

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

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

  .params {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .workspace,
  .rail {
    padding: 18px;
  }

  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .params {
    grid-template-columns: 1fr;
  }

  .reference-inputs {
    grid-template-columns: 1fr;
  }

  .or {
    display: none;
  }
}
