:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #16202c;
  --muted: #697586;
  --soft: #eef3f7;
  --line: #d9e0e8;
  --accent: #176f68;
  --accent-dark: #105b55;
  --accent-soft: #e7f4f2;
  --focus: #2f80ed;
  --danger: #9b1c1c;
  --danger-bg: #fff5f5;
  --shadow: 0 14px 34px rgba(22, 32, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(23, 111, 104, 0.08), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.shell {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 680px;
  margin-bottom: 8px;
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.intro {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.14rem;
}

.brand-pill,
.status-chip,
.state-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-chip {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: #c7e5e0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-heading,
.result-header,
.outputs-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading p,
.outputs-heading p,
.small-note,
.hint {
  margin-bottom: 0;
  color: var(--muted);
}

form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  font-weight: 760;
}

.hint {
  font-size: 0.9rem;
}

input[type="url"],
input[type="file"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

input[type="url"] {
  padding: 0 13px;
}

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

.toggle-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfd;
  cursor: pointer;
}

.toggle-option input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.toggle-option strong,
.toggle-option small {
  display: block;
}

.toggle-option strong {
  font-size: 0.96rem;
}

.toggle-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

input:focus-visible,
button:focus-visible,
summary:focus-visible,
a:focus-visible,
video:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 65%);
  outline-offset: 2px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.advanced {
  margin-top: 2px;
  color: var(--muted);
}

summary {
  width: max-content;
  cursor: pointer;
  color: var(--text);
  font-weight: 760;
}

.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.option-grid span,
.output-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #f9fbfc;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

button {
  min-height: 48px;
  margin-top: 2px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.small-note {
  font-size: 0.9rem;
}

.result[data-state="completed"] .state-badge {
  background: var(--accent-soft);
  border-color: #c7e5e0;
  color: var(--accent-dark);
}

.result[data-state="failed"] .state-badge {
  background: var(--danger-bg);
  border-color: #e8b5b5;
  color: var(--danger);
}

.progress-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #28a398);
  transition: width 220ms ease;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.job-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(140px, 0.5fr);
  gap: 12px;
  margin: 18px 0 0;
}

.job-meta div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfd;
}

dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.error-message {
  margin: 14px 0 0;
  border: 1px solid #e8b5b5;
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--danger-bg);
  color: var(--danger);
}

.outputs {
  margin-top: 22px;
}

.outputs h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.output-list {
  display: grid;
  gap: 12px;
}

.output-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px;
  background: #fbfcfd;
}

.video-preview-wrap {
  overflow: hidden;
  border-radius: 12px;
  background: #111827;
  aspect-ratio: 9 / 16;
}

.video-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.output-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

.output-card h4 {
  margin: 0;
  font-size: 1.08rem;
}

.output-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 40px;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
}

.download-link:hover {
  background: var(--accent-dark);
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 24px, 900px);
    padding: 22px 0;
  }

  .topbar,
  .panel-heading,
  .result-header,
  .outputs-heading,
  .status-line {
    display: block;
  }

  .brand-pill,
  .status-chip,
  .state-badge {
    margin-top: 10px;
  }

  .panel {
    padding: 18px;
    border-radius: 14px;
  }

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

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

  .video-preview-wrap {
    width: min(220px, 100%);
  }
}


.secondary-button {
  min-height: 40px;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.outputs-heading {
  align-items: center;
}

@media (max-width: 700px) {
  .secondary-button {
    width: 100%;
    margin-top: 12px;
  }
}


.file-size-note {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.file-size-note[data-level="notice"] {
  border-color: #d7c68b;
  background: #fffbea;
  color: #755f11;
}

.file-size-note[data-level="warning"] {
  border-color: #e8b5b5;
  background: var(--danger-bg);
  color: var(--danger);
}
