#version 330

uniform sampler2D texture0;
uniform vec2 resolution;
uniform float time;

in vec2 fragTexCoord;
out vec4 fragColor;

void main() {
    vec2 uv = fragTexCoord;

//    // Subtle horizontal distortion (small, smooth)
//    float wave = 0.003 * sin(uv.y * 80.0 + time * 2.0);
//    uv.x += wave;
//
//    // Very light vertical distortion
//    uv.y += 0.002 * sin(uv.x * 50.0 + time * 2.5);

    // RGB slight chromatic aberration
    float r = texture(texture0, uv + vec2(0.0015, 0.0)).r;
    float g = texture(texture0, uv).g;
    float b = texture(texture0, uv - vec2(0.0015, 0.0)).b;

    vec3 color = vec3(r, g, b);

    // Very light scanlines
    float scanline = 0.96 + 0.04 * sin(uv.y * resolution.y * 2.5);

    fragColor = vec4(color * scanline, 1.0);
}
