:root {
  --bg: #07090d;
  --surface: #0d1118;
  --surface-2: #121722;
  --surface-3: #171d29;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f6f8fb;
  --muted: #8c94a3;
  --muted-2: #626a79;
  --accent: #d8ff4f;
  --accent-ink: #111606;
  --success: #79f2a9;
  --danger: #ff758b;
  --blue: #8eb6ff;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "Noto Sans HK", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 0%, rgba(93, 80, 219, 0.16), transparent 28rem),
    linear-gradient(180deg, #0a0d12 0%, #07090d 64%, #090b10 100%);
}

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

input,
textarea,
select {
  font-size: 16px;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.08;
  pointer-events: none;
}

.ambient-a {
  top: 12rem;
  right: -12rem;
  background: #705cff;
}

.ambient-b {
  left: -18rem;
  top: 58rem;
  background: #d8ff4f;
  opacity: 0.035;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(7, 9, 13, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

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

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  transform: skew(-7deg);
}

.brand-mark i {
  display: block;
  align-self: end;
  border-radius: 3px;
  background: var(--accent);
}

.brand-mark i:nth-child(1) {
  height: 56%;
  opacity: 0.62;
}

.brand-mark i:nth-child(2) {
  height: 100%;
}

.brand-mark i:nth-child(3) {
  height: 76%;
  opacity: 0.82;
}

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

.brand-copy strong {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.35px;
  white-space: nowrap;
}

.brand-copy em {
  color: var(--accent);
  font-style: normal;
}

.brand-copy small {
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.25px;
}

.health-cluster {
  position: relative;
}

.health-pill {
  height: 36px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.health-pill:hover {
  border-color: var(--line-strong);
}

.health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #656d7a;
}

.health-pill.is-ready {
  color: #dffff0;
  border-color: rgba(121, 242, 169, 0.22);
  background: rgba(121, 242, 169, 0.055);
}

.health-pill.is-ready .health-dot {
  background: var(--success);
  box-shadow: 0 0 12px rgba(121, 242, 169, 0.68);
}

.health-pill.is-error {
  color: #ffd4dc;
  border-color: rgba(255, 117, 139, 0.22);
  background: rgba(255, 117, 139, 0.055);
}

.health-pill.is-error .health-dot {
  background: var(--danger);
}

.health-popover {
  position: absolute;
  top: 44px;
  right: 0;
  width: min(360px, calc(100vw - 24px));
  padding: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(13, 17, 24, 0.98);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.health-head {
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
}

.health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.health-item {
  min-width: 0;
  padding: 8px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 10px;
}

.health-item b {
  font-size: 9px;
}

.health-item b.ok {
  color: var(--success);
}

.health-item b.no {
  color: var(--danger);
}

.health-reason {
  margin: 10px 2px 0;
  color: #ffafbd;
  font-size: 10px;
  line-height: 1.5;
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

main {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 0 24px 96px;
}

.hero {
  min-height: 110px;
  padding: 22px 4px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.eyebrow i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(216, 255, 79, 0.55);
}

.hero h1 {
  margin: 6px 0 5px;
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.02;
  letter-spacing: -1.8px;
}

.hero p {
  max-width: 740px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hero-status {
  flex: 0 0 auto;
  width: 86px;
  height: 56px;
  padding: 8px 10px;
  display: grid;
  align-content: center;
  justify-items: end;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.hero-status span {
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 1px;
}

.hero-status b {
  margin-top: 1px;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -1px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.glass {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(15, 19, 27, 0.94), rgba(10, 13, 19, 0.92));
  box-shadow: var(--shadow);
}

.composer {
  padding: 24px;
}

.section-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 20px;
  letter-spacing: -0.75px;
}

.step-chip {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #090c12;
}

.mode-button {
  min-height: 60px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.mode-button.is-active {
  border-color: rgba(216, 255, 79, 0.28);
  background: rgba(216, 255, 79, 0.075);
}

.mode-icon {
  flex: 0 0 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #cbd1dc;
  font-size: 12px;
  font-weight: 850;
}

.mode-button.is-active .mode-icon {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.mode-button span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mode-button b {
  font-size: 12px;
}

.mode-button small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.field {
  margin-top: 16px;
}

.field-label {
  min-height: 22px;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #dde2eb;
  font-size: 11px;
  font-weight: 800;
}

.field-label > span:last-child,
.field-label output {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
}

fieldset {
  min-width: 0;
  margin-inline: 0;
  padding: 0;
  border: 0;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  background: #090c12;
  color: var(--text);
}

textarea {
  min-height: 180px;
  padding: 16px;
  resize: vertical;
  line-height: 1.58;
}

textarea::placeholder {
  color: #4f5766;
}

textarea:focus,
select:focus {
  border-color: rgba(216, 255, 79, 0.38);
  box-shadow: 0 0 0 3px rgba(216, 255, 79, 0.045);
}

select {
  height: 46px;
  padding: 0 12px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #7c8492 50%),
    linear-gradient(135deg, #7c8492 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 20px,
    calc(100% - 13px) 20px;
  background-repeat: no-repeat;
  background-size: 4px 4px, 4px 4px;
}

.prompt-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.prompt-hints button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #9aa2af;
  font-size: 10px;
  cursor: pointer;
}

.upload-zone {
  min-height: 124px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: rgba(216, 255, 79, 0.45);
  background: rgba(216, 255, 79, 0.03);
}

.upload-zone input,
.mini-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-symbol {
  flex: 0 0 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--accent);
  font-size: 20px;
}

.upload-copy {
  display: grid;
  gap: 3px;
}

.upload-copy b {
  font-size: 11px;
}

.upload-copy small {
  color: var(--muted);
  font-size: 9px;
}

.upload-preview {
  position: absolute;
  inset: 0;
  background: #090c12 center / cover no-repeat;
}

.upload-preview::after {
  content: "更換首幀";
  position: absolute;
  right: 9px;
  bottom: 9px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(7, 9, 13, 0.84);
  color: #d6dbe4;
  font-size: 9px;
  font-weight: 750;
}

.keyframe-extra {
  margin-top: 8px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.keyframe-extra > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.keyframe-extra b {
  font-size: 10px;
}

.keyframe-extra small {
  color: var(--muted-2);
  font-size: 9px;
}

.mini-upload {
  min-width: 118px;
  min-height: 34px;
  padding: 0 10px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 9px;
  cursor: pointer;
}

.mini-upload.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.quality-field {
  margin-top: 18px;
}

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

.quality-card {
  min-width: 0;
  min-height: 112px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b0f15;
  cursor: pointer;
}

.quality-card.is-selected {
  border-color: rgba(216, 255, 79, 0.4);
  background: linear-gradient(155deg, rgba(216, 255, 79, 0.09), rgba(255, 255, 255, 0.012));
}

.quality-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quality-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quality-top b {
  font-size: 11px;
}

.quality-top em {
  color: var(--accent);
  font-size: 8px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.8px;
}

.quality-card strong {
  margin-top: 12px;
  font-size: 10px;
}

.quality-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.quality-note {
  min-height: 27px;
  margin: 7px 2px 0;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.45;
}

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

.compact-field {
  min-width: 0;
  min-height: 92px;
  margin: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.015);
}

.range {
  width: 100%;
  height: 24px;
  accent-color: var(--accent);
  touch-action: pan-x;
}

.range-labels {
  margin-top: 1px;
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 8px;
}

.duration-native-note {
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.4;
}

.duration-native-note.is-native {
  color: #dfff86;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.segmented label {
  min-width: 0;
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  min-height: 40px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: rgba(216, 255, 79, 0.35);
  background: rgba(216, 255, 79, 0.07);
  color: var(--text);
}

.segmented small {
  color: var(--muted-2);
  font-size: 7px;
}

.image-ratio-notice {
  min-height: 48px;
  padding: 8px 9px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid rgba(216, 255, 79, 0.22);
  border-radius: 9px;
  background: rgba(216, 255, 79, 0.055);
}

.image-ratio-notice strong {
  color: #e5ff94;
  font-size: 10px;
}

.image-ratio-notice small {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

.compact-field.is-image-original {
  border-color: rgba(216, 255, 79, 0.18);
}

.ratio-icon {
  display: block;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.ratio-icon.wide {
  width: 14px;
  height: 8px;
}

.ratio-icon.tall {
  width: 8px;
  height: 14px;
}

.dialogue-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(142, 182, 255, 0.18);
  border-radius: 13px;
  background: rgba(70, 105, 170, 0.05);
}

.dialogue-panel textarea {
  min-height: 86px;
}

.dialogue-panel p {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 9px;
}

.resource-warning {
  margin: 9px 2px 0;
  color: #9b8490;
  font-size: 9px;
  line-height: 1.45;
}

.resource-warning strong {
  color: #d7a7b3;
}

.submit-row {
  margin-top: 18px;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.submit-summary {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.submit-summary span {
  color: var(--muted-2);
  font-size: 9px;
}

.submit-summary b {
  overflow: hidden;
  color: #d7dce5;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.primary-button {
  min-width: 168px;
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button:hover {
  background: #e2ff69;
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.primary-button i {
  font-size: 18px;
  font-style: normal;
}

.form-error {
  margin: 9px 0 0;
  color: #ff9aad;
  font-size: 10px;
  line-height: 1.5;
}

.monitor {
  position: sticky;
  top: 80px;
  padding: 20px;
}

.monitor-heading {
  margin-bottom: 13px;
}

.text-button {
  min-height: 34px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.monitor-stage {
  min-height: 235px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 42%, rgba(107, 85, 215, 0.1), transparent 48%),
    #090c12;
}

.stage-empty {
  min-height: 235px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stage-orbit {
  width: 82px;
  height: 82px;
  margin-bottom: 14px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.stage-orbit::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.stage-orbit i {
  position: absolute;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(216, 255, 79, 0.56);
  transform-origin: 3px 36px;
  animation: orbit 7s linear infinite;
}

.stage-orbit b {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
  font-size: 10px;
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

.stage-empty strong {
  font-size: 11px;
}

.stage-empty p {
  max-width: 270px;
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.5;
}

.active-job {
  min-height: 235px;
  display: grid;
  grid-template-rows: 118px 1fr;
}

.active-visual {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 65%, rgba(216, 255, 79, 0.09), transparent 36%),
    linear-gradient(135deg, #121722, #090c12);
}

.active-visual::before,
.active-visual::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
}

.active-visual::after {
  width: 88px;
  height: 88px;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(255, 255, 255, 0.012) 3px 4px);
}

.render-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.9px;
}

.active-percent {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
}

.active-percent b {
  font-size: 46px;
  line-height: 1;
  letter-spacing: -3px;
}

.active-percent span {
  margin-top: 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
}

.active-copy {
  padding: 13px;
}

.active-copy > div:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
}

.active-copy strong {
  font-size: 10px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(216, 255, 79, 0.45);
}

.active-copy p {
  min-height: 15px;
  margin: 5px 0 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #1b202b;
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9ebc31, var(--accent));
  transition: width 0.35s ease;
}

.active-meta {
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted-2);
  font-size: 8px;
}

.active-meta span:last-child {
  max-width: 110px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cancel-job-button {
  width: 100%;
  min-height: 42px;
  margin-top: 11px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 117, 139, 0.5);
  border-radius: 10px;
  background: rgba(255, 117, 139, 0.1);
  color: #ffb2bf;
  font-size: 10px;
  cursor: pointer;
}

.cancel-job-button:hover {
  background: rgba(255, 117, 139, 0.16);
  border-color: rgba(255, 117, 139, 0.72);
}

.cancel-job-button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.cancel-job-button span {
  font-size: 8px;
}

.cancel-job-button b {
  font-weight: 850;
}

.result-slot {
  margin-top: 9px;
  padding: 9px;
  border: 1px solid rgba(121, 242, 169, 0.14);
  border-radius: 13px;
  background: rgba(121, 242, 169, 0.035);
}

.result-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.result-thumb {
  height: 64px;
  overflow: hidden;
  border-radius: 9px;
  background: #07090d;
  cursor: pointer;
}

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

.result-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.result-info > span {
  color: var(--success);
  font-size: 8px;
  font-weight: 850;
}

.result-info b {
  overflow: hidden;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

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

.result-actions button,
.result-actions a {
  min-height: 30px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: #b4bbc7;
  font-size: 9px;
  cursor: pointer;
}

.queue-block {
  margin-top: 13px;
}

.queue-title {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #a1a8b4;
  font-size: 9px;
  font-weight: 750;
}

.queue-title span:last-child {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted-2);
}

.queue-list {
  max-height: 214px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding-right: 1px;
}

.empty-line {
  margin: 0;
  padding: 11px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted-2);
  font-size: 9px;
  text-align: center;
}

.queue-item {
  min-height: 46px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
}

.q-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #646c79;
}

.queue-item[data-status="running"] .q-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(216, 255, 79, 0.55);
}

.queue-item[data-status="done"] .q-dot {
  background: var(--success);
}

.queue-item[data-status="error"] .q-dot,
.queue-item[data-status="cancelled"] .q-dot {
  background: var(--danger);
}

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

.queue-copy b,
.queue-copy small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.queue-copy b {
  font-size: 9px;
}

.queue-copy small {
  color: var(--muted-2);
  font-size: 8px;
}

.queue-percent {
  color: var(--muted);
  font-size: 9px;
}

.gallery-section {
  padding: 42px 4px 0;
}

.gallery-head {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.gallery-head h2 {
  margin: 4px 0;
  font-size: 23px;
  letter-spacing: -0.8px;
}

.gallery-head p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.secondary-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: #aeb5c1;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.gallery-grid {
  min-height: 160px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.gallery-empty {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted-2);
  font-size: 10px;
}

.media-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b0f15;
}

.media-preview {
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
  background: #07090d;
  cursor: pointer;
}

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

.media-type {
  position: absolute;
  top: 7px;
  left: 7px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  background: rgba(7, 9, 13, 0.77);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.7px;
}

.media-play {
  position: absolute;
  inset: 0;
  width: 36px;
  height: 36px;
  margin: auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(7, 9, 13, 0.7);
  font-size: 10px;
}

.media-meta {
  padding: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.media-meta > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.media-meta b {
  min-width: 0;
  overflow: hidden;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.media-meta small {
  color: var(--muted-2);
  font-size: 8px;
}

.media-download {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #aeb5c1;
}

.preview-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
}

.preview-sheet {
  position: absolute;
  inset: 5vh max(20px, calc((100vw - 1000px) / 2));
  overflow: hidden;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 68px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #0c1016;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.64);
}

.preview-bar {
  padding: 0 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.preview-bar strong {
  font-size: 10px;
}

.preview-bar .icon-button {
  justify-self: end;
}

.back-button {
  justify-self: start;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b2b9c4;
  font-size: 10px;
  cursor: pointer;
}

.preview-media {
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #05070a;
}

.preview-media video,
.preview-media img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.preview-actions {
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.preview-actions > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.preview-actions small {
  color: var(--muted-2);
  font-size: 8px;
}

.preview-actions b {
  max-width: 520px;
  overflow: hidden;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.download-button {
  min-width: 148px;
  min-height: 42px;
}

.toast {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: 24px;
  max-width: min(440px, calc(100vw - 28px));
  padding: 10px 13px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(16, 20, 28, 0.97);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  color: #dce1e8;
  font-size: 10px;
  text-align: center;
}

.mobile-nav {
  display: none;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

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

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

@media (max-width: 820px) {
  .topbar {
    height: 58px;
    padding: 0 14px;
  }

  .brand-copy small {
    display: none;
  }

  .health-pill {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .health-pill #healthLabel {
    display: none;
  }

  .health-popover {
    position: fixed;
    top: 52px;
    right: 10px;
  }

  main {
    padding: 0 10px 90px;
  }

  .hero {
    min-height: 92px;
    padding: 18px 3px 14px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero p {
    max-width: 520px;
    font-size: 11px;
  }

  .hero-status {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .composer,
  .monitor {
    border-radius: 18px;
  }

  .composer {
    padding: 16px;
  }

  .monitor {
    position: static;
    padding: 16px;
  }

  .gallery-section {
    padding-top: 36px;
  }

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

  .preview-sheet {
    inset: 0;
    border: 0;
    border-radius: 0;
    grid-template-rows: 52px minmax(0, 1fr) auto;
  }

  .preview-actions {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .mobile-nav {
    position: fixed;
    z-index: 45;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    height: 58px;
    padding: 5px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: rgba(13, 17, 24, 0.94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.44);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    min-width: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #737b89;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 8px;
    font-weight: 800;
  }

  .mobile-nav button span {
    font-size: 15px;
    line-height: 1;
  }

  .mobile-nav button.is-active {
    background: var(--accent);
    color: var(--accent-ink);
  }
}

@media (max-width: 560px) {
  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .hero {
    padding-top: 15px;
  }

  .hero h1 {
    font-size: 28px;
    letter-spacing: -1.3px;
  }

  .hero p {
    font-size: 10px;
  }

  .section-heading {
    margin-bottom: 14px;
  }

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

  .mode-button {
    min-height: 58px;
  }

  textarea {
    min-height: 170px;
  }

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

  .quality-card {
    min-height: 88px;
  }

  .quality-card strong {
    margin-top: 8px;
  }

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

  .compact-field {
    min-height: 86px;
  }

  .submit-row {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .primary-button {
    width: 100%;
    min-height: 50px;
  }

  .keyframe-extra {
    align-items: stretch;
    flex-direction: column;
  }

  .mini-upload {
    width: 100%;
    min-height: 38px;
  }

  .gallery-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .gallery-head p {
    max-width: 320px;
  }

  .secondary-button {
    min-height: 40px;
  }

  .media-meta {
    padding: 8px;
  }

  .preview-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .preview-actions .primary-button {
    width: 100%;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
