dialog.lip-sync-dialog {
  width: min(1080px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: 94dvh;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: #14121e;
  color: #f7f3ff;
  border: 1px solid #393244;
  border-radius: 18px;
  box-shadow: 0 24px 90px #000b;
  font-family: Arial, sans-serif;
}
dialog.lip-sync-dialog::backdrop {
  background: #05030bd9;
}
dialog.lip-sync-dialog [hidden] {
  display: none !important;
}
dialog.lip-sync-dialog .lip-sync-heading {
  position: relative;
  margin: 0;
  padding: 0;
  display: block;
  height: 126px;
  overflow: hidden;
}
.lip-sync-heading picture,
.lip-sync-heading picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lip-sync-accessible-title {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
dialog.lip-sync-dialog .lip-sync-close {
  position: absolute;
  right: 12px;
  top: 12px;
  background: #101018dd;
  border-color: #ffffff30;
  padding: 8px 13px;
}
dialog.lip-sync-dialog .lip-sync-intro {
  margin: 0;
  padding: 12px 24px;
  color: #d7cfe4;
  font-size: 14px;
  background: #1b1728;
}
.lip-sync-wizard {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 390px;
  max-height: calc(94dvh - 260px);
  overflow: hidden;
}
.lip-sync-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 14px;
  background: #100e19;
  border-right: 1px solid #ffffff0d;
  overflow: auto;
}
dialog.lip-sync-dialog button {
  appearance: none;
  box-sizing: border-box;
  color: #f5f0ff;
  background: #282332;
  border: 1px solid #ffffff19;
  border-radius: 12px;
  padding: 11px 16px;
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  min-height: 42px;
}
dialog.lip-sync-dialog button:hover {
  background: #342b44;
  border-color: #ffffff35;
}
dialog.lip-sync-dialog button.primary {
  background: linear-gradient(120deg, #8c4fe5, #6940c5);
  border-color: #ad80ef;
}
dialog.lip-sync-dialog button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
dialog.lip-sync-dialog .lip-sync-steps button {
  text-align: left;
  background: transparent;
  border-color: transparent;
  padding: 11px 10px;
}
dialog.lip-sync-dialog .lip-sync-steps button[aria-current="step"] {
  background: #332544;
  color: #f5eaff;
  border-color: #9068b659;
}
.lip-sync-guide {
  width: 94px;
  height: 108px;
  object-fit: contain;
  align-self: center;
  margin: 18px 0 0;
}
.lip-sync-guide-copy {
  text-align: center;
  font-size: 12px;
  color: #bdb0cc;
  line-height: 1.5;
  margin: 0 8px;
}
.lip-sync-grid {
  display: block;
  min-width: 0;
  overflow: auto;
  margin: 0;
}
.lip-sync-main {
  padding: 22px 26px;
  min-width: 0;
}
dialog.lip-sync-dialog h3 {
  font-size: 21px;
  margin: 0 0 10px;
  font-weight: 650;
}
dialog.lip-sync-dialog p {
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.lip-sync-step-panel > p {
  font-size: 14px;
  color: #beb5ce;
  margin: 0 0 18px;
}
.lip-sync-library-tools {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}
dialog.lip-sync-dialog input:not([type="checkbox"]),
dialog.lip-sync-dialog select,
dialog.lip-sync-dialog textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #101018;
  color: #fff;
  border: 1px solid #ffffff21;
  border-radius: 10px;
  padding: 11px;
  font: inherit;
  font-size: 14px;
}
.lip-sync-library-tools input {
  flex: 1;
}
.lip-sync-library-tools button {
  flex-shrink: 0;
}
.lip-sync-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
dialog.lip-sync-dialog .lip-sync-library-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
  overflow: hidden;
  padding: 8px;
  background: #1e192b;
  border: 1px solid #ffffff16;
  border-radius: 13px;
  min-width: 0;
}
dialog.lip-sync-dialog .lip-sync-library-card[aria-pressed="true"] {
  border-color: #ba89f5;
  box-shadow: 0 0 0 1px #ba89f5;
  background: #30213e;
}
.lip-sync-library-card img,
.lip-sync-library-card video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
  background: #15101e;
}
.lip-sync-library-card img[src*="phantom-nav"] {
  object-fit: contain;
  height: 90px;
}
.lip-sync-library-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-weight: 600;
}
.lip-sync-library-card small {
  color: #c5b5d6;
  font-size: 12px;
}
.lip-sync-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  min-width: 0;
}
.lip-sync-clip-fields,
.lip-sync-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.lip-sync-options textarea {
  min-height: 90px;
  resize: vertical;
}
.lip-sync-preview audio {
  width: 100%;
  height: 40px;
}
.lip-sync-preview img,
.lip-sync-preview video {
  display: block;
  width: 100%;
  height: 155px;
  object-fit: contain;
  background: #0d0a13;
  border-radius: 12px;
}
.lip-sync-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 20px 0;
  font-size: 14px;
}
.lip-sync-consent input {
  margin-top: 3px;
  accent-color: #a15fe8;
}
.lip-sync-cost {
  color: #c6f8ff;
  font-weight: 700;
}
.lip-sync-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid #ffffff16;
  background: #171220;
  min-height: 60px;
}
.lip-sync-status {
  flex: 1;
  font-size: 12px;
  color: #bfb3d1;
  margin: 0;
  min-width: 0;
}
.lip-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}
.lip-sync-jobs {
  display: grid;
  gap: 16px;
}
.lip-sync-job {
  background: #20192c;
  padding: 16px;
  border: 1px solid #ffffff15;
  border-radius: 14px;
}
.lip-sync-job video {
  display: block;
  width: 100%;
  max-height: 320px;
  border-radius: 10px;
}
.lip-sync-job .lip-sync-actions {
  margin-top: 12px;
}
dialog.lip-sync-dialog :focus-visible {
  outline: 2px solid #bcefff;
  outline-offset: 3px;
}
@media (max-width: 700px) {
  .lip-sync-wizard {
    grid-template-columns: 150px minmax(0, 1fr);
  }
  .lip-sync-main {
    padding: 18px;
  }
  .lip-sync-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lip-sync-library-tools {
    flex-wrap: wrap;
  }
  .lip-sync-library-tools button {
    width: 100%;
  }
}
@media (max-width: 620px) {
  dialog.lip-sync-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: 96dvh;
    border-radius: 14px;
  }
  dialog.lip-sync-dialog .lip-sync-heading {
    height: 110px;
  }
  dialog.lip-sync-dialog .lip-sync-intro {
    padding: 10px 14px;
    font-size: 12px;
  }
  .lip-sync-wizard {
    display: flex;
    flex-direction: column;
    max-height: calc(96dvh - 275px);
    min-height: 280px;
  }
  .lip-sync-steps {
    flex-direction: row;
    flex-shrink: 0;
    padding: 8px;
    gap: 4px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #ffffff12;
  }
  .lip-sync-guide,
  .lip-sync-guide-copy {
    display: none;
  }
  dialog.lip-sync-dialog .lip-sync-steps button {
    font-size: 12px;
    white-space: nowrap;
    padding: 8px;
  }
  .lip-sync-main {
    padding: 16px;
  }
  .lip-sync-clip-fields,
  .lip-sync-options {
    grid-template-columns: 1fr;
  }
  .lip-sync-footer {
    padding: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .lip-sync-status {
    flex-basis: 100%;
    order: -1;
  }
  .lip-sync-actions {
    flex: 1;
  }
  .lip-sync-actions button {
    flex: 1;
  }
  .lip-sync-footer > button.primary {
    margin-left: auto;
  }
  .lip-sync-preview img,
  .lip-sync-preview video {
    height: 130px;
  }
}
@media (forced-colors: active) {
  dialog.lip-sync-dialog,
  .lip-sync-job {
    background: Canvas;
    border: 1px solid CanvasText;
  }
}
/* Explicit dialog geometry wins over the shared secondary-dialog cascade. */
body dialog.lip-sync-dialog[open] {
  display: grid;
  grid-template-rows: 126px auto minmax(0, 1fr) auto;
  height: min(810px, 88dvh);
  padding: 0;
  overflow: hidden;
}
body dialog.lip-sync-dialog .lip-sync-wizard {
  max-height: none;
  min-height: 0;
}
body dialog.lip-sync-dialog .lip-sync-heading {
  height: 126px;
  min-height: 126px;
}
body dialog.lip-sync-dialog .lip-sync-guide {
  width: 48px;
  height: 58px;
}
@media (max-width: 620px) {
  body dialog.lip-sync-dialog[open] {
    grid-template-rows: 110px auto minmax(0, 1fr) auto;
    height: 88dvh;
  }
  body dialog.lip-sync-dialog .lip-sync-heading {
    height: 110px;
    min-height: 110px;
  }
}
body dialog.lip-sync-dialog .lip-sync-steps {
  border-right: 0;
}
.lip-sync-identity {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #d2acff;
}
body dialog.lip-sync-dialog .lip-sync-identity .lip-sync-guide {
  margin: 0;
  flex: none;
  width: 42px;
  height: 50px;
}
.lip-sync-audio-art {
  width: 100%;
  height: 90px;
  display: grid;
  place-items: center;
  font-size: 42px;
  color: #ceb3ff;
  background: radial-gradient(ellipse at center, #3d285d, #171120);
  border-radius: 8px;
}
@media (max-width: 620px) {
  .lip-sync-identity {
    display: none;
  }
}
@media (max-width: 620px) {
  body dialog.lip-sync-dialog .lip-sync-steps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: visible;
  }
  body dialog.lip-sync-dialog .lip-sync-steps button {
    white-space: normal;
    text-align: left;
    font-size: 11px;
    min-height: 34px;
    padding: 7px 8px;
  }
}
body dialog.lip-sync-dialog,
body dialog.lip-sync-dialog p {
  font-family: Arial, sans-serif;
}
.lip-sync-library-card img.lip-sync-thumbnail-fallback {
  object-fit: contain;
  padding: 10px;
  box-sizing: border-box;
}
body dialog.lip-sync-dialog .lip-sync-grid {
  min-height: 0;
  scroll-padding-block: 18px;
}
body dialog.lip-sync-dialog .lip-sync-main {
  padding-bottom: 30px;
}
body dialog.lip-sync-dialog .lip-sync-field {
  scroll-margin-block: 18px;
}
@media (max-width: 620px) {
  body dialog.lip-sync-dialog .lip-sync-grid {
    flex: 1 1 auto;
  }
}

/* Keep a failed artwork request recoverable without hiding the window title. */
body dialog.lip-sync-dialog .lip-sync-banner-retry {
  position: absolute; left: 22px; bottom: 12px; z-index: 2;
}
body dialog.lip-sync-dialog .lip-sync-heading h2:not(.lip-sync-accessible-title) {
  position: absolute; top: 12px; left: 24px; margin: 0;
}
body dialog.lip-sync-dialog .lip-sync-consent-required {
  border: 1px solid #d6a7ff;
  border-radius: 10px;
  padding: 12px;
  background: #6b39852b;
}
body dialog.lip-sync-dialog .lip-sync-library-tools {
  flex-wrap: wrap;
}
body dialog.lip-sync-dialog .lip-sync-library-tools input {
  min-width: min(220px, 100%);
}
body dialog.lip-sync-dialog .lip-sync-review-summary {
  padding: 12px 14px;
  border: 1px solid #ab80d64d;
  border-radius: 12px;
  background: #38264b66;
  color: #f3e9ff;
}
