/**
 * MyVideoStudio — Avatar Create (v1.45.16)
 * 3-column studio layout matching Image / Video / UGC / Face Swap / Lip-sync.
 */

.mvs-avc {
  display: grid;
  grid-template-columns: 370px 1fr 280px;
  gap: 16px;
  min-height: calc(100vh - 120px);
  align-items: start;
}
.mvs-avc svg { display: inline-block; flex-shrink: 0; }

/* =====================================================================
   LEFT: CONFIG SIDEBAR
   ===================================================================== */
.mvs-avc__config {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.mvs-avc__config::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Intro */
.mvs-avc__intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px 2px;
}
.mvs-avc__intro-eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  color: #94A3B8;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mvs-avc__intro-eyebrow::before {
  content: '';
  width: 14px;
  height: 1px;
  background: #3C50E0;
}
.mvs-avc__intro-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #1C2434;
  letter-spacing: -0.01em;
}
.mvs-avc__intro-name svg { width: 14px; height: 14px; color: #3C50E0; }

/* Step block */
.mvs-avc__step {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #F1F5F9;
  transition: opacity 200ms ease;
}
.mvs-avc__step:first-of-type { padding-top: 0; border-top: none; }
.mvs-avc__step-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  letter-spacing: -0.005em;
}
.mvs-avc__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #EFF4FB;
  color: #3C50E0;
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Field */
.mvs-avc__field { display: flex; flex-direction: column; gap: 6px; }
.mvs-avc__label {
  font-size: 11px;
  font-weight: 600;
  color: #64748B;
  letter-spacing: -0.005em;
}

