:root {
  color-scheme: dark;
  font-family: "Geist", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  background: #141611;
  color: #eff0e9;
  --surface: #1b1e17;
  --control: #161912;
  --line: #34392b;
  --muted: #a4ab98;
  --green: #d2f685;
  --green-ink: #253116;
  --danger: #ffae9e;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
h1, h2, p { margin: 0; }

.topbar {
  background: #181b14;
  border-bottom: 1px solid #2a2f23;
}

.topbar-inner, .workspace {
  width: min(1184px, calc(100% - 96px));
  margin-inline: auto;
}

.topbar-inner {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 670;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #1d2a10;
  background: var(--green);
  border-radius: 9px;
}

.brand-mark i {
  display: block;
  width: 15px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  position: relative;
}

.brand-mark i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  border: 3px solid transparent;
  border-right: 0;
  border-left: 4px solid currentColor;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 39px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  font-size: 14px;
  font-weight: 620;
  text-align: center;
  text-decoration: none;
  transition: background-color 130ms, border-color 130ms;
}

.button-quiet {
  background: #23271e;
  border-color: #363e2d;
}

.button-quiet:hover { background: #2d3426; border-color: #536040; }
.button-primary { background: var(--green); color: var(--green-ink); }
.button-primary:hover { background: #e0ffa6; }
.button-primary:disabled { background: #3a442d; color: #b2bea2; }

.settings-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid #b4c1a4;
  border-radius: 3px;
  transform: rotate(45deg);
  position: relative;
}

.settings-mark::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid #b4c1a4;
  border-radius: 50%;
}

.workspace { padding-block: clamp(35px, 5vw, 63px) 55px; }
.page-heading { margin-bottom: 31px; }

.page-heading h1 {
  font-size: clamp(35px, 4.1vw, 53px);
  font-weight: 650;
  line-height: 1.13;
  letter-spacing: 0.015em;
}

.page-heading p, .dialog-heading p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin-top: 11px;
}

.editor {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 21px;
  align-items: stretch;
}

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

.panel-heading {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 23px;
  border-bottom: 1px solid #303627;
}

.panel-heading h2, .dialog-heading h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.generator-fields, .profile-form {
  display: grid;
  gap: 19px;
  min-width: 0;
}

.generator-fields { padding: 21px 23px; }

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 570;
  line-height: 1.4;
}

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

.field input:not([type="range"]), .field select, .field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #3a4231;
  border-radius: 8px;
  background-color: var(--control);
  color: #eff0e9;
  font-weight: 400;
  transition: border-color 130ms;
}

.field select { min-height: 41px; }
.field input::placeholder, .field textarea::placeholder { color: #8c9580; opacity: 1; }
.field textarea { min-height: 104px; resize: vertical; line-height: 1.65; }

:is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.duration-value {
  color: var(--green);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.field input[type="range"] {
  display: block;
  cursor: pointer;
  width: 100%;
  min-height: 19px;
  margin: 0;
  accent-color: var(--green);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.optional {
  margin-left: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.generator-actions { padding: 0 23px 23px; }
.generator-actions > .button { width: 100%; min-height: 46px; }
.generator-actions .error-message, .profile-form .error-message { margin-bottom: 10px; }

.cost-estimate {
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--control);
}

.cost-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 10px;
}

.cost-heading h3 { margin: 0; font-size: 13px; }
.cost-heading span, .cost-note, .job-cost { color: var(--muted); font-size: 12px; }
.cost-note { margin-top: 6px; line-height: 1.5; }

.cost-rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 8px 0 0;
}

.cost-rates div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 7px; }
.cost-rates dt { font-size: 12px; }
.cost-rates dd { margin: 0; color: var(--green); font-weight: 650; font-variant-numeric: tabular-nums; }

.play-mark {
  display: inline-block;
  width: 0;
  height: 0;
  border-block: 5px solid transparent;
  border-left: 8px solid currentColor;
}

