.motion-batch-open { overflow: hidden; }

.motion-batch-overlay {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 3, 8, .78);
  backdrop-filter: blur(18px);
}

.motion-batch-overlay.open { display: flex; }

.motion-batch {
  --mb-pink: #ff3d91;
  --mb-violet: #9c5cff;
  width: min(1180px, 100%);
  max-height: min(900px, calc(100vh - 48px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #f8f5fb;
  background:
    radial-gradient(circle at 78% -12%, rgba(156,92,255,.22), transparent 34%),
    radial-gradient(circle at 5% 108%, rgba(255,61,145,.16), transparent 29%),
    #0c0a10;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  box-shadow: 0 34px 110px rgba(0,0,0,.68), 0 0 0 1px rgba(255,61,145,.08) inset;
}

.motion-batch * { scrollbar-width: thin; scrollbar-color: rgba(156,92,255,.5) rgba(255,255,255,.035); }
.motion-batch *::-webkit-scrollbar { width: 7px; height: 7px; }
.motion-batch *::-webkit-scrollbar-track { background: rgba(255,255,255,.035); border-radius: 99px; }
.motion-batch *::-webkit-scrollbar-thumb { background: linear-gradient(var(--mb-pink), var(--mb-violet)); border-radius: 99px; }

.motion-batch-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.motion-batch-header h2 { margin: 4px 0 3px; font-size: clamp(28px, 3vw, 40px); line-height: 1; letter-spacing: -.04em; }
.motion-batch-header p { margin: 0; color: #a8a1ae; font-size: 14px; }
.motion-batch-kicker { color: #d7cadb; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.motion-batch-kicker span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 99px; background: var(--mb-pink); box-shadow: 0 0 16px var(--mb-pink); }
.motion-batch-close { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; color: #fff; background: rgba(255,255,255,.05); font-size: 25px; line-height: 1; cursor: pointer; }
.motion-batch-close:hover { background: rgba(255,255,255,.11); }

.motion-batch-body { min-height: 0; overflow: hidden; display: grid; grid-template-columns: minmax(340px, .85fr) minmax(470px, 1.25fr); }
.motion-batch-controls { min-height: 0; overflow-y: auto; padding: 25px 28px 28px; border-right: 1px solid rgba(255,255,255,.07); }
.motion-batch-filmstrip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: thin; }
.motion-batch-frame { position: relative; width: 76px; height: 96px; flex: 0 0 auto; overflow: hidden; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; background: #17131b; transition: border-color .2s, box-shadow .2s; }
.motion-batch-frame img { width: 100%; height: 100%; object-fit: cover; }
.motion-batch-frame span { position: absolute; left: 6px; bottom: 6px; padding: 3px 6px; border-radius: 20px; background: rgba(5,4,8,.72); font-size: 9px; font-weight: 800; }
.motion-batch-frame[data-status="rendering"] { border-color: var(--mb-violet); box-shadow: 0 0 20px rgba(156,92,255,.3); }
.motion-batch-frame[data-status="complete"] { border-color: #48dfac; box-shadow: 0 0 20px rgba(72,223,172,.22); }
.motion-batch-frame[data-status="failed"] { border-color: #ff6c7b; }

.motion-batch-guidance { display: block; margin-top: 14px; }
.motion-batch-guidance > span, .motion-batch-options legend { display: block; margin-bottom: 9px; color: #e9e2ed; font-size: 12px; font-weight: 750; }
.motion-batch-guidance textarea { width: 100%; min-height: 128px; resize: vertical; padding: 15px 16px; color: #fff; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.11); border-radius: 14px; font: inherit; line-height: 1.5; outline: none; box-sizing: border-box; }
.motion-batch-guidance textarea:focus { border-color: rgba(255,61,145,.72); box-shadow: 0 0 0 3px rgba(255,61,145,.1); }
.motion-batch-guidance small { display: block; margin-top: 7px; color: #817987; font-size: 11px; line-height: 1.45; }

.motion-batch-options { display: grid; gap: 16px; margin-top: 21px; }
.motion-batch-options fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.motion-batch-model-fieldset { padding-bottom: 2px !important; }
.motion-batch-models { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.motion-batch-models button { min-width: 0; display: grid; gap: 3px; padding: 11px 12px; text-align: left; color: #aaa1b0; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.028); cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.motion-batch-models button:hover { transform: translateY(-1px); border-color: rgba(255,61,145,.3); background: rgba(255,255,255,.05); }
.motion-batch-models button.active { color: #fff; border-color: rgba(255,61,145,.62); background: linear-gradient(135deg, rgba(255,61,145,.17), rgba(156,92,255,.16)); box-shadow: 0 8px 25px rgba(116,42,122,.16), 0 0 0 1px rgba(255,61,145,.08) inset; }
.motion-batch-models strong { overflow: hidden; text-overflow: ellipsis; font-size: 12px; white-space: nowrap; }
.motion-batch-models small { overflow: hidden; color: #776f7d; font-size: 9px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.motion-batch-models button.active small { color: #bcb1c2; }
.motion-batch-model-note { display: block; min-height: 27px; margin-top: 7px; color: #817987; font-size: 10px; line-height: 1.35; }
.motion-batch-segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; padding: 4px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.035); }
.motion-batch-segments button { min-height: 37px; padding: 7px 10px; border: 0; border-radius: 9px; color: #948b9b; background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
.motion-batch-segments button.active { color: #fff; background: linear-gradient(135deg, rgba(255,61,145,.82), rgba(156,92,255,.82)); box-shadow: 0 7px 24px rgba(156,92,255,.18); }
.motion-batch-audio { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(255,255,255,.025); cursor: pointer; }
.motion-batch-audio input { width: 17px; height: 17px; accent-color: var(--mb-pink); }
.motion-batch-audio span { display: grid; gap: 2px; }
.motion-batch-audio strong { font-size: 12px; }
.motion-batch-audio small { color: #817987; font-size: 10px; }

.motion-batch-summary { margin-top: 20px; padding: 15px 16px; border-radius: 14px; background: linear-gradient(135deg, rgba(255,61,145,.1), rgba(156,92,255,.1)); border: 1px solid rgba(255,255,255,.07); }
.motion-batch-summary div { display: flex; justify-content: space-between; gap: 15px; font-size: 12px; }
.motion-batch-summary strong { color: #fff; }
.motion-batch-summary small { display: block; margin-top: 7px; color: #8e8594; font-size: 10px; line-height: 1.4; }
.motion-batch-alert { display: none; margin-top: 12px; padding: 11px 13px; border-radius: 10px; font-size: 11px; line-height: 1.4; }
.motion-batch-alert:not(:empty) { display: block; }
.motion-batch-alert.error { color: #ffc5cd; background: rgba(255,76,99,.1); border: 1px solid rgba(255,76,99,.22); }
.motion-batch-alert.warning { color: #ffe1a3; background: rgba(255,183,66,.1); border: 1px solid rgba(255,183,66,.2); }
.motion-batch-alert.success { color: #b8f6e1; background: rgba(72,223,172,.08); border: 1px solid rgba(72,223,172,.18); }

.motion-batch-scripts-wrap { min-height: 0; display: flex; flex-direction: column; }
.motion-batch-scripts-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 19px 22px 14px; }
.motion-batch-scripts-heading > div { display: grid; gap: 2px; }
.motion-batch-scripts-heading span { font-size: 12px; font-weight: 800; }
.motion-batch-scripts-heading small { color: #817987; font-size: 10px; }
.motion-batch-text-btn { border: 0; color: #ffa8ce; background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.motion-batch-scripts { min-height: 0; overflow-y: auto; display: grid; gap: 10px; padding: 0 22px 24px; }
.motion-batch-script-card { display: grid; grid-template-columns: 92px 1fr; align-items: start; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; background: rgba(255,255,255,.025); }
.motion-batch-script-card > img { width: 92px; height: 122px; object-fit: cover; }
.motion-batch-script-content { min-width: 0; padding: 13px; }
.motion-batch-script-card-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.motion-batch-script-card-head strong { font-size: 11px; }
.motion-batch-script-card-head span { color: #958c9c; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.motion-batch-script-card[data-status="rendering"] .motion-batch-script-card-head span { color: #cbb2ff; }
.motion-batch-script-card[data-status="complete"] .motion-batch-script-card-head span { color: #77eabe; }
.motion-batch-script-card[data-status="failed"] .motion-batch-script-card-head span { color: #ff8d99; }
.motion-batch-script-field { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 8px; align-items: start; margin-top: 6px; }
.motion-batch-script-field > span { padding-top: 7px; color: #786f7e; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.motion-batch-script-field textarea { width: 100%; min-height: 38px; resize: vertical; box-sizing: border-box; padding: 7px 9px; border: 1px solid transparent; border-radius: 8px; color: #dcd4e1; background: rgba(0,0,0,.2); font-family: inherit; font-size: 10px; line-height: 1.45; outline: 0; }
.motion-batch-script-field textarea:focus { border-color: rgba(156,92,255,.5); background: rgba(0,0,0,.34); }
.motion-batch-script-empty, .motion-batch-script-error { min-height: 60px; display: flex; align-items: center; color: #726a77; font-size: 10px; }
.motion-batch-script-error { color: #ff9aa5; }

.motion-batch-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 17px 22px; border-top: 1px solid rgba(255,255,255,.08); background: rgba(7,6,9,.8); }
.motion-batch-footer button { min-height: 46px; border-radius: 12px; font-weight: 800; cursor: pointer; }
.motion-batch-footer button:disabled { opacity: .42; cursor: not-allowed; }
.motion-batch-secondary { padding: 0 20px; color: #efe9f2; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.1); }
.motion-batch-primary { min-width: 184px; display: grid; place-content: center; gap: 1px; padding: 7px 22px; color: #fff; border: 0; background: linear-gradient(115deg, var(--mb-pink), #c344e7 52%, var(--mb-violet)); box-shadow: 0 12px 30px rgba(213,59,175,.22); }
.motion-batch-primary small { font-size: 9px; font-weight: 650; opacity: .78; }

.lib-bulk-btn.lib-bulk-motion { color: #fff; border-color: rgba(255,61,145,.38); background: linear-gradient(115deg, rgba(255,61,145,.23), rgba(156,92,255,.2)); }
.lib-bulk-btn.lib-bulk-motion:not(:disabled):hover { border-color: rgba(255,61,145,.7); box-shadow: 0 0 20px rgba(255,61,145,.14); }

@media (max-width: 850px) {
  .motion-batch-overlay { align-items: flex-end; padding: 0; }
  .motion-batch { width: 100%; max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .motion-batch-header { padding: 21px 18px 16px; }
  .motion-batch-header p { max-width: 280px; }
  .motion-batch-body { display: block; overflow-y: auto; }
  .motion-batch-controls { overflow: visible; padding: 19px 17px 22px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.07); }
  .motion-batch-scripts-wrap { min-height: 360px; }
  .motion-batch-scripts { overflow: visible; padding: 0 15px 20px; }
  .motion-batch-footer { position: sticky; bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .motion-batch-footer button { flex: 1; min-width: 0; }
}

@media (max-width: 520px) {
  .motion-batch-header h2 { font-size: 30px; }
  .motion-batch-header p { font-size: 12px; }
  .motion-batch-script-card { grid-template-columns: 70px 1fr; }
  .motion-batch-script-card > img { width: 70px; height: 100px; }
  .motion-batch-script-field { grid-template-columns: 1fr; gap: 2px; }
  .motion-batch-script-field > span { padding-top: 2px; }
  .motion-batch-models { grid-template-columns: 1fr 1fr; }
  .motion-batch-models button { padding: 10px; }
}
