:root {
  --video-bg: #f6f7f9;
  --video-panel: #ffffff;
  --video-panel-strong: #ffffff;
  --video-ink: #182230;
  --video-muted: #667085;
  --video-line: #d9dee7;
  --video-line-soft: #eaedf2;
  --video-primary: #2563eb;
  --video-primary-dark: #1d4ed8;
  --video-teal: #0d7c86;
  --video-gold: #b7791f;
  --video-black: #111827;
  --video-shadow: 0 1px 2px rgba(24, 34, 52, 0.06);
  --video-radius: 8px;
  --video-display: "Segoe UI", Inter, system-ui, sans-serif;
  --video-body: "Segoe UI", Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--video-ink);
  font-family: var(--video-body);
  background: var(--video-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.video-shell {
  min-height: 100vh;
  padding: 16px;
}

.video-header,
.video-main {
  width: min(1240px, 100%);
  margin-inline: auto;
}

.video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--video-line);
  border-radius: var(--video-radius);
  background: var(--video-panel);
  box-shadow: var(--video-shadow);
}

.video-brand,
.video-header-actions,
.video-account,
.video-home-link,
.video-signin-link,
.video-credit-pill,
.video-audio-toggle {
  display: inline-flex;
  align-items: center;
}

.video-brand {
  gap: 12px;
  min-width: 0;
}

.video-brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--video-line);
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 0 16%, rgba(255, 255, 255, 0.66) 16% 22%, transparent 22% 38%, rgba(255, 255, 255, 0.66) 38% 44%, transparent 44% 60%, rgba(255, 255, 255, 0.66) 60% 66%, transparent 66% 82%, rgba(255, 255, 255, 0.66) 82% 88%, transparent 88%),
    linear-gradient(135deg, #2563eb, var(--video-teal));
}

.video-brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.video-brand-name {
  font-weight: 750;
  letter-spacing: 0;
}

.video-brand-tagline {
  color: var(--video-muted);
  font-size: 0.8rem;
}

.video-header-actions {
  gap: 8px;
  min-width: 0;
}

.video-account {
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--video-line-soft);
  border-radius: var(--video-radius);
  background: #f9fafb;
  color: var(--video-muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.video-home-link,
.video-signin-link,
.video-credit-pill,
.video-open {
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.video-home-link,
.video-credit-pill,
.video-open {
  border: 1px solid var(--video-line);
  background: #ffffff;
  color: var(--video-ink);
}

.video-signin-link {
  border: 1px solid var(--video-black);
  background: var(--video-black);
  color: #ffffff;
  flex: 0 0 auto;
}

.video-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.video-form,
.video-result-panel {
  border: 1px solid var(--video-line);
  border-radius: var(--video-radius);
  background: var(--video-panel);
  box-shadow: var(--video-shadow);
}

.video-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.video-form-head {
  display: grid;
  gap: 4px;
}

.video-kicker {
  margin: 0;
  color: var(--video-teal);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.video-form h1,
.video-section-head h2,
.video-result-empty h2 {
  margin: 0;
  font-family: var(--video-display);
  letter-spacing: 0;
}

.video-form h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.08;
}

.video-reference-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--video-line);
  border-radius: var(--video-radius);
  background: #fbfcfe;
}

.video-reference-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.video-reference-head h2 {
  margin: 2px 0 0;
  font-size: 1rem;
  letter-spacing: 0;
  font-weight: 700;
}

.video-reference-head > span {
  color: var(--video-muted);
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.video-reference-upload {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 12px;
  border: 1px dashed #a7b2c2;
  border-radius: var(--video-radius);
  background: #ffffff;
  cursor: pointer;
}

.video-reference-upload strong {
  color: var(--video-ink);
}

.video-reference-upload span,
.video-reference-empty {
  color: var(--video-muted);
  line-height: 1.45;
}

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

.video-reference-empty {
  grid-column: 1 / -1;
  padding: 10px 2px;
  font-size: 0.9rem;
}

.video-reference-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--video-line);
  border-radius: 7px;
  background: #fff;
}

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

.video-reference-thumb span {
  position: absolute;
  inset-inline: 6px;
  bottom: 6px;
  overflow: hidden;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(7, 10, 16, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-field {
  display: grid;
  gap: 8px;
}

.video-field > span,
.video-resolution-field legend,
.video-cost-card > span {
  color: #334155;
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.video-prompt-field {
  position: relative;
}

.video-prompt-field textarea {
  width: 100%;
  min-height: 250px;
  resize: vertical;
  padding: 12px 12px 32px;
  border: 1px solid #cfd6e1;
  border-radius: var(--video-radius);
  background: #ffffff;
  color: var(--video-ink);
  line-height: 1.5;
  outline: none;
}

.video-prompt-field textarea::placeholder {
  color: rgba(91, 102, 120, 0.72);
}

.video-field-count {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: var(--video-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.video-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.78fr);
  gap: 12px;
}

.video-slider-value {
  color: var(--video-ink);
  font-size: 1.05rem;
  font-weight: 750;
}

.video-field input[type="range"] {
  width: 100%;
  min-height: 36px;
  accent-color: var(--video-primary);
}

.video-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid #cfd6e1;
  border-radius: var(--video-radius);
  background: #fff;
  color: var(--video-ink);
  font-weight: 650;
}

.video-resolution-field {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--video-line);
  border-radius: var(--video-radius);
  background: #fbfcfe;
}

.video-resolution-field legend {
  grid-column: 1 / -1;
  padding: 0 4px;
}

.video-resolution-field label {
  position: relative;
  min-width: 0;
}

.video-resolution-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-resolution-field span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--video-line);
  border-radius: 7px;
  background: #fff;
  color: var(--video-muted);
  font-weight: 750;
  cursor: pointer;
}

