/* AutoTube User1 / Scenario UX & visual polish V4.0
   Presentation-only: keep all existing native elements, IDs, event listeners and pipelines. */

/* 1 / Controls anchored from the left, primary CTA anchored to the right. */
html body #scenarioGeneratePane .scenario-generator-controls {
  display: flex !important;
  width: 100% !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  min-width: 0 !important;
}
html body #scenarioGeneratePane .scenario-generator-controls > .scenario-new-profile-control {
  margin-left: 0 !important;
  flex: 0 0 38px !important;
}
html body #scenarioGeneratePane .scenario-generator-controls > .scenario-generator-field,
html body #scenarioGeneratePane .scenario-generator-controls > label.scenario-generator-field {
  flex: 0 0 auto !important;
  margin-left: 0 !important;
}
html body #scenarioGeneratePane .scenario-generator-controls > .at-v38-topics-button {
  margin-left: auto !important;
  margin-right: 0 !important;
  flex-shrink: 0 !important;
}
/* Native action remains hidden by V3.8, but untouched by this update. */
@media(max-width:760px) {
  html body #scenarioGeneratePane .scenario-generator-controls {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    overflow: visible !important;
  }
  html body #scenarioGeneratePane .scenario-generator-controls > .at-v38-topics-button {
    margin-left: 0 !important;
    flex: 1 1 100% !important;
  }
}

/* 2 / Voice Library is secondary, black with white typography. */
html:not([data-autotube-theme="dark"]) body #voiceTab #openLibraryButton:not(#v40-voice-a):not(#v40-voice-b):not(#v40-voice-c),
html:not([data-autotube-theme="dark"]) body #voiceTab #openLibraryButton:not(#v40-voice-a):not(#v40-voice-b):not(#v40-voice-c):not(:disabled),
html:not([data-autotube-theme="dark"]) body #voiceTab #openLibraryButton:not(#v40-voice-a):not(#v40-voice-b):not(#v40-voice-c):hover:not(:disabled),
html:not([data-autotube-theme="dark"]) body #voiceTab #openLibraryButton:not(#v40-voice-a):not(#v40-voice-b):not(#v40-voice-c):focus-visible:not(:disabled) {
  background: #101011 !important;
  background-image: none !important;
  border-color: #101011 !important;
  color: #FFFFFF !important;
  text-shadow: none !important;
  box-shadow: 0 7px 15px rgba(0,0,0,.12) !important;
  font-family: Inter, Arial, sans-serif !important;
  font-weight: 900 !important;
}
html:not([data-autotube-theme="dark"]) body #voiceTab #openLibraryButton:not(#v40-voice-a):not(#v40-voice-b):not(#v40-voice-c):hover:not(:disabled) {
  background: #242428 !important;
  border-color: #242428 !important;
}
html:not([data-autotube-theme="dark"]) body #voiceTab #openLibraryButton:not(#v40-voice-a):not(#v40-voice-b):not(#v40-voice-c):disabled {
  background: #DCDCDC !important;
  border-color: #DCDCDC !important;
  color: #757575 !important;
}

/* 3 / The scenario action is the last visible element of its topic panel. */
html body #scenarioGeneratePane #scenarioTopicView {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}
html body #scenarioGeneratePane #scenarioScriptControls:not(.hidden) {
  order: 10 !important;
  margin-top: auto !important;
  margin-bottom: 0 !important;
  padding-top: 10px !important;
  padding-bottom: 0 !important;
  align-self: stretch !important;
  flex: 0 0 auto !important;
}
/* Keep the native status in the DOM for the original app and assistive announcements. */
html body #scenarioGeneratePane #scenarioScriptProgress {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  border: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  pointer-events: none !important;
}
/* Errors remain readable, but appear ABOVE the action instead of beneath it. */
html body #scenarioGeneratePane #scenarioScriptError:not(:empty):not(.hidden) {
  order: 9 !important;
  flex: 0 0 auto !important;
  margin: 8px 0 0 !important;
  padding: 5px 8px !important;
  align-self: stretch !important;
  text-align: center !important;
}

