/* Motion Edition (#edition): the same dark studio and violet accents as the rest of the app (DESIGN.md), scoped to .ed-root. */
.ed-root { --ed-panel: #1a191e; --ed-line: #343038; --ed-field: #232227; --ed-card: #1c1b20; --ed-card-line: #2e2b34; --ed-max-h: min(64dvh, 700px); }
.ed-layout { display: grid; grid-template-columns: 356px minmax(0, 1fr); gap: 24px; align-items: start; }
.ed-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ed-root .icon.spin { animation: ed-spin 1.2s linear infinite; }
@keyframes ed-spin { to { rotate: 360deg; } }

/* Left: configuration */
.ed-config { position: sticky; top: 18px; max-height: calc(100dvh - 124px); display: flex; flex-direction: column; background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: 14px; overflow: hidden; }
.ed-config-head { padding: 20px 20px 4px; }
.ed-config-head h1 { font: 500 24px/1.2 var(--display); letter-spacing: -.03em; }
.ed-config-head p { margin-top: 8px; font-size: 11px; color: #b8a7c3; }
.ed-config-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px 20px 20px; }
.ed-section { margin-top: 22px; }
.ed-config-foot { display: grid; gap: 10px; padding: 16px 20px 14px; background: #201c26; border-top: 1px solid #3e324a; }
.ed-config-foot .button { width: 100%; min-height: 46px; font-size: 12px; }
.ed-config-foot .error-message { margin: 0; }
.ed-foot-note { text-align: center; font-size: 11px; color: #a792b7; font-variant-numeric: tabular-nums; }
.ed-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; color: #e2d6ec; font-size: 12px; font-weight: 600; }
.ed-label small { color: #8d7d9b; font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ed-hint { display: block; margin-top: 8px; color: #8d7d9b; font-size: 11px; line-height: 1.45; }

.ed-upload { position: relative; display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px dashed #554561; border-radius: 10px; background: #211c2a; cursor: pointer; transition: border-color 220ms var(--ease), background 220ms var(--ease); }
.ed-upload:hover, .ed-upload.dragging { border-color: var(--purple); background: #2b2336; }
.ed-upload:focus-within { outline: 2px solid var(--purple); outline-offset: 3px; }
.ed-upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ed-upload > .icon { width: 20px; height: 20px; flex-basis: 20px; color: var(--purple); }
.ed-upload strong { display: block; font-size: 12px; }
.ed-upload small { display: block; margin-top: 1px; color: #a595b3; font-size: 11px; line-height: 1.4; }
.ed-upload-compact { padding: 10px 12px; }

.ed-order { display: flex; gap: 8px; margin: 0 0 10px; padding: 0 0 6px; list-style: none; overflow-x: auto; scrollbar-width: thin; }
.ed-order-item { position: relative; flex: 0 0 54px; height: 82px; border-radius: 8px; overflow: hidden; background: #0a0a0c; }
.ed-order-item img, .ed-order-item video { display: block; width: 100%; height: 100%; object-fit: cover; }
.ed-num { position: absolute; left: 5px; top: 5px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 10px; background: var(--purple); color: var(--purple-ink); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ed-remove { position: absolute; right: 3px; bottom: 3px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #17131bd9; color: #e5d7e8; transition: background 220ms var(--ease), color 220ms var(--ease); }
.ed-remove .icon { width: 12px; height: 12px; flex-basis: 12px; }
.ed-remove:hover { background: var(--purple); color: var(--purple-ink); }

.ed-gallery-scroll { margin-top: 10px; max-height: 268px; padding: 3px 4px 0 3px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.ed-gallery { columns: 3; column-gap: 8px; }
.ed-clip { position: relative; display: block; width: 100%; margin: 0 0 8px; padding: 0; border-radius: 8px; overflow: hidden; break-inside: avoid; background: #211b26; outline: 2px solid transparent; outline-offset: 1px; transition: outline-color 220ms var(--ease), filter 220ms var(--ease); }
.ed-clip img { display: block; width: 100%; height: auto; }
.ed-clip:hover { filter: brightness(1.12); }
.ed-clip.selected { outline-color: var(--purple); }
.ed-clip[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.ed-dur { position: absolute; right: 5px; bottom: 5px; padding: 2px 5px; border-radius: 4px; background: #17131bd9; color: #e5d7e8; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }

.ed-textarea { display: block; width: 100%; min-height: 120px; padding: 10px 12px; resize: vertical; border: 1px solid #3a363f; border-radius: 8px; background: var(--ed-field); color: var(--text); font: 500 12px/1.55 var(--font); }
.ed-textarea::placeholder { color: #85798f; }
.ed-textarea:hover { border-color: #625471; }
.ed-textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px #b5a0ff26; }
.ed-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ed-example { padding: 6px 10px; border-radius: 6px; background: var(--purple-subtle); color: #cbbaf6; font-size: 11px; font-weight: 600; transition: background 220ms var(--ease), color 220ms var(--ease); }
.ed-example:hover { background: #36304b; color: #e1d4ff; }

.ed-field { display: block; min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.ed-field legend, .ed-label-row { display: flex; justify-content: space-between; align-items: baseline; width: 100%; margin: 0 0 8px; padding: 0; color: #e2d6ec; font-size: 12px; font-weight: 600; }
.ed-label-row output { color: #a792b7; font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ed-field input[type="range"] { display: block; width: 100%; margin: 0; accent-color: var(--purple); }
.ed-field .select-wrap select { display: block; width: 100%; height: 38px; padding: 8px 36px 8px 12px; border: 1px solid #3a363f; border-radius: 6px; background: var(--ed-field); font-size: 11px; font-weight: 500; }
.ed-field .select-wrap select:hover { border-color: #625471; }
.ed-field .select-wrap .icon { top: 11px; }
.ed-field .segmented button { font-variant-numeric: tabular-nums; }
.ed-toggle { align-items: flex-start; padding: 9px 0; line-height: 1.4; }
.ed-toggle > span:first-child { align-items: flex-start; }
.ed-toggle .icon { margin-top: 1px; }
.ed-toggle .switch { flex: none; margin-top: 2px; }

.ed-ref { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--ed-card-line); border-radius: 10px; background: var(--ed-card); }
.ed-ref-thumb { flex: 0 0 46px; height: 46px; border-radius: 7px; overflow: hidden; background: #0a0a0c; }
.ed-ref-thumb img, .ed-ref-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.ed-ref-name { flex: 1; min-width: 0; overflow: hidden; color: #cfbedb; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ed-ref-name small { display: block; color: #8d7d9b; }

/* Right: stage + the list of requests */
.ed-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 24px; align-items: start; min-width: 0; }
.ed-stage { min-width: 0; min-height: 640px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.ed-welcome, .ed-failed { display: flex; flex-direction: column; align-items: center; max-width: 640px; margin: 0 auto; padding: 34px 0; text-align: center; }
.ed-welcome-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 22px; border-radius: 18px; background: var(--purple-subtle); color: var(--purple); }
.ed-welcome-icon .icon { width: 30px; height: 30px; flex-basis: 30px; }
.ed-welcome-icon.is-failed { background: #3a2326; color: var(--error); }
.ed-welcome h2, .ed-failed h2 { font: 500 28px/1.2 var(--display); letter-spacing: -.03em; }
.ed-welcome > p, .ed-failed > p { max-width: 56ch; margin: 14px 0 28px; color: #b5a1c2; font-size: 12px; }
.ed-welcome-steps { display: grid; gap: 12px; width: 100%; margin: 0; padding: 0; list-style: none; text-align: left; }
.ed-welcome-steps li { display: flex; gap: 14px; padding: 14px 16px; border: 1px solid var(--ed-card-line); border-radius: 12px; background: var(--ed-card); }
.ed-welcome-steps li > span { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--purple-subtle); color: #cbbaf6; font-size: 12px; font-weight: 700; }
.ed-welcome-steps strong { font-size: 13px; }
.ed-welcome-steps p { margin-top: 2px; color: #a792b7; font-size: 11px; }
.ed-failed-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.ed-working { display: grid; grid-template-columns: minmax(180px, .7fr) 1.3fr; gap: 28px; align-items: center; }
.ed-working-art { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; gap: 8px; min-height: 320px; padding: 14px; border-radius: 12px; background: radial-gradient(circle at 50% 35%, #2a2133, #141118 70%); color: #8d7d9b; }
.ed-working-art img { display: block; width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 8px; opacity: .92; animation: ed-pulse 2.4s ease-in-out infinite; }
.ed-working-art img:only-child { grid-column: 1 / -1; justify-self: center; max-width: 170px; }
.ed-working-art > .icon { grid-column: 1 / -1; justify-self: center; width: 34px; height: 34px; }
@keyframes ed-pulse { 50% { opacity: .62; } }
.ed-eyebrow { color: var(--purple); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ed-working-copy h2 { margin-top: 8px; font: 500 28px/1.2 var(--display); letter-spacing: -.03em; }
.ed-working-copy > p { max-width: 48ch; margin: 12px 0 22px; color: #b4a4c0; font-size: 12px; }
.ed-steps { display: grid; gap: 2px; margin: 22px 0 0; padding: 0; list-style: none; }
.ed-step { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: #8d7d9b; font-size: 12px; }
.ed-step .icon { width: 16px; height: 16px; flex-basis: 16px; }
.ed-step.is-done { color: #b5a8c4; }
.ed-step.is-done .icon, .ed-step.is-current .icon { color: var(--purple); }
.ed-step.is-current { color: #eadcff; font-weight: 600; }
.ed-dot { display: grid; place-items: center; flex: none; width: 16px; height: 16px; }
.ed-dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #4a4155; }
.ed-working + .ed-summary { margin-top: 28px; }

.ed-summary { display: grid; gap: 14px; padding: 18px 20px; border: 1px solid var(--ed-card-line); border-radius: 12px; background: var(--ed-card); }
.ed-summary h2 { font: 500 18px/1.3 var(--display); letter-spacing: -.02em; }
.ed-message { color: #d6cbe0; font-size: 12px; line-height: 1.65; }
.ed-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ed-chip-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 6px; background: #31283e; color: #d3c1f0; font-size: 11px; font-weight: 500; }
.ed-chip-tag .icon { width: 13px; height: 13px; flex-basis: 13px; color: #b69cf2; }
.ed-texts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; color: #a792b7; font-size: 11px; }
.ed-texts > span { color: #cfbedb; font-weight: 600; }
.ed-texts q { quotes: '“' '”'; padding: 2px 7px; border-radius: 5px; background: var(--ed-field); color: #eadcff; font-weight: 600; }
.ed-gen { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ed-gen li { display: flex; gap: 8px; color: #cfbedb; font-size: 11px; line-height: 1.45; }
.ed-gen .icon { flex: none; width: 14px; height: 14px; margin-top: 1px; color: var(--purple); }

.ed-result { display: grid; gap: 22px; }
.ed-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ed-view { width: fit-content; }
.ed-view button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 5px 14px; white-space: nowrap; }
.ed-view .icon { width: 14px; height: 14px; flex-basis: 14px; }
.ed-player { display: grid; place-items: center; padding: 22px; border-radius: 12px; background: radial-gradient(circle at 50% 35%, #2a2133, #141118 70%); }
.ed-video { display: block; width: min(100%, calc(var(--ed-max-h) * var(--ratio, .5625))); height: auto; aspect-ratio: var(--ratio, .5625); border-radius: 10px; background: #000; object-fit: contain; }
.ed-meta { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: #a792b7; font-size: 11px; font-variant-numeric: tabular-nums; }
.ed-meta .icon { width: 14px; height: 14px; flex-basis: 14px; }
.ed-result-side { display: grid; align-content: start; gap: 16px; min-width: 0; }
.ed-result-side .ed-meta { margin: 0; }
.ed-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 8px; background: #2a2133; color: #e2d6ec; font-size: 11px; line-height: 1.45; }
.ed-note .icon { flex: none; width: 14px; height: 14px; margin-top: 1px; color: var(--purple); }
.ed-refine { display: grid; gap: 8px; }
.ed-refine label { color: #e2d6ec; font-size: 12px; font-weight: 600; }
.ed-refine .ed-textarea { min-height: 78px; }
.ed-refine-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ed-refine-foot small { color: #8d7d9b; font-size: 11px; line-height: 1.4; }

.ed-rail { position: sticky; top: 18px; max-height: calc(100dvh - 124px); display: flex; flex-direction: column; background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: 14px; overflow: hidden; }
.ed-rail-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 10px 18px; }
.ed-rail-head h2 { font: 500 17px/1.2 var(--display); letter-spacing: -.02em; }
.ed-new { gap: 6px; min-height: 30px; padding: 6px 10px; font-size: 11px; }
.ed-new .icon { width: 14px; height: 14px; flex-basis: 14px; }
.ed-jobs { display: grid; gap: 8px; margin: 0; padding: 0 10px 12px; list-style: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.ed-rail-empty { padding: 4px 8px 12px; color: #a792b7; font-size: 11px; }
.ed-job { position: relative; display: flex; gap: 10px; width: 100%; padding: 8px; text-align: left; border: 1px solid var(--ed-card-line); border-radius: 10px; background: var(--ed-card); transition: border-color 220ms var(--ease), background 220ms var(--ease); }
.ed-job:hover { border-color: #413b49; background: var(--surface-raised); }
.ed-job.selected { border-color: var(--purple); background: var(--purple-subtle); }
.ed-job.selected::before { content: ''; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--purple); }
.ed-job-thumb { flex: 0 0 46px; display: grid; place-items: center; height: 72px; border-radius: 7px; overflow: hidden; background: #0a0a0c; color: #8d7d9b; }
.ed-job-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ed-job-body { flex: 1; display: grid; align-content: start; gap: 5px; min-width: 0; }
.ed-job-body strong { display: -webkit-box; overflow: hidden; font-size: 12px; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.ed-job-body small { color: #a792b7; font-size: 11px; font-variant-numeric: tabular-nums; }
.ed-status { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.ed-status .icon { width: 12px; height: 12px; flex-basis: 12px; }
.ed-status.is-active { background: #31283e; color: #d3c1f0; }
.ed-status.is-done { background: #d8c7fa; color: #26202e; }
.ed-status.is-failed { background: #3a2326; color: var(--error); }

@media (min-width: 1560px) { .ed-result { grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); align-items: start; } }
@media (max-width: 1279px) {
  .ed-workspace { grid-template-columns: minmax(0, 1fr); }
  .ed-rail { position: static; max-height: none; }
  .ed-jobs { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 1099px) {
  .ed-layout { grid-template-columns: minmax(0, 1fr); }
  .ed-config { position: static; max-height: none; }
  .ed-config-body { overflow: visible; }
  .ed-working { grid-template-columns: minmax(0, 1fr); }
  .ed-stage { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .ed-root .icon.spin, .ed-working-art img { animation: none; }
  .ed-upload, .ed-clip, .ed-job, .ed-example, .ed-remove { transition: none; }
}
