:root {
  color-scheme: light;
  --ink: #11161c;
  --muted: #58616d;
  --line: #d8dee5;
  --surface: #ffffff;
  --soft: #f2f5f7;
  --accent: #0f766e;
  --accent-strong: #0b4f4a;
  --warn: #9a3412;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(226, 245, 241, 0.95), rgba(248, 250, 252, 0.85) 45%, rgba(232, 241, 255, 0.9)),
    #f7fafc;
}

.app {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

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

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

h2 {
  font-size: 18px;
}

.iconButton,
.primary {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.iconButton {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08), 0 12px 24px rgba(15, 23, 42, 0.08);
  font-size: 20px;
}

.statusBand {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.statusBand > div {
  min-height: 74px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.88);
}

.label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.panel,
.result,
.history {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

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

textarea,
select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input[type="file"] {
  padding: 9px;
}

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

textarea:focus,
select:focus,
input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

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

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.secondary.compact {
  min-height: 36px;
}

.secondary.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.primary:disabled {
  cursor: progress;
  opacity: 0.7;
}

.resultHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

code {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.mediaSlot {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin-top: 12px;
  border: 1px dashed #b9c3cf;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  text-align: center;
}

.mediaSlot video,
.mediaSlot img {
  display: block;
  width: 100%;
  max-height: 72vh;
  border-radius: 8px;
  background: #000;
}

.filePicker {
  margin-top: 14px;
}

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

.modeStrip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.filePicker span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.previewGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.previewGrid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.drivePicker {
  margin-top: 14px;
}

.driveChoice {
  position: relative;
  display: block;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.driveChoice.selected {
  border-color: var(--accent);
}

.promptBox {
  margin-top: 12px;
  color: var(--muted);
}

.promptBox pre {
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  color: var(--ink);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

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

.jobList {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.jobItem {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.jobMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.jobPrompt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

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

@media (max-width: 720px) {
  .app {
    padding: 18px 12px 36px;
  }

  h1 {
    font-size: 28px;
  }

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

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

  .previewGrid {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

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

  .actions,
  .statusBand {
    grid-template-columns: 1fr;
  }
}