.video-resolution-field input:checked + span {
  border-color: rgba(37, 99, 235, 0.58);
  background: rgba(37, 99, 235, 0.08);
  color: var(--video-primary);
}

.video-audio-toggle {
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--video-line);
  border-radius: var(--video-radius);
  background: #fbfcfe;
  color: var(--video-ink);
  font-weight: 650;
}

.video-audio-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--video-primary);
}

.video-cost-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #f0d9a8;
  border-radius: var(--video-radius);
  background: #fffbeb;
}

.video-cost-card strong {
  color: #92400e;
  font-size: 1.45rem;
  line-height: 1;
}

.video-cost-card small {
  color: var(--video-muted);
  line-height: 1.45;
}

.video-submit,
.video-download {
  min-height: 48px;
  border-radius: var(--video-radius);
  font-weight: 750;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.video-submit {
  border: 1px solid var(--video-primary-dark);
  background: var(--video-primary);
  color: #ffffff;
}

.video-submit:hover,
.video-submit:focus-visible {
  background: var(--video-primary-dark);
}

.video-download[data-ready="true"]:hover,
.video-download[data-ready="true"]:focus-visible {
  background: #0f172a;
}

.video-home-link:hover,
.video-home-link:focus-visible,
.video-credit-pill:hover,
.video-credit-pill:focus-visible,
.video-open:hover,
.video-open:focus-visible {
  border-color: #b8c0cc;
  background: #f9fafb;
}

.video-signin-link:hover,
.video-signin-link:focus-visible {
  border-color: #0f172a;
  background: #0f172a;
}

.video-submit:disabled,
.video-download[data-ready="false"] {
  cursor: not-allowed;
  opacity: 0.58;
}

.video-render-note {
  margin: -2px 0 0;
  color: var(--video-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.video-status {
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--video-line);
  border-radius: var(--video-radius);
  background: #fbfcfe;
  color: var(--video-muted);
  line-height: 1.5;
}

.video-status.is-error {
  border-color: #f3b8ad;
  background: #fff1f0;
  color: #9f2f1f;
}

.video-status.is-success {
  border-color: rgba(13, 124, 134, 0.28);
  background: rgba(13, 124, 134, 0.08);
  color: #075d64;
}

.video-result-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.video-result-actions {
  display: flex;
  gap: 10px;
}

.video-download {
  flex: 1 1 auto;
  border: 1px solid var(--video-black);
  background: var(--video-black);
  color: #ffffff;
}

.video-download[data-ready="false"] {
  border-color: var(--video-line);
  background: #eef1f5;
  color: var(--video-muted);
}

.video-open {
  flex: 0 0 auto;
}

.video-result-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  border: 1px dashed #b8c0cc;
  border-radius: var(--video-radius);
  background: #f2f4f7;
}

#video-result {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #000;
  object-fit: contain;
}

.video-result-empty,
.video-result-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--video-muted);
}

.video-result-empty h2 {
  color: var(--video-ink);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.video-result-empty p {
  max-width: 32rem;
  margin: 0;
  line-height: 1.45;
}

.video-result-loading {
  background: rgba(7, 10, 16, 0.82);
  color: #f8fafc;
}

.video-result-loading p {
  margin: 0;
  color: rgba(248, 250, 252, 0.82);
  font-weight: 800;
}

.video-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: video-spin 900ms linear infinite;
}

.video-recent-panel {
  display: grid;
  gap: 10px;
}

.video-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.video-section-head h2 {
  font-size: 1.08rem;
  font-weight: 700;
}

.video-recent-list {
  display: grid;
  gap: 8px;
}

.video-empty-card,
.video-recent-card {
  border: 1px solid var(--video-line);
  border-radius: var(--video-radius);
  background: #ffffff;
}

.video-empty-card {
  padding: 14px;
  color: var(--video-muted);
}

.video-recent-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.video-recent-card strong {
  display: block;
  overflow: hidden;
  color: var(--video-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-recent-card span {
  color: var(--video-muted);
  font-size: 0.84rem;
}

.video-recent-card button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--video-line);
  border-radius: 7px;
  background: #fff;
  color: var(--video-teal);
  font-weight: 750;
  cursor: pointer;
}

@keyframes video-spin {
  to {
    transform: rotate(360deg);
  }
}

textarea:focus-visible,
select:focus-visible,
input:focus-visible + span,
.video-reference-upload:focus-within,
.video-submit:focus-visible,
.video-download:focus-visible,
.video-home-link:focus-visible,
.video-signin-link:focus-visible,
.video-credit-pill:focus-visible,
.video-open:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

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

@media (max-width: 640px) {
  .video-shell {
    padding: 12px;
  }

  .video-header {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .video-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .video-account {
    flex: 1;
    justify-content: space-between;
    min-width: 0;
    white-space: normal;
  }

  .video-brand-tagline {
    display: none;
  }

  .video-form h1 {
    font-size: 1.9rem;
  }

  .video-controls,
  .video-resolution-field {
    grid-template-columns: 1fr;
  }

  .video-prompt-field textarea {
    min-height: 210px;
  }

  .video-result-actions {
    display: grid;
  }

  .video-open {
    width: 100%;
  }

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