def change_fire_color():
    red = random.randint(150, 255)
    green = random.randint(50, 150)
    pixels[0] = (red, green, 0)
    pixels.write()

def fire_effect():
    flicker = random.randint(0, 30)
    brightness = max(0, 255 - flicker)
    pixels[0] = (brightness, brightness, brightness)
    pixels.write()
    time.sleep(random.uniform(0.02, 0.05))

def simulate_sparks():
    pixels[0] = (255, 0, 0)
    pixels.write()
    time.sleep(random.uniform(0.01, 0.05))
    pixels[0] = (255, 255, 0)
    pixels.write()
    time.sleep(random.uniform(0.01, 0.05))
    pixels[0] = (0, 255, 0)
    pixels.write()
    time.sleep(random.uniform(0.01, 0.05))