/* Input / textarea / select */
.mvs-avc__textarea,
.mvs-avc__select {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  color: #1C2434;
  letter-spacing: -0.005em;
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
  box-sizing: border-box;
}
.mvs-avc__textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.5;
}
.mvs-avc__select { height: 38px; }
.mvs-avc__textarea:focus,
.mvs-avc__select:focus {
  border-color: #3C50E0;
  box-shadow: 0 0 0 3px rgba(60, 80, 224, 0.12);
}
.mvs-avc__select {
  padding-right: 28px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

/* Segmented control */
.mvs-avc__seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  background: #F1F5F9;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  width: 100%;
  box-sizing: border-box;
}
.mvs-avc__seg-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: #64748B;
  cursor: pointer;
  letter-spacing: -0.005em;
  padding: 0 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 130ms ease, color 130ms ease, box-shadow 130ms ease;
}
.mvs-avc__seg-tab svg { width: 12px !important; height: 12px !important; flex-shrink: 0; opacity: 0.7; }
.mvs-avc__seg-tab:hover { color: #1C2434; }
.mvs-avc__seg-tab:hover svg { opacity: 1; }
.mvs-avc__seg-tab.is-active {
  background: #FFFFFF;
  color: #1C2434;
  box-shadow: 0 1px 3px rgba(28, 36, 52, 0.08), 0 0 0 1px rgba(60, 80, 224, 0.12);
}
.mvs-avc__seg-tab.is-active svg { opacity: 1; color: #3C50E0; }

/* Source panel */
.mvs-avc__source { display: flex; flex-direction: column; gap: 10px; }
.mvs-avc__source[hidden] { display: none !important; }

/* Drop zone (upload) */
.mvs-avc__drop {
  position: relative;
  display: block;
  width: 100%;
  min-height: 140px;
  background: #F7F9FC;
  border: 1.5px dashed #CBD5E1;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 130ms ease, background 130ms ease;
}
.mvs-avc__drop:hover { background: #EFF4FB; border-color: #3C50E0; }
.mvs-avc__drop.is-loaded { background: #FFFFFF; border-style: solid; border-color: #E2E8F0; }
.mvs-avc__drop-input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 1;
}
.mvs-avc__drop-empty {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #64748B;
  font-size: 12.5px;
  font-weight: 600;
  padding: 16px;
  text-align: center;
  pointer-events: none;
}
.mvs-avc__drop-empty svg { width: 28px; height: 28px; color: #94A3B8; margin-bottom: 4px; }
.mvs-avc__drop-empty small { font-weight: 500; font-size: 11px; color: #94A3B8; }
.mvs-avc__drop.is-loaded .mvs-avc__drop-empty { display: none; }
.mvs-avc__drop-preview {
  position: relative;
  width: 100%;
  min-height: 140px;
  z-index: 2;
}
.mvs-avc__drop-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}
.mvs-avc__drop-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(28, 36, 52, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 4;
  transition: background 130ms ease, transform 130ms ease;
}
.mvs-avc__drop-clear:hover { background: #DC2626; transform: scale(1.05); }
.mvs-avc__drop-clear svg { width: 14px !important; height: 14px !important; }

/* Intermediate step button (Generate image — Step 1 → Step 2) */
.mvs-avc__step-btn {
  height: 40px;
  background: #FFFFFF;
  color: #1C2434;
  border: 1px solid #1C2434;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: -0.005em;
  transition: background 130ms ease, color 130ms ease;
}
.mvs-avc__step-btn:hover { background: #1C2434; color: #FFFFFF; }
.mvs-avc__step-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.mvs-avc__step-btn svg { width: 13px !important; height: 13px !important; }
.mvs-avc__step-btn-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: mvs-avc-spin 0.7s linear infinite;
}
.mvs-avc__step-btn.is-loading svg { display: none; }

/* Run (final) */
.mvs-avc__run-wrap {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #F1F5F9;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 200ms ease;
}
.mvs-avc__cost-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #64748B;
}
.mvs-avc__cost-line strong {
  color: #1C2434;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.mvs-avc__run {
  height: 48px;
  background: #1C2434;
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: -0.005em;
  transition: background 130ms ease, transform 80ms ease;
}
.mvs-avc__run:hover { background: #000000; }
.mvs-avc__run:active { transform: translateY(0.5px); }
.mvs-avc__run:disabled { background: #94A3B8; cursor: not-allowed; }
.mvs-avc__run-icon { width: 16px !important; height: 16px !important; }
.mvs-avc__run-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: mvs-avc-spin 0.7s linear infinite;
}
.mvs-avc__run.is-loading .mvs-avc__run-icon { display: none; }

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

/* =====================================================================
   CENTER: PLAYER + GALLERY
   ===================================================================== */
.mvs-avc__main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

/* Player adapts to aspect (default portrait 9:16) */
.mvs-avc__player-wrap {
  background: #0F172A;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  max-width: 360px;
  max-height: 640px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: aspect-ratio 200ms ease, max-width 200ms ease;
}
.mvs-avc__player-wrap.is-square { aspect-ratio: 1 / 1; max-width: 480px; max-height: none; }
.mvs-avc__player-wrap.is-landscape { aspect-ratio: 16 / 9; max-width: 100%; max-height: none; }
.mvs-avc__player-wrap video,
.mvs-avc__player-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.mvs-avc__player-empty {
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  padding: 20px;
}
.mvs-avc__player-empty svg { width: 56px; height: 56px; opacity: 0.5; }
.mvs-avc__player-empty p { margin: 0; max-width: 240px; line-height: 1.4; }
.mvs-avc__player-queued {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #FFFFFF;
  font-size: 13px;
  padding: 20px;
  text-align: center;
}
.mvs-avc__player-queued-step {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 600;
}
.mvs-avc__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: mvs-avc-spin 0.8s linear infinite;
}

/* Gallery — masonry 3 cols */
.mvs-avc__gallery {
  display: grid;
  grid-template-columns: 1fr 1fr; /* v1.62.10 — two columns instead of one */
  gap: 10px;
  min-height: 100px;
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}
.mvs-avc__gallery::-webkit-scrollbar { width: 6px; }
.mvs-avc__gallery::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
.mvs-avc__gallery-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #64748B;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.mvs-avc__gallery-loading .mvs-avc__spinner {
  border-color: #E2E8F0;
  border-top-color: #3C50E0;
}

.mvs-avc__card {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #F1F5F9;
  position: relative;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.mvs-avc__card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(28, 36, 52, 0.08);
}
.mvs-avc__card.is-active { outline: 2px solid #3C50E0; outline-offset: 2px; }
.mvs-avc__card video,
.mvs-avc__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mvs-avc__card-tools {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 5px;
  padding: 4px;
  background: rgba(28, 36, 52, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 9px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: 3;
}
.mvs-avc__card:hover .mvs-avc__card-tools {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mvs-avc__card-tool {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 130ms ease, color 130ms ease, transform 130ms ease;
}
.mvs-avc__card-tool svg { width: 14px !important; height: 14px !important; }
.mvs-avc__card-tool:hover { background: rgba(255, 255, 255, 0.14); color: #FFFFFF; }
.mvs-avc__card-tool:active { transform: scale(0.94); }
.mvs-avc__card-tool.is-danger:hover { background: rgba(220, 38, 38, 0.7); }

.mvs-avc__card--queued {
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F1F5F9;
}
.mvs-avc__card--failed {
  aspect-ratio: 9 / 16;
  background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
  border: 1px solid #FCA5A5;
  color: #991B1B;
  font-size: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}
.mvs-avc__card-failed-body { display: flex; flex-direction: column; align-items: center; max-width: 200px; line-height: 1.4; }
.mvs-avc__card-erase {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: #991B1B;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0; z-index: 4;
  transition: background 130ms ease, transform 130ms ease, color 130ms ease;
}
.mvs-avc__card-erase:hover {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
  transform: scale(1.05);
}

.mvs-avc__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  color: #64748B;
}
.mvs-avc__empty-icon { font-size: 36px; opacity: 0.5; margin-bottom: 10px; }
.mvs-avc__empty-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #1C2434;
  margin: 0 0 6px;
}
.mvs-avc__empty-text { margin: 0; font-size: 13px; color: #64748B; }

.mvs-avc__failed-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 10px;
  margin: 0 0 12px;
  break-inside: avoid;
}
.mvs-avc__failed-bar-text { font-size: 12.5px; color: #991B1B; font-weight: 500; }
.mvs-avc__failed-bar-btn {
  background: #DC2626;
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 130ms ease;
}
.mvs-avc__failed-bar-btn:hover { background: #991B1B; }

/* =====================================================================
   CENTER: INFO BAR (below the player) — horizontal layout
   ===================================================================== */
.mvs-avc__info {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mvs-avc__info-empty {
  color: #94A3B8;
  text-align: center;
  font-size: 13px;
  padding: 18px 12px;
}
.mvs-avc__details-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #1C2434;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.3;
}
.mvs-avc__details-thumb {
  border-radius: 10px;
  overflow: hidden;
  background: #F1F5F9;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
}
.mvs-avc__details-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.mvs-avc__details-script {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.6;
  background: #F7F9FC;
  border-radius: 10px;
  padding: 10px 12px;
  border-left: 3px solid #3C50E0;
  max-height: 120px;
  overflow-y: auto;
  flex: 1;
  min-width: 200px;
}
.mvs-avc__details-script-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #3C50E0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.mvs-avc__details-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.mvs-avc__details-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.mvs-avc__details-date { font-size: 11.5px; color: #94A3B8; }
.mvs-avc__details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #F1F5F9;
}
.mvs-avc__details-iconbtn {
  width: 38px;
  height: 38px;
  background: #F7F9FC;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease;
}
.mvs-avc__details-iconbtn:hover {
  background: #EFF4FB;
  border-color: #3C50E0;
  color: #3C50E0;
}
.mvs-avc__details-iconbtn.is-danger:hover {
  background: #FEE2E2;
  border-color: #DC2626;
  color: #DC2626;
}
.mvs-avc__details-iconbtn svg { width: 15px !important; height: 15px !important; }

/* A row that lays thumb + script side by side inside the info bar */
.mvs-avc__info-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* =====================================================================
   RIGHT: AVATAR GRID RAIL
   ===================================================================== */
.mvs-avc__rail {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 12px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.mvs-avc__rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 4px;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1180px) {
  .mvs-avc { grid-template-columns: 360px 1fr; }
  .mvs-avc__rail { grid-column: 1 / -1; position: static; max-height: none; }
  .mvs-avc__gallery { flex-direction: row; flex-wrap: wrap; }
  .mvs-avc__gallery > * { flex: 0 0 150px; }
}
@media (max-width: 860px) {
  .mvs-avc { grid-template-columns: 1fr; }
  .mvs-avc__config { position: static; max-height: none; }
}

/* v1.68.0 — Avatar manual validation (gates UGC + Lip-sync visibility) */
.mvs-avc__card { position: relative; }
.mvs-avc__card-valid {
  position: absolute; top: 6px; left: 6px; z-index: 3;
  display: none; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 999px;
  background: #10B981; color: #fff; font-size: 11px; font-weight: 700;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  box-shadow: 0 1px 4px rgba(16,24,40,.25);
}
.mvs-avc__card-valid.is-on { display: inline-flex; }
.mvs-avc__card-tool--valid.is-on {
  background: #10B981; color: #fff; border-color: #10B981;
}
.mvs-avc__card-tool--valid.is-on:hover { background: #0EA371; }
