/* AI Project Universe V6.14
   - one translation trigger on phones, full language selector on laptop/desktop
   - natural content ending for Student Performance and AI Architect Lab */

/* Desktop/laptop: show the full native language selector and hide every icon trigger. */
@media (min-width: 761px) {
  .viewer .viewer__language-control {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    min-width: 220px !important;
    max-width: 280px !important;
    height: 44px !important;
    padding: 0 12px !important;
    border: 2px solid #d6dfed !important;
    border-radius: 11px !important;
    background: #ffffff !important;
    color: #0e1726 !important;
    opacity: 1 !important;
    overflow: hidden !important;
  }
  .viewer .viewer__language-control .viewer__control-icon {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    color: inherit !important;
  }
  .viewer #viewerLanguageControl {
    display: block !important;
    width: 100% !important;
    min-width: 160px !important;
    height: 38px !important;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    font: 800 13px/1 system-ui,-apple-system,"Segoe UI",sans-serif !important;
    opacity: 1 !important;
    cursor: pointer !important;
  }
  .viewer #viewerLanguageControl option {
    background: #ffffff !important;
    color: #0e1726 !important;
  }
  .viewer #apuV612LanguageTrigger,
  .viewer .apu-v69-language-button,
  .viewer .apu-v611-language-trigger,
  .viewer .apu-v612-language-trigger {
    display: none !important;
    visibility: hidden !important;
  }
  .viewer .apu-v612-language-menu,
  .viewer .apu-v69-language-menu,
  .viewer .apu-v611-language-menu {
    display: none !important;
  }
}

/* Phone: exactly one translation icon. The full selector remains hidden. */
@media (max-width: 760px) {
  .viewer .viewer__language-control,
  .viewer #viewerLanguageControl {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }
  .viewer .apu-v69-language-button:not(#apuV612LanguageTrigger),
  .viewer .apu-v611-language-trigger:not(#apuV612LanguageTrigger),
  .viewer .apu-v612-language-trigger:not(#apuV612LanguageTrigger) {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }
  .viewer #apuV612LanguageTrigger {
    display: inline-flex !important;
    visibility: visible !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 48px !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 3px solid #111 !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #111 !important;
    -webkit-text-fill-color: #111 !important;
    font: 900 22px/1 system-ui,-apple-system,"Segoe UI",sans-serif !important;
    opacity: 1 !important;
  }
  .viewer .apu-v612-language-menu {
    width: min(300px, calc(100vw - 20px)) !important;
    min-width: min(260px, calc(100vw - 20px)) !important;
    max-height: min(450px, calc(100dvh - 90px)) !important;
    background: #07111f !important;
    color: #fff !important;
    opacity: 1 !important;
    overflow-y: auto !important;
  }
  .viewer .apu-v612-language-option,
  .viewer .apu-v612-language-name {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    opacity: 1 !important;
  }
}

/* Student Performance: no visible artificial end marker, and no empty tail. */
@media (max-width: 820px) {
  html[data-scroll-theme="student-performance"] .sp-scroll-end {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  html[data-scroll-theme="student-performance"] .sp-footer {
    margin-bottom: 0 !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }
  html[data-scroll-theme="student-performance"] .sp-app,
  html[data-scroll-theme="student-performance"] .sp-main,
  html[data-scroll-theme="student-performance"] .sp-view.is-active {
    min-height: 0 !important;
    height: auto !important;
    padding-bottom: 0 !important;
  }
}

/* AI Architect Lab: finish immediately after the real content/footer, like Computer Vision. */
@media (max-width: 767px) {
  html[data-scroll-theme="ai-architect"],
  html[data-scroll-theme="ai-architect"] body,
  html[data-scroll-theme="ai-architect"] #root,
  html[data-scroll-theme="ai-architect"] #root > div,
  html[data-scroll-theme="ai-architect"] main {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  html[data-scroll-theme="ai-architect"] footer {
    margin-bottom: 0 !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }
  html[data-scroll-theme="ai-architect"] #root::after,
  html[data-scroll-theme="ai-architect"] body::after,
  html[data-scroll-theme="ai-architect"] main::after {
    content: none !important;
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}
