/* TN V351 – Restore existing AI Search button after V350 mobile Search layout.
   Layout-only. DOES NOT create a second AI button or alter search handlers.
   V350 forces its input to width:100%, which can squeeze a sibling AI action.
   Scope: native BeMusic mobile navbar; leave Search->Video/nav safeguards unchanged. */
@media screen and (max-width:800px) {
  body web-player material-navbar .navbar-container {
    min-width:0!important;
    overflow:visible!important;
  }
  body web-player material-navbar .logo-container {
    flex:1 1 0!important;
    min-width:0!important;
    max-width:min(46vw,195px)!important;
    overflow:hidden!important;
  }
  body web-player material-navbar .right-side-actions {
    flex:0 0 auto!important;
    min-width:max-content!important;
    gap:4px!important;
    overflow:visible!important;
  }
  /* Keep the close button to the right without clipping AI controls inside the search form. */
  body web-player material-navbar.mobile-search-active .nav-searchbar {
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    left:8px!important;
    right:58px!important;
    min-width:0!important;
    overflow:visible!important;
    box-sizing:border-box!important;
  }
  body web-player material-navbar.mobile-search-active .nav-searchbar form {
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    justify-content:flex-start!important;
    align-items:center!important;
    gap:6px!important;
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    overflow:visible!important;
    box-sizing:border-box!important;
  }
  /* Override V350 input width:100%, preserving space for any sibling AI button. */
  body web-player material-navbar.mobile-search-active .nav-searchbar form input:not([type=hidden]):not([type=submit]):not([type=button]) {
    flex:1 1 0!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }
  body web-player material-navbar.mobile-search-active .nav-searchbar form :is(button,input[type=button],input[type=submit],[role=button]),
  body web-player material-navbar.mobile-search-active .nav-searchbar > :is(button,[role=button]) {
    flex:0 0 auto!important;
    min-width:fit-content!important;
    max-width:none!important;
    width:auto!important;
    height:auto;
    white-space:nowrap!important;
    position:relative!important;
    visibility:visible!important;
    opacity:1!important;
    pointer-events:auto!important;
  }
  /* AI can also be a sibling of the search form (not inside it). */
  body web-player material-navbar.mobile-search-active .nav-searchbar :is(
    .tn-ai-search,.tn-ai-search-btn,.tn-ai-search-button,.tn-search-ai,.tn-search-ai-btn,
    .tn147-ai-button,[data-tn-ai-search],[aria-label*="AI" i],[title*="AI" i]
  ) {
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    flex:0 0 auto!important;
    position:relative!important;
    visibility:visible!important;
    opacity:1!important;
    pointer-events:auto!important;
    z-index:13!important;
  }
}
@media screen and (max-width:380px) {
  body web-player material-navbar .logo-container {max-width: min(43vw,155px)!important;}
}
