:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101418;
  color: #eef4f8;
  --panel: #171d22;
  --panel-strong: #1f272e;
  --line: #33414b;
  --muted: #9baab5;
  --accent: #4fb3a5;
  --accent-strong: #6ac7b9;
  --danger: #e27b7b;
  --ok: #86d28d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(135deg, rgba(79, 179, 165, 0.12), transparent 30%),
    #101418;
}

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 20, 24, 0.92);
  position: sticky;
  top: 0;
  z-index: 2;
}

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

.brand-copy {
  display: grid;
  justify-items: center;
}

.brand-logo {
  display: block;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 760;
}

h2 {
  font-size: 17px;
  font-weight: 720;
}

h3 {
  font-size: 14px;
  font-weight: 720;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 6px;
  text-align: center;
}

.status {
  min-width: 220px;
  text-align: right;
  color: var(--muted);
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(360px, 1fr);
  gap: 18px;
  padding: 18px clamp(18px, 3vw, 36px) 36px;
  flex: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

.preview-panel,
.job-panel {
  min-height: 260px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

button {
  border: 1px solid #44606a;
  background: #223039;
  color: #edf7f6;
  border-radius: 7px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  background: #273b43;
}

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

input[type="url"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #10171c;
  color: #eff7f7;
  border-radius: 7px;
  padding: 0 12px;
}

input[type="file"] {
  width: 100%;
  min-height: 42px;
  border: 1px dashed var(--line);
  background: #10171c;
  color: #eff7f7;
  border-radius: 7px;
  padding: 10px 12px;
}

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

.hint,
.job-status {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.pill.ok {
  color: var(--ok);
  border-color: rgba(134, 210, 141, 0.5);
}

.pill.danger {
  color: var(--danger);
  border-color: rgba(226, 123, 123, 0.5);
}

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

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

.preview img {
  width: 180px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1216;
}

.local-preview-card {
  width: 180px;
  min-height: 102px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: #0d1216;
}

.local-preview-card span,
.local-preview-card small {
  color: var(--muted);
}

.local-preview-card strong {
  overflow-wrap: anywhere;
}

.preview-details {
  display: grid;
  gap: 8px;
}

.preview-title {
  font-size: 18px;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  background: #11181d;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  min-width: 0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.source-switch {
  margin-bottom: 14px;
}

.source-fields {
  display: grid;
  gap: 12px;
}

.mode-switch button.active {
  border-color: var(--accent);
  background: #173137;
  color: #f2fffd;
}

.option-group {
  display: grid;
  gap: 12px;
}

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

.choice-grid label {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #11181d;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #edf7f6;
}

.hidden {
  display: none !important;
}

.progress-shell {
  height: 14px;
  background: #0d1216;
  border: 1px solid #25323a;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 180ms ease;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid var(--accent);
  color: #f2fffd;
  text-decoration: none;
  padding: 0 14px;
  margin-top: 14px;
  background: #173137;
}

.site-footer {
  padding: 18px clamp(18px, 3vw, 36px) 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 900px) {
  .topbar,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    min-width: 0;
    text-align: left;
  }

  .brand-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-copy {
    justify-items: start;
  }

  .eyebrow {
    text-align: left;
  }

  .brand-logo {
    width: 96px;
    height: 96px;
  }

  .layout,
  .preview,
  .metadata-grid,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .preview img {
    width: 100%;
  }
}
