The MAX_LINES=1000 limit was causing text to disappear after ~25 pages in long chapters. For example, a 93KB chapter generating 242 pages (~9,680 lines) was being truncated at ~1000 lines. Replaced the hard limit with a safety check that prevents infinite loops by forcing advancement when nextBreakIndex doesn't progress, while still allowing all lines to be processed.