The game cannot go on indefinitely. When $$$n \le k$$$, Alice must end the game immediately; otherwise, Bob will remove the green card on the next turn, making the score $$$0$$$. Moreover, Bob can continuously remove cards to make the deck thinner. Therefore, Bob has the ability to prevent Alice from continuing the game indefinitely.
First, consider the case where $$$s=1$$$. In this situation, Alice must decide whether to take the green card or put it back. Once she puts it back, who gets the green card next only depends on its position. It can be observed that only when $$$n \equiv k \pmod{2k}$$$, regardless of how Alice puts it back, she cannot get the green card next time. In this case, it is clearly optimal to remove the green card directly; otherwise, Alice can always find a way to ensure she gets the green card next time by placing it either before or after all the other removed cards. Thus, putting it back is definitely better than removing it directly.
Starting from Alice putting the green card back, both players will perform $$$x = \left\lfloor \frac{n+k}{2k} \right\rfloor$$$ operations, after which it will again become a situation where Alice can take the green card. The key question is how much the size of the pile will change.
Let $$$f_k(n)$$$ be the final score when the pile size is $$$n$$$, $$$s=1$$$, and $$$k=k$$$. In each subsequent operation, both players can choose to remove a card or not. We can prove that the final score will be $$$1 + \max\left\{\min\{f_k(n-x-1), f_k(n-x)\}, \min\{f_k(n-x), f_k(n-x+1)\}\right\}$$$. Alternatively, it can be expressed as $$$1 + \min\{\max\{f_k(n-x-1), f_k(n-x+1)\}, f_k(n-x)\}$$$.
There are a total of $$$2x$$$ operations, which may remove between $$$0$$$ and $$$2x$$$ cards. We can shift the coordinate system to consider that, in the end, there will be $$$n-x$$$ cards left. When one person removes a card, it is equivalent to reducing the pile by $$$0.5$$$ cards, while not removing it increases the pile by $$$0.5$$$ cards. For Alice, she can choose to move $$$0.5$$$ steps left or right on her first move, and then let Bob choose one of the two adjacent options. Bob can always ensure he picks the smaller of the two, as long as all his subsequent moves are the opposite of Alice's. Thus, the final score will be less than or equal to this. Conversely, Alice can ensure that the score is greater than or equal to the smaller of the two options because she can make Bob make the same choice each time. Therefore, the answer must be this. However, there is a special case: when $$$n \equiv k+1 \pmod{2k}$$$, Alice must not remove the card and must place the green card at the bottom of the pile to ensure she can take it next time. Thus, in this case, Alice's first move can only be to move right, and the answer becomes $$$1 + \min\left\{ f_k(n - \left\lfloor \frac{n+k}{2k} \right\rfloor), f_k(n - \left\lfloor \frac{n+k}{2k} \right\rfloor + 1) \right\}$$$.
Next, this problem has an interesting property (which I discovered through tabulation): when $$$f_k(n-1) \lt f_k(n) \gt f_k(n+1)$$$, it must be that $$$n \equiv k-1 \pmod{2k}$$$. The proof is not difficult. Consider segmenting based on $$$n \equiv k \pmod{2k}$$$. For the case where $$$n-1, n, n+1$$$ are in the same segment (i.e., not including points where these values are $$$1$$$), let $$$f_k(n-1) = \max\{[m_{12},] m_{23}\}, f_k(n) = \max\{m_{23}, m_{34}\}, f_k(n+1) = \max\{m_{34}, m_{45}\}$$$. Here, $$$m_{ij}$$$ represents the minimum value of two adjacent terms of $$$f_k$$$ plus $$$1$$$. If $$$m_{23} \ge m_{34}$$$, then $$$f_k(n-1) \ge f_k(n)$$$ (regardless of whether the term $$$m_{12}$$$ exists), and if $$$m_{23} \lt m_{34}$$$, then $$$f_k(n+1) \ge f_k(n)$$$. When $$$n \equiv k+1$$$, $$$f_k(n-1) = 1, f_k(n) = m_{34}, f_k(n+1) = \max\{m_{34}, m_{45}\} \ge f_k(n)$$$. When $$$n \equiv k$$$, $$$f_k(n) = 1$$$ will certainly not be greater than the two sides. Therefore, when $$$f_k(n-1) \lt f_k(n) \gt f_k(n+1)$$$, it must be that $$$n \equiv k-1 \pmod{2k}$$$. At this point, $$$f_k(n+1) = 1$$$.
Thus, as long as it is not one of the three cases $$$n \equiv k, n \equiv k+1, n-x \equiv k-1$$$, we have $$$f_k(n) = f_k(n-x) + 1$$$. For the third case, since $$$f_k(n-x-1)$$$ must be greater than or equal to $$$f_k(n-x+1) = 1$$$, it can be expressed as $$$1 + \min\left\{ f_k(n - \left\lfloor \frac{n+k}{2k} \right\rfloor), f_k(n - \left\lfloor \frac{n+k}{2k} \right\rfloor - 1) \right\}$$$. Thus, we have the following recurrence relation:
$$$$$$f_k(n) = \begin{cases} 1, & n \equiv k \pmod{2k} \\ 1 + \min\left\{f_k\left(n - \left\lfloor \frac{n+k}{2k} \right\rfloor\right), f_k\left(n - \left\lfloor \frac{n+k}{2k} \right\rfloor + 1\right)\right\}, & n \equiv k+1 \pmod{2k} \\ 1 + \min\left\{ f_k\left(n - \left\lfloor \frac{n+k}{2k} \right\rfloor\right), f_k\left(n - \left\lfloor \frac{n+k}{2k} \right\rfloor - 1\right) \right\}, & n \equiv k-1 + \left\lfloor \frac{n+k}{2k} \right\rfloor \not\equiv k+1 \pmod{2k} \\ 1 + f_k(n - \left\lfloor \frac{n+k}{2k} \right\rfloor), & \text{otherwise} \end{cases}$$$$$$
Note that when $$$k$$$ is relatively large, $$$x$$$ is quite small, so for the last case, we can speed up at the same $$$x$$$. That is, consider jumping continuously $$$\left\lfloor \frac{(n+k) \bmod 2k}{x} \right\rfloor$$$ steps. Clearly, this will not pass through the first three cases. If this value is $$$0$$$, then we just make one step normally.
Next, consider the case where $$$s \ne 1$$$. In other words, as the green card surfaces, both players still need to perform $$$x = \left\lfloor \frac{s-1}{2k} \right\rfloor$$$ operations. Thus, according to the previous analysis, the answer is $$$\min\{\max\{f_k(n-x-1), f_k(n-x+1)\}, f_k(n-x)\}$$$.
The recurrence relation can be solved using memoization. Since when $$$n \equiv k$$$, it immediately returns $$$1$$$, and when $$$n \equiv k+1$$$, it will expand backward, encountering $$$n \equiv k-1$$$ will expand forward, so at each level, at most two states will be accessed. When $$$n \le (2k)^2$$$, we have $$$x \le 2k$$$, and because we accelerated the last line, there will only be $$$\min\{n, (2k)^2\} / 2k$$$ layers. When $$$n \gt (2k)^2$$$, each time $$$n$$$ will change to $$$\frac{2k-1}{2k}$$$ of its original value, resulting in $$$2k \max\{0, \log(n/(2k)^2)\}$$$ layers. The former reaches its maximum when $$$k = \sqrt{n}/2$$$, and the latter reaches its maximum when $$$k = \sqrt{n}/(2e)$$$, both being $$$O(\sqrt{n})$$$.