## 2 Materials and Methods  
### Sensor Design, Fabrication, and Characterization  
Our detection platform is based on the concept of GGP-GMR, which is based on the guided-mode resonance (GMR) effect [11; 12]. With an appropriate design in device geometry and material selection, at normal incidence, a specific wavelength of light (resonant wavelength) can be reflected, which results in minimum transmission; thus, GMR functions as a bandstop filter. The resonant wavelength can be calculated under the second-order Bragg condition [13], namely \(\lambda_{R}=n_{eff}\Lambda\), where \(\lambda_{R}\) is the resonant wavelength, \(n_{eff}\) is the effective refractive index, and \(\Lambda\) is the grating period. The variable \(n_{eff}\) can be considered as a weighted average of the refractive indices of the overall GMR structure, which can be calculated by referring to [14]. The resonant wavelength is highly sensitive to the grating period. By varying the grating period along a device, a linearly varying bandstop filter can be achieved, where the resonant wavelength varies along the device. Such a device is termed as a GGP-GMR device [15]. The GGP-GMR device used in this study comprises a simple three-layer structure consisting of a polyethylene terephthalate (PET) substrate, an optical adhesive (Norland 68 [NOA 68], Norland Products Inc., Cranbury, NJ, USA) replicated gradient grating structure, and a TiO\({}_{2}\) waveguiding layer (Figure 1a). The detailed design and fabrication of this GGP-GMR device are highly similar to those in our previous study [15]. In brief, the GGP-GMR device used in this study has a grating period varying from 250 to 550 nm in increments of 2 nm. Each period comprises 100 repeated cycles. A GGP-GMR device with grating periods ranging from 250 to 550 nm can support resonant wavelengths with a bandwidth of over 400 nm [15]; however, for the purpose of this study, only grating periods corresponding to resonant wavelengths between 500 and 700 nm were used to demonstrate the fluorescence and colorimetric detection ability of the developed device. To fabricate the device used in this study, first, electron beam lithography and reactive ion etching were used to pattern the gradient grating period of a Si master with a grating depth of 85 nm and a duty cycle of approximately 0.5. The liquid form of NOA 68 was then sandwiched between the Si master and a flexible PET sheet. Once NOA 68 was solidified with ultraviolet light exposure, the NOA 68/PET with the replicated gradient grating pattern was separated from the Si master. Finally, a TiO\({}_{2}\) layer (\(\sim\)130 nm thick) was sputter-coated on top of NOA68/PET. A detailed discussion on the device geometry and optical characterization can be found in [15]. The GGP-GMR device exhibits linearly varying resonance, as illustrated in Figure 1a. For a specific monochromatic illumination, the light resonates (and reflects) in a specific period, as illustrated by the orange arrow in Figure 1a, and is transmitted in other periods, which results in the minimum intensity underneath this period, as represented by the dark gray pixel on the CCD in Figure 1a. To examine the spatially dependent resonance, a broadband-light-coupled (LSH-150, Taiwan Fiber Optics, Inc., Taipei, Taiwan) monochromator (DK242, Spectral Products, Putnam, CT, USA) was used to generate a narrowband light source with a linewidth of approximately 2.5 nm. The light was coupled with a 600-um optical fiber and collimated before illuminating the GGP-GMR device. A combination of short- and long-pass filters was used to limit the spectral range between 500 and 700 nm. The transmitted light was recorded using a linear CCD (LHCCD01304, ToupTek Photonics Co., Hangzhou, Zhejiang, China). Figure 1b-d presents the transmission efficiency recorded by the linear CCD at three incident wavelengths--520, 600, and 680 nm. The aforementioned figure clearly indicates that the light reflects at different locations (periods), which results in minimum intensities at different pixels corresponding to these periods.