/* Mobile header assistant variant.
   The visible control lives beside the language buttons. The real launcher
   remains in the assistant widget for the existing runtime to control. */
@media (max-width: 820px) {
  .language-switch-mobile {
    position: relative !important;
  }

  .mobile-ai-divider {
    display: inline-block !important;
    width: 1px !important;
    height: 18px !important;
    margin: 0 1px 0 2px !important;
    background: rgba(13, 59, 102, .22) !important;
    flex: 0 0 1px !important;
  }

  .mobile-ai-onboarding-hint {
    position: absolute !important;
    right: 36px !important;
    top: 50% !important;
    z-index: 180 !important;
    display: block !important;
    width: max-content !important;
    max-width: min(220px, calc(100vw - 126px)) !important;
    padding: 10px 13px !important;
    border: 1px solid rgba(181, 198, 216, .92) !important;
    border-radius: 16px !important;
    background: rgba(255, 255, 255, .98) !important;
    box-shadow: 0 14px 34px rgba(20, 45, 75, .18) !important;
    color: #17304d !important;
    font-weight: 800 !important;
    font-size: 12.2px !important;
    line-height: 1.25 !important;
    letter-spacing: -.01em !important;
    text-align: left !important;
    pointer-events: none !important;
    transform: translateY(-50%) !important;
    animation: mobileAiHeaderHintFade 6.4s ease-in-out .9s 1 both !important;
    will-change: opacity, transform, visibility !important;
  }

  .mobile-ai-onboarding-hint::after {
    content: "" !important;
    position: absolute !important;
    right: -7px !important;
    top: 50% !important;
    width: 12px !important;
    height: 12px !important;
    transform: translateY(-50%) rotate(45deg) !important;
    background: rgba(255, 255, 255, .98) !important;
    border-top: 1px solid rgba(181, 198, 216, .92) !important;
    border-right: 1px solid rgba(181, 198, 216, .92) !important;
  }

  .mobile-ai-onboarding-hint[hidden] {
    display: none !important;
  }

  html[lang="ru"] .mobile-ai-onboarding-hint { max-width: min(174px, calc(100vw - 160px)) !important; }
  html[lang="en"] .mobile-ai-onboarding-hint { max-width: min(214px, calc(100vw - 132px)) !important; }
  html[lang="es"] .mobile-ai-onboarding-hint { max-width: min(202px, calc(100vw - 144px)) !important; }

  /* There is one mobile launcher now: the header proxy. */
  .ai-widget .ai-toggle,
  html.ai-rail-enabled .ai-widget .ai-toggle,
  html.ai-rail-collapsed .ai-widget .ai-toggle,
  .ai-widget .ai-onboarding-hint {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .language-switch-mobile .mobile-ai-toggle {
    display: grid !important;
    place-items: center !important;
    flex: 0 0 31px !important;
    width: 31px !important;
    height: 25px !important;
    min-width: 31px !important;
    min-height: 25px !important;
    margin-left: 1px !important;
    padding: 0 !important;
    border: 1px solid #aac4d5 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    color: #23557e !important;
    background: #dceaf3 !important;
    box-shadow: 0 2px 6px rgba(33, 79, 120, .11) !important;
    cursor: pointer !important;
    line-height: 1 !important;
  }

  .language-switch-mobile .mobile-ai-toggle:hover,
  .language-switch-mobile .mobile-ai-toggle:focus-visible {
    border-color: #86aac4 !important;
    background: #dceaf3 !important;
  }

  .language-switch-mobile .mobile-ai-toggle:focus-visible {
    outline: 2px solid #f6b321 !important;
    outline-offset: 2px !important;
  }

  .language-switch-mobile .mobile-ai-toggle > .mobile-ai-bubble-icon {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    width: 17px !important;
    height: 12px !important;
    box-sizing: border-box !important;
    border: 1.6px solid #23557e !important;
    border-radius: 5px !important;
    pointer-events: none !important;
  }

  .language-switch-mobile .mobile-ai-bubble-icon::after {
    content: "" !important;
    position: absolute !important;
    left: 3px !important;
    bottom: -3px !important;
    width: 4px !important;
    height: 4px !important;
    border-left: 1.5px solid #23557e !important;
    border-bottom: 1.5px solid #23557e !important;
    background: #dceaf3 !important;
    transform: skewY(-23deg) !important;
  }

  .language-switch-mobile .mobile-ai-bubble-icon > i {
    width: 2px !important;
    height: 2px !important;
    flex: 0 0 2px !important;
    border-radius: 50% !important;
    background: #ce9c31 !important;
  }
}

@media (max-width: 390px) {
  .mobile-ai-onboarding-hint { right: 33px !important; padding: 9px 12px !important; font-size: 11.6px !important; }
  html[lang="ru"] .mobile-ai-onboarding-hint { max-width: min(166px, calc(100vw - 140px)) !important; }
  html[lang="en"] .mobile-ai-onboarding-hint { max-width: min(194px, calc(100vw - 120px)) !important; }
  html[lang="es"] .mobile-ai-onboarding-hint { max-width: min(188px, calc(100vw - 126px)) !important; }

  .language-switch-mobile .mobile-ai-toggle {
    flex-basis: 28px !important;
    width: 28px !important;
    min-width: 28px !important;
  }
}

@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  .mobile-ai-onboarding-hint {
    animation: mobileAiHeaderHintReducedFade 6s linear .5s 1 both !important;
    will-change: auto !important;
  }
}

@keyframes mobileAiHeaderHintFade {
  0% { opacity: 0; visibility: visible; transform: translateY(calc(-50% + 4px)) scale(.985); }
  12% { opacity: 1; visibility: visible; transform: translateY(-50%) scale(1); }
  78% { opacity: 1; visibility: visible; transform: translateY(-50%) scale(1); }
  100% { opacity: 0; visibility: hidden; transform: translateY(calc(-50% + 2px)) scale(.99); }
}

@keyframes mobileAiHeaderHintReducedFade {
  0%, 82% { opacity: 1; visibility: visible; transform: translateY(-50%); }
  100% { opacity: 0; visibility: hidden; transform: translateY(-50%); }
}

@media (min-width: 821px) {
  .mobile-ai-toggle {
    display: none !important;
  }
}
