#MobileSearch > .header {
  position: absolute;
  z-index: var(--z-mobile-search);
  top: 0;
  left: 0;

  display: flex;
  align-items: center;

  width: 100%;
  height: 3.5rem;
  padding-right: max(0.5rem, env(safe-area-inset-right));
  padding-left: max(0.25rem, env(safe-area-inset-left));

  background: var(--color-background);

  > .SearchInput {
    flex: 1;
    margin-left: 0.25rem;
  }

  body.is-tauri.is-macos & {
    padding-left: var(--window-controls-width);
  }
}

#MobileSearch > .tags-subheader {
  --color-reaction: var(--color-background-secondary);
  --hover-color-reaction: var(--color-background-secondary-accent);
  --text-color-reaction: var(--color-text-secondary);
  --color-reaction-chosen: var(--color-primary);
  --text-color-reaction-chosen: #FFFFFF;
  --hover-color-reaction-chosen: var(--color-primary-shade);

  position: absolute;
  z-index: var(--z-mobile-search);
  top: 3.5rem;
  left: 0;

  overflow-x: scroll;
  display: flex;
  gap: 0.375rem;
  align-items: center;

  width: 100%;
  height: 3rem;
  padding-right: max(0.5rem, env(safe-area-inset-right));
  padding-left: max(0.25rem, env(safe-area-inset-left));

  background: var(--color-background);
}

#MobileSearch > .footer {
  position: absolute;
  z-index: var(--z-mobile-search);
  bottom: 0;
  left: 0;

  display: flex;
  align-items: center;

  width: 100%;
  height: 3.5rem;
  padding-right: max(0.5rem, env(safe-area-inset-right));
  padding-left: max(1rem, env(safe-area-inset-left));

  background: var(--color-background);

  body:not(.keyboard-visible) & {
    height: 3.5rem;
    padding-bottom: 0;
  }

  > .counter {
    flex: 1;
    color: var(--color-text-secondary);
  }

  @media (max-width: 600px) {
    body:not(.keyboard-visible) & {
      height: calc(3.5rem + env(safe-area-inset-bottom));
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

#MobileSearch:not(.active) {
  .header, .tags-subheader, .footer {
    // `display: none` will prevent synchronous focus on iOS
    transform: translateX(-999rem);
  }
}