.preview { display: flex; flex-direction: column; }
.output-details { color: var(--muted); font-size: 12px; text-align: right; }

.preview-stage {
  flex: 1;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  min-height: 335px;
  margin: 21px 21px 0;
  isolation: isolate;
  border: 1px solid #303629;
  border-radius: 10px;
  background: #11140e;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 24px;
  color: #9ca791;
  font-size: 13px;
  text-align: center;
  background-image:
    radial-gradient(ellipse at center, #151b10 10%, transparent 70%),
    linear-gradient(to right, #1d2517 1px, transparent 1px),
    linear-gradient(to bottom, #1d2517 1px, transparent 1px);
  background-size: auto, 30px 30px, 30px 30px;
  background-position: center;
}

.viewfinder {
  display: grid;
  place-items: center;
  width: 69px;
  height: 53px;
  position: relative;
  color: #a0b881;
}

.viewfinder-frame {
  position: absolute;
  inset: 0;
  border: 1px solid #58674b;
  border-radius: 9px;
  background: #202919;
}

.viewfinder > .play-mark {
  position: relative;
  margin-left: 3px;
  border-block-width: 8px;
  border-left-width: 12px;
}

.preview-stage video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(70vh, 560px);
  min-height: 0;
  object-fit: contain;
  background: #11140e;
}

.preview-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  min-height: 73px;
  padding: 13px 22px;
}

.feedback { display: grid; gap: 8px; flex: 1 1 150px; min-width: 0; }
.job-status { color: #aeb8a2; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.error-message { color: var(--danger); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }

progress {
  display: block;
  width: min(100%, 245px);
  height: 7px;
  accent-color: var(--green);
}

.api-dialog {
  width: min(650px, calc(100% - 34px));
  max-height: calc(100% - 34px);
  padding: 0;
  color: inherit;
  background: var(--surface);
  border: 1px solid #48523c;
  border-radius: 15px;
  box-shadow: 0 24px 90px #0008;
}

.api-dialog::backdrop { background: #070906c7; }

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 19px 23px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading p { margin-top: 4px; font-size: 13px; }

.button-icon {
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 21px;
  font-weight: 400;
}

.button-icon:hover { background: #2d3426; }

.dialog-body {
  display: grid;
  grid-template-columns: minmax(145px, 0.6fr) minmax(0, 1fr);
  align-items: start;
  gap: 23px;
  padding: 23px;
}

.profiles, .profile-list { display: grid; gap: 8px; min-width: 0; }
.profile-list:empty { display: none; }

.profile-list button {
  display: block;
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid #394331;
  border-radius: 8px;
  background: var(--control);
  color: inherit;
  font-size: 13px;
  text-align: left;
  overflow-wrap: anywhere;
}

.profile-list button:hover { background: #293322; }
.profile-list button:is(.active, [aria-current="true"], [aria-selected="true"], [aria-pressed="true"]) {
  color: var(--green);
  border-color: #6d864c;
  background: #293322;
}

.add-profile { width: 100%; justify-content: flex-start; }
.add-profile span { font-size: 17px; }
.profile-form { gap: 14px; }
.profile-form .button-primary { justify-self: start; min-width: 104px; }

@media (max-width: 850px) {
  .topbar-inner, .workspace { width: calc(100% - 48px); }
  .editor { gap: 14px; }
  .panel-heading { padding-inline: 17px; }
  .generator-fields, .generator-actions, .preview-footer { padding-inline: 17px; }
  .preview-stage { margin-inline: 15px; }
}

@media (max-width: 680px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .topbar-inner, .workspace { width: calc(100% - 32px); }
  .topbar-inner { min-height: 60px; }
  .page-heading { margin-bottom: 23px; }
  .preview-stage { min-height: 250px; }
  .preview-footer { min-height: 62px; }
}

@media (max-width: 480px) {
  .dialog-body { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .dialog-heading, .dialog-body { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
