We study a Brownian excursion on the time interval |t| ≤ T , conditioned to stay above a moving wall x0 (t) such that x0 (−T ) = x0 (T ) = 0, and x0 (|t| < T ) > 0. For a whole class of moving walls, typical fluctuations of the conditioned Brownian excursion are described by the Ferrari-Spohn (FS) distribution and exhibit the Kardar-Parisi-Zhang (KPZ) dynamic scaling exponents 1/3 and 2/3. Here we use the optimal fluctuation method (OFM) to study atypical fluctuations, which turn out to be quite different. The OFM provides their simple description in terms of optimal paths, or rays, of the Brownian motion. We predict two singularities of the large deviation function, which can be interpreted as dynamical phase transitions, and they are typically of third order. Transitions of a fractional order can also appear depending on the behavior of x0 (t) in a close vicinity of t = ±T . Although the OFM does not describe typical fluctuations, it faithfully reproduces the near tail of the FS distribution and therefore captures the KPZ scaling. If the wall function x0 (t) is not parabolic near its maximum, typical fluctuations (which we probe in the near tail) exhibit a more general scaling behavior with a continuous one-parameter family of scaling exponents.