/* Match GP1's painted height and inset with square, centred tool tiles.
   Only the width of the tool tray grows to fit; its height is unchanged.
   Touch/tablet layouts and mobile app webviews retain their existing sizes. */
@media (min-width: 1101px) and (hover: hover) and (pointer: fine) {
  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 6px !important;
    gap: 6px !important;
  }

  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) {
    display: grid !important;
    place-items: center !important;
    box-sizing: border-box !important;
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    flex: 0 0 46px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    position: relative !important;
  }

  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) > span {
    display: grid !important;
    place-items: center !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex-basis: auto !important;
    border-radius: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    position: absolute !important;
    inset: 0 !important;
    line-height: 0 !important;
  }

  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) > span::before,
  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) > span > .learning-tool-icon {
    width: 32px !important;
    height: 32px !important;
  }

  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) > span::before {
    left: 50% !important;
    top: 50% !important;
    margin: 0 !important;
    transform: translate(-50%, -50%) !important;
  }
}

/* The smaller desktop row paints the GP pill between two 3px inner insets.
   Stretch to that very same content height; aspect-ratio keeps it square
   even when the browser snaps the tray border to a fractional CSS pixel. */
@media (min-width: 1101px) and (max-width: 1366px) and (hover: hover) and (pointer: fine) {
  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch {
    align-items: stretch !important;
    padding: 3px !important;
    gap: 3px !important;
  }

  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) {
    aspect-ratio: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 0 0 auto !important;
  }

  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) > span::before,
  html body .learning-home > header[data-app-header="home"].learner-nav.learner-nav
    .learning-nav-center .learning-tool-switch > :is(.top-formula-button, .top-simulation-button) > span > .learning-tool-icon {
    width: 28px !important;
    height: 28px !important;
  }
}