/* 4 / Selected topics use red-tinted paper, always readable BLACK titles. */
html:not([data-autotube-theme="dark"]) body #scenarioGeneratePane .scenario-generator-panel .scenario-topic-item.selected,
html:not([data-autotube-theme="dark"]) body #scenarioGeneratePane .scenario-generator-panel .scenario-topic-item.selected:hover {
  background: #FFF6F7 !important;
  background-image: none !important;
  color: #151515 !important;
  border-color: #F5AAB2 !important;
  box-shadow: inset 0 0 0 1px rgba(240,0,22,.09) !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioGeneratePane .scenario-generator-panel .scenario-topic-item.selected .scenario-topic-copy,
html:not([data-autotube-theme="dark"]) body #scenarioGeneratePane .scenario-generator-panel .scenario-topic-item.selected .scenario-topic-copy strong,
html:not([data-autotube-theme="dark"]) body #scenarioGeneratePane .scenario-generator-panel .scenario-topic-item.selected:hover .scenario-topic-copy strong {
  color: #151515 !important;
  opacity: 1 !important;
  text-shadow: none !important;
  -webkit-text-fill-color: #151515 !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioGeneratePane .scenario-generator-panel .scenario-topic-item.selected .scenario-topic-copy small {
  color: #6C6D72 !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #6C6D72 !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioGeneratePane .scenario-generator-panel .scenario-topic-item.selected b {
  color: #141414 !important;
}

/* 5 / Script profile modal: brand typography, red progress, no pictogram tiles. */
html:not([data-autotube-theme="dark"]) body #scenarioProfileModal .scenario-profile-modal-dialog {
  font-family: Inter, Arial, sans-serif !important;
  background: #FAFAF9 !important;
  color: #101011 !important;
  border-radius: 23px !important;
  border-color: #E3E4E4 !important;
  box-shadow: 0 30px 85px rgba(20,20,22,.16) !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileModal .scenario-profile-modal-header h2,
html:not([data-autotube-theme="dark"]) body #scenarioProfileModal .scenario-profile-analysis-heading h3 {
  font-family: Inter, Arial, sans-serif !important;
  font-weight: 900 !important;
  letter-spacing: -.03em !important;
  color: #101011 !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileModal :is(p,input,select,.scenario-profile-source-hint,.scenario-profile-analysis-status) {
  font-family: Inter, Arial, sans-serif !important;
  font-weight: 500 !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileModal :is(label,button,.scenario-profile-analysis-kicker) {
  font-family: Inter, Arial, sans-serif !important;
  font-weight: 700 !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileModal .scenario-profile-source-card,
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual {
  background: #FFFFFF !important;
  border-color: #E7E7E5 !important;
  border-radius: 19px !important;
  box-shadow: none !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual {
  padding: 22px 24px !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual .scenario-profile-analysis-kicker {
  color: #F00016 !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: .1em !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual .scenario-profile-analysis-percent {
  color: #101011 !important;
  font-family: Inter, Arial, sans-serif !important;
  font-weight: 900 !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual .scenario-profile-progress-track {
  margin-top: 16px !important;
  height: 8px !important;
  background: #F5E6E8 !important;
  border-radius: 999px !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual .scenario-profile-progress-fill,
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual #scenarioProfileProgressFill {
  background: #F00016 !important;
  background-image: none !important;
  box-shadow: none !important;
  border-radius: inherit !important;
}
/* Stage cards remain in DOM, including their data-analysis-step attributes. */
html body #scenarioProfileAnalysisVisual .scenario-profile-analysis-grid {
  display: none !important;
}
html:not([data-autotube-theme="dark"]) body #scenarioProfileAnalysisVisual .scenario-profile-analysis-status {
  color: #737377 !important;
  margin-top: 12px !important;
  font-size: 12px !important;
}
/* AUTOTUBE_SCENARIO_UX_V40_END */
