間に, 間 and うちに: expressing 'while' and 'before something changes'
Use 間 for a continuing span, 間に for an event within that span, and うちに for an opportunity or change before a condition ends.

In short
Use 間 for something continuing through a span, 間に for an event or bounded action within it, and うちに when the current state offers an opportunity or a change happens before the state ends.
| Form | Time relation | Japanese example |
|---|---|---|
| 間 | Continuing situation over the relevant period | 夏休みの間ずっと働いた。 |
| 間に | An event within the period | 留守の間に荷物が届いた。 |
| うちに | Before the current state changes | 温かいうちにどうぞ。 |
母が電話している間、私はずっと外で待っていました。
丁寧語 politeI waited outside the whole time my mother was on the phone.
ずっと makes the duration explicit.
母が電話している間に、バスが来ました。
丁寧語 politeThe bus arrived while my mother was on the phone.
The arrival is a bounded event.
Use the window before it closes
若いうちに、いろいろな仕事を経験したいです。
丁寧語 politeI want to experience various jobs while I am young.
There is a limited opportunity.
何度も聞いているうちに、歌詞を覚えました。
丁寧語 politeAs I listened repeatedly, I learned the lyrics.
The change emerged during a process, rather than being deliberately scheduled.
Attachment is parallel for many modifiers: verb plain form + 間 or うちに, i-adjective + 間 or うちに, na-adjective + な + the noun-like expression, noun + の + 間 or うちに where semantically appropriate. For an opportunity, 忘れないうちにメモする is natural. The negative form describes the state before forgetting. 間に and うちに overlap in some contexts; the latter highlights the window or developing change. Do not treat every occurrence of one as a mistake when the other would also be grammatical.
When reading, underline the clause before the time expression and bracket the main predicate. Decide whether it is continuing, bounded, or changing. A deadline phrase such as 今日中に has a different structure but can share the idea of finishing inside a window.