How to add inline css/js inside a shortcode

Nope, that won’t work. By the time WordPress starts evaluating the shortcode in your content, the head of the site has already been assembled, so you can no longer add an action to it.

Looking at the execution order of hooks gives you a clue how to do this.

First, you must avoid echoing scripts. Rather, wp_enqueue_script (which is the same as wp_enqueue_style) is the method to use if you want to avoid conflicts between scripts. Since the scripts go in the head, you want your action to be declared before wp_head is called. Given that you need to extract information from a post, you must hook in after WP knows which post is on this page. That hook is wp. Here you must pre-evaluate the post content to extract the relevant shortcode using regex. Roughly your function will look like:

add_action ('wp', 'add_shortcode_script');

function add_shortcode_script () {
  global $post;
  ... use regex to scan $post->$post_content for your shortcode
  ... and extract $value2 and $value3
  wp_enqueue_script (...vars based on $value2...);
  wp_enqueue_style (...vars based on $value3...);
}

Above is what you need if the shortcode indicates the addition of a css/js file. In your example you only add a snippet, which supposedly alters the behaviour of a main css/js file. This means you should use wp_add_inline_script and wp_add_inline_style. The latter part of the code then becomes:

  wp_enqueue_script ('my_script','http:/.../main.js');
  wp_enqueue_style ('my_style','http:/.../main.css');
  wp_add_inline_script ('my_script', $string_based_on_value2);
  wp_add_inline_style ('my_style', $string_based_on_value3);