/* Keep the language controls at the right end of the fixed filing bar. */
#app .app-lang-switcher {
  top: auto !important;
  left: auto !important;
  right: 16px !important;
  bottom: calc(4px + env(safe-area-inset-bottom)) !important;
  width: 86px;
  height: 24px;
  box-sizing: border-box;
  justify-content: center;
  padding: 2px 6px;
  transform: none !important;
  --hx-lang-bg: var(--bg-card, #fff);
  --hx-lang-fg: var(--text-secondary, #718096);
  --hx-lang-fg-hover: var(--text-primary, #2d3748);
  --hx-lang-fg-active: var(--brand, #667eea);
  --hx-lang-active-bg: rgba(var(--brand-rgb, 102, 126, 234), 0.12);
  border-color: var(--border-color, rgba(102, 126, 234, 0.18));
}

#app .app-main .footer {
  box-sizing: border-box;
  min-height: calc(33px + env(safe-area-inset-bottom));
  padding-right: 114px !important;
  justify-content: flex-end;
}

/* Two complete rows on narrow screens; the filing and toggle share the last row. */
@media (max-width: 640px) {
  #app .app-lang-switcher {
    right: 10px !important;
  }

  #app .app-main .footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 4px 8px;
    padding: 4px 10px calc(4px + env(safe-area-inset-bottom)) !important;
  }

  #app .app-main .footer .footer-actions {
    grid-column: 1 / -1;
    justify-self: center;
    margin-right: 0;
  }

  #app .app-main .footer .footer-link {
    grid-column: 1;
    justify-self: end;
    min-height: 24px;
    box-sizing: border-box;
  }

  #app .app-main :is(.main-content, .student-works-page, .public-resources-page, .course-resources-page) {
    padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important;
  }
}

/* The Windows block-coding home shares the same footer placement. */
.windows-site-footer {
  position: fixed; inset: auto 0 0; z-index: 800;
  display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  box-sizing: border-box; min-height: 33px; padding: 4px 16px;
  color: #718096; background: #fff; border-top: 1px solid #e8e3ed;
  font: 13px system-ui, sans-serif;
}
.windows-site-footer a { color: inherit; text-decoration: none; white-space: nowrap; }
.windows-language { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #e8e3ed; border-radius: 999px; padding: 2px 6px; }
.windows-language button { border: 0; border-radius: 999px; background: transparent; color: #718096; padding: 2px 6px; cursor: pointer; }
.windows-language button.active { background: #eee7fa; color: #7659ba; }
.hx-windows-graphical main { padding-bottom: 64px; }
