Let $\pi \in A$ be a uniformizer. Let $w \in B$ and $P \in B[t]$ be as in Lemma \ref{lemma-prepare} (for $B$). Set $e_1 = \text{ord}_B(w)$, so that $w$ and $\pi^{e_1}$ are associates in $B$. Pick $z \in M$ generating $M$ over $L$ with $\xi = P(z) \in K$ and $n$ such that $\pi^n\xi \in B$ as in the definition of the level of $M$ over $L$, i.e., $l = n/e_1$. \medskip\noindent The proof of this lemma is completely similar to the proof of Lemma \ref{lemma-characteristic-p-case}. To explain what is going on, observe that \begin{equation} \label{equation-first-congruence} P(z) \equiv z^p - z \bmod \pi^{-n + e_1}B \end{equation} for any $z \in L$ such that $\pi^{-n} P(z) \in B$ (use that $z$ has valuation at worst $-n/p$ and the shape of the polynomial $P$). Moreover, we have \begin{equation} \label{equation-second-congruence} \xi_1 + \xi_2 + w^p \xi_1 \xi_2 \equiv \xi_1 + \xi_2 \bmod \pi^{-2n + pe_1}B  \end{equation} for $\xi_1, \xi_2 \in \pi^{-n}B$. Finally, observe that $n - e_1 = (l - 1)/e_1$ and $-2n + pe_1 = -(2l - p)e_1$. Write $m = n - e_1 \max(0, l - 1, 2l - p)$. The above shows that doing calculations in $\pi^{-n}B / \pi^{-n + m}B$ the polynomial $P$ behaves exactly as the polynomial $z^p -  z$. This explains why the lemma is true but we also give the details below. \medskip\noindent Assumption (4) implies that $\kappa_A$ is perfect. Observe that $m \leq e_1$ and hence $A/\pi^m$ is annihilated by $w$ and hence $p$. Thus we may choose compatible ring maps $\overline{\sigma} : \kappa_A \to A/\pi^mA$ and $\overline{\sigma} : \kappa_B \to B/\pi^mB$ as in Lemma \ref{lemma-cohen}. We lift the second of these to a map of sets $\sigma : \kappa_B \to B$. Then we can write $$ \xi = \sum\nolimits_{i = n, \ldots, n - m + 1} \sigma(\lambda_i) \pi^{-i} + \pi^{-n + m)} b $$ for some $\lambda_i \in \kappa_B$ and $b \in B$. Let $$ I = \{i \in \{n, \ldots, n - m + 1\} \mid \lambda_i \in \kappa_A\} $$ and $$ J = \{j \in \{n, \ldots, n - m + 1\} \mid \lambda_i \not \in \kappa_A\} $$ We will argue by induction on the size of the finite set $J$. \medskip\noindent The case $J = \emptyset$. Here for all $i \in \{n, \ldots, n - m + 1\}$ we have $\sigma(\lambda_i) = a_i + \pi^{n - m}b_i$ for some $a_i \in A$ and $b_i \in B$ by our choice of $\overline{\sigma}$. Thus $\xi = \pi^{-n} a + \pi^{-n + m} b$ for some $a \in A$ and $b \in B$. If $p | n$, then we write $a = a_0^p + \pi a_1$ for some $a_0, a_1 \in A$ (as the residue field of $A$ is perfect). Set $z_1 = - \pi^{-n/p} a_0$. Note that $P(z_1) \in \pi^{-n}B$ and that $z + z_1 + w z z_1$ is an element generating $M$ over $L$ (note that $wz_1 \not = -1$ as $n < pe_1$). Moreover, by Lemma \ref{lemma-prepare} we have $$ P(z + z_1 + w z z_1) = P(z) + P(z_1) + w^p P(z) P(z_1) \in K $$ and by equations (\ref{equation-first-congruence}) and (\ref{equation-second-congruence}) we have $$ P(z) + P(z_1) + w^p P(z) P(z_1) \equiv \xi + z_1^p - z_1 \bmod \pi^{-n + m}B $$ for some $b' \in B$. This contradict the minimality of $n$! Thus $p$ does not divide $n$. Consider the degree $p$ extension $K_1$ of $K$ given by $P(y) = -\pi^{-n}a$. By Lemma \ref{lemma-extension-defined-by-nice-polynial} this extension is separable and totally ramified with respect to $A$. Thus $L_1 = L \otimes_K K_1$ is a field and $A_1 \subset B_1$ is weakly unramified (Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}). By Lemma \ref{lemma-extension-defined-by-nice-polynial} the ring $M_1 = M \otimes_K K_1$ is either a product of $p$ copies of $L_1$ (in which case we are done) or a field extension of $L_1$ of degree $p$. Moreover, in the second case, either $C_1$ is weakly unramified over $B_1$ (in which case we are done) or $M_1/L_1$ is degree $p$, Galois, totally ramified with respect to $B_1$. In this last case the extension $M_1/L_1$ is generated by the element $z + y + wzy$ and we see that $P(z + y + wzy) \in L_1$ and \begin{align*} P(z + y + wzy) & = P(z) + P(y) + w^p P(z) P(y) \\ & \equiv \xi - \pi^{-n}a \bmod \pi^{-n + m}B_1 \\ & \equiv 0 \bmod \pi^{-n + m}B_1 \end{align*} in exactly the same manner as above. By our choice of $m$ this means exactly that $M_1/L_1$ has level at most $\max(0, l - 1, 2l - p)$. From now on we assume that $J \not = \emptyset$. \medskip\noindent Suppose that $j', j \in J$ such that $j' = p^r j$ for some $r > 0$. Then we set $$ z_1 = - \sigma(\lambda_j) \pi^{-j} - \sigma(\lambda_j^p) \pi^{-pj} - \ldots - \sigma(\lambda_j^{p^{r - 1}}) \pi^{-p^{r - 1}j} $$ and we change $z$ into $z' = z + z_1 + wzz_1$. Observe that $z' \in M$ generates $M$ over $L$ and that we have $\xi' = P(z') = P(z) + P(z_1) + wP(z)P(z_1) \in L$ with $$ \xi' \equiv \xi - \sigma(\lambda_j) \pi^{-j} + \sigma(\lambda_j^{p^r}) \pi^{-j'} \bmod \pi^{-n + m}B $$ by using equations (\ref{equation-first-congruence}) and (\ref{equation-second-congruence}) as above. Writing $$ \xi' = \sum\nolimits_{i = n, \ldots, n - m + 1} \sigma(\lambda'_i) \pi^{-i} + \pi^{-n + m}b' $$ as before we find that $\lambda'_i = \lambda_i$ for $i \not = j, j'$ and $\lambda'_j = 0$. Thus the set $J$ has gotten smaller. By induction on the size of $J$ we may assume there is no pair $j, j'$ of $J$ such that $j'/j$ is a power of $p$. (Please observe that in this procedure we may get thrown back into the case that $J = \emptyset$ we treated above.) \medskip\noindent For $j \in J$ write $\lambda_j = \mu_j^{p^{r_j}}$ for some $r_j \geq 0$ and $\mu_j \in \kappa_B$ which is not a $p$th power. This is possible by our assumption (4). Let $j \in J$ be the unique index such that $j p^{-r_j}$ is maximal. (The index is unique by the result of the preceding paragraph.) Choose $r > \max(r_j + 1)$ and such that $j p^{r - r_j} > n$ for $j \in J$. Let $K_1/K$ be the extension of degree $p^r$, totally ramified with respect to $A$, defined by $(\pi')^{p^r} = \pi$. Observe that $\pi'$ is the uniformizer of the corresponding discrete valuation ring $A_1 \subset K_1$. Observe that $L_1 = L \otimes_K K_1$ is a field and $L_1/L$ is totally ramified with respect to $B$ (Lemma \ref{lemma-weakly-unramified-goes-up-along-totally-ramified}). Computing in the integral closure $B_1$ we get $$ \xi = \sum\nolimits_{i \in I} \sigma(\lambda_i) (\pi')^{-i p^r} + \sum\nolimits_{j \in J} \sigma(\mu_j)^{p^{r_j}} (\pi')^{-j p^r} + \pi^{-n + m} b_1 $$ for some $b_1 \in B_1$. Note that $\sigma(\lambda_i)$ for $i \in I$ is a $q$th power modulo $\pi^m$, i.e., modulo $(\pi')^{m p^r}$. Hence we can rewrite the above as $$ \xi = \sum\nolimits_{i \in I} x_i^{p^r} (\pi')^{-i p^r} + \sum\nolimits_{j \in J} \sigma(\mu_j)^{p^{r_j}} (\pi')^{- j p^r} + \pi^{-n + m}b_1 $$ Similar to our choice in the previous paragraph we set \begin{align*} z_1 & - \sum\nolimits_{i \in I} \left(x_i (\pi')^{-i} + \ldots + x_i^{p^{r - 1}} (\pi')^{-i p^{r - 1}}\right) \\ & - \sum\nolimits_{j \in J} \left( \sigma(\mu_j) (\pi')^{- j p^{r - r_j}} + \ldots + \sigma(\mu_j)^{p^{r_j - 1}} (\pi')^{- j p^{r - 1}} \right) \end{align*} and we change our choice of $z$ into $z' = z + z_1 + wzz_1$. Then $z'$ generates $M_1$ over $L_1$ and $\xi' = P(z') = P(z) + P(z_1) + w^p P(z) P(z_1) \in L_1$ and a calculation shows that $$ \xi' \equiv \sum\nolimits_{i \in I} x_i (\pi')^{-i} + \sum\nolimits_{j \in J} \sigma(\mu_j) (\pi')^{- j p^{r - r_j}} + (\pi')^{(-n + m)p^r}b'_1 $$ for some $b'_1 \in B_1$. There is a unique $j$ such that $j p^{r - r_j}$ is maximal and $j p^{r - r_j}$ is bigger than $i \in I$. If $j p^{r - r_j} \leq (n - m)p^r$ then the level of the extension $M_1/L_1$ is less than $\max(0, l - 1, 2l - p)$. If not, then, as $p$ divides $j p^{r - r_j}$, we see that $M_1 / L_1$ falls into case (C) of Lemma \ref{lemma-extension-defined-by-nice-polynial}. This finishes the proof.