% Standalone section, using standard amsmath and amssymb only. \section{A signed logarithmic gap for quadratic rotations} Adamczewski studies discrepancy through substitution and self-similarity \cite{adam}. Ralston uses substitution to follow upper and lower extrema for the half-interval under a quadratic rotation \cite[Corollary~5.8]{ralston}. Here all cuts and the starting point may lie in the rotation's quadratic field. We construct the required finite partition from the two embeddings of that field. The last step is a maximum-mean-cycle argument, the sign-reversed version of the graph invariant studied by Karp \cite{karp}. \paragraph{Proposition.} Let $\alpha\in(0,1)$ be quadratic irrational, let $x\in\mathbb Q(\alpha)$, and let $f$ be a right-continuous, rational-valued step function on $\mathbb R/\mathbb Z$, of mean zero, whose jump points belong to $\mathbb Q(\alpha)$ modulo $1$. Write \[ F_m(x)=\sum_{j=0}^{m-1} f(x+j\alpha). \] If the sequence $F_m(x)$ is unbounded above, then $F_m(x)>c\log m$ for infinitely many $m$, for some $c>0$. The same assertion holds for $-F_m(x)$. In addition, $|F_m(x)|=O_f(\log(2+m))$, with the implied constant allowed to depend on $\alpha$. \paragraph{Proof.} Translate the jump points by $-x$ to arrange $x=0$, and multiply $f$ by a common denominator so its values are integers. Denote by $E$ a finite set of real representatives for the jump points, and put $L=\mathbb Z+\alpha\mathbb Z$. There is an integer $D>0$ with $E\subset D^{-1}L$. Write $v\mapsto v'$ for conjugation in $\mathbb Q(\alpha)$. \emph{Two block lengths.} Choose an index $j$ in the periodic part of the continued fraction of $\alpha$ and a positive even multiple $b$ of its period. With $p_k/q_k$ denoting the convergents, put \[ B_j=\begin{pmatrix}p_j&p_{j-1}\\q_j&q_{j-1}\end{pmatrix}. \] Periodicity gives $B_{j+nb}=B_jM^n$, with a nonnegative unimodular integer matrix $M$ of determinant $1$ and a real eigenvalue $\lambda>1$. Its other eigenvalue is $\lambda^{-1}$. Indeed, the period matrix is a product of the continued-fraction matrices $\left(\begin{smallmatrix}a&1\\1&0\end{smallmatrix}\right)$, and a positive even period gives a positive hyperbolic product. The integer matrix $T=B_j M B_j^{-1}$ fixes the line spanned by $(\alpha,1)$, with expanding eigenvalue $\lambda$, since its iterates applied to the columns of $B_j$ give the convergents. Thus the linear form $(p,q)\mapsto q\alpha-p$ is multiplied by $\lambda^{-1}$ under $T$. In particular $\lambda^{\pm1}L=L$ and $\lambda'=\lambda^{-1}$. By enlarging $b$ we may assume multiplication by $\lambda$ acts trivially on the finite group $D^{-1}L/L$. Let $(P_{n,t},Q_{n,t})$, for $t=0,1$, be the columns of $B_{j+nb}$. There are constants $d_t,A_t,B_t$ such that \[ Q_{n,t}\alpha-P_{n,t}=d_t\lambda^{-n},\qquad Q_{n,t}=A_t\lambda^n+B_t\lambda^{-n}, \] with $A_t>0$. Fix, for each $t$, an ordering of the multiset containing $M_{ut}$ copies of $u$ for $u=0,1$. A block of $Q_{n,t}$ successive rotation iterates splits, in this order, into blocks of lengths $Q_{n-1,u}$. If the parent begins at $\lambda^{-n}y$, a child begins, modulo~$1$, at $\lambda^{-(n-1)}(y/\lambda+d)$, where $d$ is the sum of the $d_u$ over earlier siblings. Only finitely many $d$ occur. Choose $B>0$ with $B/\lambda+\max|d|0$ is eventually constant: the expression on the left is of the form $a\lambda^n+b+c\lambda^{-n}$, which has eventual constant sign or vanishes identically. This proves the assertion. A state is now a pair consisting of $t$ and a stationary cell for that type. The states of its successive children are uniquely determined and independent of $n$. Indeed, each child offset map is the fixed increasing affine map $y\mapsto y/\lambda+d$ above. The preimage of an interior cut of a child is already a cut of the parent, since a rotation iterate in the child is a rotation iterate in the parent. The endpoints of the allowed offset range cannot create an interior cut by the strict choice of $B$. Half-open cells also handle starting points on cuts. Thus the words on the states obey a fixed concatenation rule for all sufficiently large levels. \emph{Block weights and prefix maxima.} For each state $i$, let $W_{n,i}$ be the sum of its word at level $n$. By Denjoy--Koksma, $|W_{n,i}|\leq \operatorname{Var}(f)$: every $Q_{n,t}$ is a convergent denominator and $f$ has mean zero. All $W_{n,i}$ are integers. The finite vector $W_n$ therefore takes just finitely many values. The fixed concatenation rule computes $W_n$ from $W_{n-1}$, so $W_n$ is eventually periodic, say with period $h$. Let $U_{n,i}$ be the maximum of all prefix sums of the word on state $i$, allowing the empty prefix. If its successive child states are $i_1,\dots,i_s$, then \[ U_{n,i}=\max_{1\le v\le s}\left( \sum_{u0$ and all sufficiently large $n$ in the progression. The prefix length $m$ realizing each such bound satisfies $m\leq Q_{n,0}=O(\lambda^n)$, so $F_m(0)>c\log m$ along a sequence $m\to\infty$. Applying the same proof to $-f$ treats the lower excursions. Finally, the continued fraction of $\alpha$ has bounded partial quotients. The Ostrowski expansion of $m$ decomposes any orbit segment into $O_\alpha(\log(2+m))$ convergent-denominator blocks, each of bounded total weight by Denjoy--Koksma. This gives the claimed upper bound.\hfill$\square$ \paragraph{Corollary (extremal envelopes).} Under the assumptions of the proposition, there exist constants $c_+,c_-\geq0$ such that, with either choice of sign, \[ \max_{0\leq m\leq N}\bigl(\pm F_m(x)\bigr) =c_\pm\log N+O_{\alpha,f,x}(1) \qquad(N\geq2). \] The coefficient $c_\pm$ is positive precisely when $\pm F_m(x)$ is unbounded above. Restricting $m$ to a fixed arithmetic progression of positive integer step preserves the coefficient, with a bounded error that may also depend on the progression. \paragraph{Proof.} It suffices to work with the plus sign. Let $D_f$ be the positive integer used to clear denominators in the values of $f$, so the finite phased graph above computes prefix weights for $D_f f$. Fix a root phase $s\pmod h$, and let $\mu_s$ be the maximum mean edge weight of a directed cycle reachable from that root. At least one such cycle exists, because every state has an outgoing edge. The maximum is attained on a simple cycle and is rational. Consider $n\equiv s\pmod h$ and $L=n-n_0$. The root prefix maximum is the maximal weight of a path of length $L$, including the bounded terminal payoff at level $n_0$. From any such path remove closed subwalks until the remaining path is simple. Every removed closed subwalk has mean at most $\mu_s$, and the length and weight of the simple remainder are bounded independently of $L$. The resulting upper bound is $\mu_s L+O(1)$. For the lower bound, use a fixed path to a cycle of mean $\mu_s$ and follow that cycle for all remaining steps, allowing a final partial circuit. This produces a path of every sufficiently large required length, with weight $\mu_s L+O(1)$. Its terminal phase is $n_0\bmod h$ automatically, and the terminal payoff of any state in that phase is bounded. Thus the maximum is $\mu_s n+O(1)$ on phase $s$. Write $A_n$ for the maximum at the root, so $A_n=D_f\max_{m\leq Q_{n,0}}F_m(x)$, including $m=0$. The root words come from the same starting point and have increasing lengths, hence $A_n\leq A_{n+1}$. Comparing the phase asymptotics gives $\mu_s\leq\mu_{s+1}$ cyclically. All phases therefore have the same coefficient $\mu$, which is nonnegative since $A_n\geq0$. For $Q_{n,0}\leq N